Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have saved multiple images from google books. I wanted to convert them to a single pdf file, where in I need some inputs. The below two images(one png and one jpeg) are two continuous pages.

first page(png)

second page(jpeg)

I save them in my system. I converted them to pdf using the command below

convert books.png books.jpeg combined.pdf

However the combined.pdf is not giving me expected results, not the combination of the two.

I also tried making individual pdf files, then combining them using pdftk, with no luck

convert books.png book1.pdf
convert books.jpeg book2.pdf
pdftk book1.pdf book2.pdf cat output combined.pdf
share|improve this question
    
Try changing book1.pdf and book2.pdf to be in one folder, cd to that folder and run pdftk *.pdf cat output onelargepdfile.pdf. –  Tim Jul 9 at 11:41
    
Tim, Thanks. That also I had tried, however still the same result. –  user301880 Jul 9 at 11:44
    
Thats strange. Maybe it doesn't see the image pdfs as valid pdf files? –  Tim Jul 9 at 11:44
    
It's quite interesting. I tried doing it on the machine and it is not working as desired. It shows the correct thumbnails though. –  Vivek Kapoor Jul 9 at 11:50
    
If you open the image file, and then print it to file, does it let you combine those files? –  Tim Jul 9 at 11:52

5 Answers 5

up vote 5 down vote accepted

I used the two sample pages you provided and printed them using cups-pdf printer resulting in two pdf files.

Then I used pdfsam to combine pdf files in one. I see no problem in the result.

Edit: I just saw that you have many files to process, you can use print-selected script in Nautilus described here

share|improve this answer
    
Thnaks. I will try this... –  user301880 Jul 9 at 12:11
6  
Command line way to do it - Rename the files: mv books.png 1.png, mv books.jpg 2.jpg - Print them to PDFs: lpr -P 'Cups-PDF' 1.png, lpr -P 'Cups-PDF' 2.jpg - Combine PDF files: pdfunite ~/Desktop/1.pdf ~/Desktop/2.pdf complete.pdf. Cup's PDF printer outputs the files to ~/Desktop with the names of the original files - so they both can't be called books.* otherwise they just replace each other. You can list printers and their names with lpstat -p. –  Wilf Jul 9 at 12:12

Recently, I was helped by others with a problem converting hundreds of images into individual PDF files. I was pleasantly surprised to find pqScan to effortlessly do this.

Usage: (coverts all images into one pdf): convert *.jpg foo.pdf

Usage: (converts each image into an individual pdf):

IFS=$'\n';for x in `ls -w 1 *.jpg`;do convert $x `echo $x | sed 's/\.jpg$/.pdf/'`;done

This is if you want .jpg to be replaced with .pdf. This command will work with any image. Replace .jpg with whatever image extension you want.

share|improve this answer

Try PDF-Shuffler from the Software Centre. You can import multiple PDF files, then delete, rotate, re-arrange, etc., individual pages.

share|improve this answer

If all the images are in the same folder and have the same extension you could do the following:

Convert images to pdf:

ls *.tif | xargs -I% convert % %.pdf

Merge pdf files into one pdf and remove single page pdfs:

pdftk *.pdf cat output merged.pdf && rm *.tif.pdf
share|improve this answer

Just use this:

convert "*.{png,jpeg}" outfile.pdf

In general case you can combine more files into one pdf file with including them inside {} and separate them with a single comma.

convert "*.{ext1,ext2,ext3,...}" outfile.pdf
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.