Although ideally I try to create and use PDF files whenever I create something that is to be printed or even used on screen. It’s a universal, well defined open format. The added advantage is that is works well with vector graphics, something you really want for high quality material. However, sometimes external circumstances force you to deviate from your preferences. Yesterday I needed to import a PDF image into a LibreOffice Impress presentation. Unfortunately Impress can’t import PDF images. So I decided to convert my PDF image to a PNG file. My first idea was to use the convert
utility:
convert file.pdf file.png
However, the default resolution was too low (and can be corrected using the -r
option), but more importantly, I had some colour problems that I didn’t know how to correct.
I quickly looked around on the web and found this answer on superuser.com that pointed me to the pdftoppm
tool. That worked brilliantly:
pdftoppm -r 1200 -png file.pdf > file.png