Convert a PDF to an Image (PNG, JPG, etc) in Linux using ImageMagick

SHARE:

I recently encountered a problem printing a PDF file where parts of the file weren’t being printed by my printer. I tried multiple times but got the same result – a part of my PDF wasn’t being printed (as if it was being censored). I thought that the problem was with my printer not reading my PDF correctly since it was being read correctly by my document/PDF viewer. Instead of finding out what was wrong with my printer or the PDF, I had this idea of just converting the PDF into an image and then printing the image afterwards.

A cursory Google search led me to a very simple command to convert a PDF into an Image in Linux using the convert command of ImageMagick.

convert -density 300 -trim <input-pdf>.pdf -quality 100 <output-image>.png

So I opened up my terminal, went to the directory holding my single page PDF file, ran the command, and got myself a PNG file that I then printed. Viola! The parts that weren’t being printed before when I was printing the PDF were now printed perfectly.

SHARE:

comments powered by Disqus

You may also like:

Make a gif from a video using ffmpeg and ImageMagick on Linux

Connecting or Mounting a Windows Share folder in Xubuntu 16.04

Wanna Stick it to the Man? Use FOSS.

The FOSS Life