Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert multipage PDF to a single image

I have to convert a multipage PDF document to a .png image.

I try with ImageMagick, but I cannot achieve final result:

convert document.pdf document.png 

or

convert -adjoin document.pdf document.png 

This command create N images .png (where N=num of page of document):

document0.png document1.png ....  document(N-1).png 

I need, if possible with a single command, to obtain a single image.

like image 300
Luca Davanzo Avatar asked Feb 06 '14 14:02

Luca Davanzo


People also ask

Can you save multiple pages as a JPEG?

No, JPEG file format does not support multi-page images.

How do I convert a PDF to a single page?

Select "Plug-Ins > Split Documents > Split Document..." from the main menu to open the "Split Document Settings" dialog. Select the "Equal size documents of" option in the "Split Method" list. Enter a number of pages per output document. For example, enter "1" to split into single-page documents.


2 Answers

Finally I find THE solution:

convert in.pdf -append out%d.png 

Thanks to this post.

edit

As a plus, the opposite operation is:

convert *.png output.pdf 

or if you have foo1.png, foo2.png..fooN.png

convert foo?.png output.pdf 

Notice that does not work with foo01.png, foo02.png..foo0N.png

like image 122
Luca Davanzo Avatar answered Sep 22 '22 06:09

Luca Davanzo


+append will put images side by side, i.e. horizontally instead of vertically (with -append)

convert in.pdf +append out%d.png 
like image 41
xb. Avatar answered Sep 19 '22 06:09

xb.