2009-05-16

Generating a multiple page 11x17 PDF from drawings in QCAD

During the course of my job, I've been generating a lot of technical drawings for various parts that I need in the lab. One such part was a panel on which to mount a bunch of valves to handle the various process gasses we need for our experiments, so I laid out the drawing using QCAD. In order to have this panel fabricated by Pittsburgh Valve and Fitting, I decided to generate an 11x17 PDF with several pages so that it would be clear what I wanted. Making this multiple page PDF was non-trivial. From QCAD, one can only print postscript files. Here's what I did to get what I wanted.

  1. Select 11x17 paper size in QCAD for my drawing.

  2. Use print preview to line up and scale the drawing on the page.

  3. Export the drawing as a postscript file. I exported one .ps file for each page in my PDF. Now I have a bunch of postscript files laying around my filesystem named 1.ps, 2.ps, and 3.ps.

  4. Use ps2pdf with some options to generate individual pdfs of each page. I found a very helpful post on a blog called The Open Access Peon.

    I executed essentially the following commands a few times:

    $ identify 1.ps

    1.ps PS 791x1223 791x1223+0+0 DirectClass 16-bit 52.9277kb


    $ ps2pdf -dDEVICEWIDTHPOINTS=791 -dDEVICEHEIGHTPOINTS=1223 1.ps

    That last command gave me the following PDFs: 1.pdf, 2.pdf, 3.pdf)

  5. Use pdftk to cat all the resultant PDFs together:

    $ pdftk 1.pdf 2.pdf 3.pdf cat output schematic.pdf

    Result: schematic.pdf


  6. Rotate the pages of the result 90 degrees CW:

    $ pdftk schematic.pdf cat 1-endE output schematicnew.pdf

    Result: schematicnew.pdf



I'm pretty sure those last pdftk commands could be collected together, but that exercise is left to the reader.

Ultimately, one could develop a workflow with scripts that would build a PDF document from a dxf file using QCAD.

It should be noted that the panel we are going to wind up with is fairly different than the example given in this post.

3 comments:

reflectoscope said...

How did you export to .ps?

Jim

Joshua said...

You should be able to find it in the print options. You can either print to a printer or to postscript.

reflectoscope said...

The one place I didn't look, of course! Thanks for the lead, and thanks for the article.

Jim