Building PDFs from a Camera

So, being as how I’m a cheapskate and all, I’m using one of Sue’s old textbooks for a class this semester. It’s a couple of editions behind, but everything in the content seems to be the same. Naturally, though, they’ve changed the exercises. And since the homework is based on the exercises, I need those.

Well, for the first few chapters I borrowed the book from a friend and ran it through the photocopier. But it’s a big, thick textbook and a real hassle to copy. So for the next bunch of problems, I took a different approach.

1. I used a digital camera to take snapshots of all the pages I needed.

2. I copied all of the photos to a single directory on my (Linux) computer.

3. I used ImageMagick to convert each photo into a PDF, and drop those into a directory named “PDFs” under the current one:

mkdir PDFs
for i in `ls *jpg`; do convert $i PDFs/$i.pdf; done;

4. I used pdftk to stitch them all together.

cd PDFs
pdftk *pdf cat output final.pdf

5. Ta-da! Now everything is in one PDF file, one photo per page.

10 Responses to “Building PDFs from a Camera”

  1. Kevin says:

    Matt, you win the nerd battle today sir.

  2. BrianN says:

    Awesome. Windows needs a concatenate feature.

  3. matt says:

    I would imagine that you can probably do it with Acrobat, but I haven’t tried.

  4. Pitt says:

    Yes, you can use Acrobat. In fact, many programs, realizing that PDF is sort-of the default format for exchanging documents, allow you to save as a PDF. Solidworks even allows you to save models as a 3-D PDF, so the recipient of said file can spin it around and see it from any angle. Pretty slick.

  5. matt says:


    See, stuff like that annoys me. Not because the functionality isn’t cool, but because it is often a completely non-standard extension that deviates wildly from the actual PDF standard. I’d much rather see Solidworks output to its own discrete format.

    PDF is supposed to be “Portable Document Format”. Instead of printing something out, you wrap it in a PDF and it is identical on every computer you view it on.

    (I’m not picking on Solidworks here — it also bugs me to no end that Adobe is pushing PDF as a “create forms to fill-in-the-blanks” format. Gee, if only we had some sort of Hypertext Markup Language that could handle that…)

  6. Pitt says:

    Well, Solidworks does output to its own formats- sldprt, sldasm, slddrw, etc- but it also allows “printing” to PDF format so you can show models to people who don’t have Solidworks on their machines. The PDF files are also typically smaller than the sld*** formats files, which makes emailing them easier, too. For me, its a very nice feature.

  7. BrianN says:

    You can indeed concatenate in acrobat, but last time I submitted a grant (40 pages, in about 8 separate files) the drag and drop thing got kind of annoying.

  8. matt says:


    I’m sure it’s a great feature for anyone who uses the Official Adobe Acrobat Reader product. I don’t, though, so I occasionally get burned by additional features that have been shoehorned into a PDF and aren’t part of the actual spec.

    I’m a Unix nerd. I want every tool to do one job, do it very well, and be interoperable with other tools through some simple mechanism.

  9. Pitt says:


    Let me know how that works out between your spatula and your hedge trimmer. 😉

  10. matt says:


    Well, I suppose that my dream of a pancake bush hangs in the balance.

Leave a Reply