pdf to img

English Aritcles · 13 天前

One of the great benefits of using Linux is that you can have a variety of software, which is free and convenient to implement various functions. Today, let's talk about how to convert PDF to IMG.

1. Operating System 

  • Operating system: debian 12

2. PDF to IMG

2.1 Software name

  • pdftoppm

2.2 Software installation

  • Open the terminal and enter the following command

sudo apt install poppler-utils

2.3 Software use

  • Convert test.pdf file: Open the terminal and enter the following command, and finally get the pictures test-1.png and test-2.png, where 1 and 2 are the page numbers of the test.pdf file.

pdftoppm test.pdf test -png
  • If you want to use python to batch convert all pdf files in the /tmp/test/ directory, the entire code is as follows:


import os


hehe = os.popen('ls').readlines()

for pdf in hehe:

pdf = pdf.rstrip('\n')


os.system(f'pdftoppm {pdf} {pdf} -png')
Theme Jasmine by Kent Liao