Is there a software way to convert a sequence of image files to PDF?

I have a sequence of jpg images. Each scan is already cropped to the exact size of one page. These are consistent pages of a valuable and printed book. The publishing application requires that these pages be submitted as a single PDF file.

I could take each of these images and just pass them to a word processor (for example, OpenOffice) - unfortunately, the problem is that this is a very large book, and I have quite a few such books to go through. Obviously, this will take a long time. This is volunteer work!

My second idea was to use LaTeX (actually pdflatex) - I could make a very simple document consisting only of a series of embedded images. I am sure that this approach could be applied to work, it is a bit on the difficult side for something like simple work.

It occurred to me that there should be an easier way - so any suggestions?

I'm on Ubuntu 9.10, my main programming language is Python, but if the solution is super-simple, I would gladly accept any technology that works.


UPDATE, can someone explain what is going wrong here?

sal@bobnit :/media/NIKON D200/DCIM/100HPAIO/bat$ convert '*.jpg' bat.pdf convert: unable to open image `*.jpg': No such file or directory @ blob.c/OpenBlob/2439. convert: missing an image filename `bat.pdf' @ convert.c/ConvertImageCommand/2775. 

Is there a way in the syntax of the convert command to indicate that bat.pdf is the result?

thanks

+6
python documentation pdf-generation latex tex
source share
3 answers

If you are interested in the Python solution, you can use the ReportLab library. For example:

 from reportlab.platypus import SimpleDocTemplate, Image from reportlab.lib.pagesizes import letter from glob import glob doc = SimpleDocTemplate('image-collection.pdf', pagesize=letter) parts = [Image(filename) for filename in glob('*.jpg')] doc.build(parts) 

This will take all the jpg files in your current directory and create a file called "image-collection.pdf".

+6
source share

It occurred to me that there should be an easier way - so any suggestions?

You are right, there is! Try the following:

 sudo apt-get install imagemagick cd ~/rare-book-images convert "*.jpg" rare-book.pdf 

Note: depending on which shell you use "* .jpg", it may not work as expected. Try to refuse quotes and see if this brings you the expected results.

+12
source share

I wonder if you can just do this with a for loop with the \includegraphics command inside and some suitably different standard image file name, etc. inside the LaTeX file. This may have the advantage of allowing you to use cover pages, etc., pagination, etc. (I'm not sure any of the other solutions will do this, and I can't bother to check. I'm just pondering here, really)

0
source share

All Articles