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

05 Oct 2018 ᛫ 1 min read

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:

My new daily driver

15 Feb 2020 ᛫ 6 min read

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

05 Jan 2018 ᛫ 2 min read

The opposite of free/libre and open source isn't commercial, it's proprietary

27 May 2021 ᛫ 2 min read

Connecting or mounting a Windows share folder in Xubuntu 16.04

11 May 2017 ᛫ 1 min read

Wanna stick it to the Man? Use FOSS.

20 Mar 2017 ᛫ 6 min read

Support BNHR

If you find my website or any of the materials I share useful, you can consider donating to the cause below.

Donate and support BNHR

BNHR

[email protected]

Creative Commons License
Except when explicitly stated otherwise, this work and its contents by Ben Hur S. Pintor is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Other works (software, source code, etc.) referenced in this website are under their own respective licenses.
This site is powered by Jekyll and hosted on Github (view source)