66

Openning a png file in ubuntu, I can see the menu item for 'print to file'. How can I do the same on shell? PS: I prefer installing no extra package, due to lack of root access.

EDIT: the operating system is ubuntu 11.10

103

convert xyz.png xyz.pdf should do the trick.

See man convert for more options.

  • 13
    +1 - additionally you can use wildcards: convert *.png file.pdf – Geppettvs D'Constanzo Jun 30 '12 at 18:49
  • does this require extra packages? – Richard Jun 30 '12 at 19:27
  • 3
    Yes it requires the ImageMagick package, although it was there by default on my Ubuntu 12.04 – abhshkdz Jun 30 '12 at 19:29
  • Also there by default on lubuntu 12.10. – Rasmus Nov 23 '12 at 7:59
  • 4
    Be careful if you use wildcards, files might not appear in the desired order, especially if filenames contain numbers (for example, a file named 17.png will precede a file named 2.png). To preview the order in which they will be merged into the pdf file, you can use the command echo *.png. – user396895 Apr 10 '15 at 20:24
14

If you want to convert multiple images, e.g. png files, into one single pdf use convert with the specified pdf filename at the end

convert *.png mydoc.pdf

It will merge all png files into a sinlge mydoc.pdf file in a descendant order.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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