Forrest logo
back to the pdftoppm tool

pdftoppm:tldr:ea24c

pdftoppm: Generate a grayscale PGM file (instead of a color PPM file).
$ pdftoppm -gray ${filename-pdf} ${image_name_prefix}
try on your machine

This command is using the utility program "pdftoppm" to convert a PDF file into a series of PPM (Portable Pixmap) images in grayscale format.

Let's break down the command:

  • "pdftoppm": This is the name of the utility program that will be executed.
  • "-gray": This is an option provided to "pdftoppm" to specify that the generated images should be in grayscale. If this option is omitted, the images would be in color.
  • "${filename-pdf}": This is a placeholder for the filename of the input PDF file. You need to replace it with the actual name of the PDF file you want to convert. The extension of the PDF file is ".pdf".
  • "${image_name_prefix}": This is a placeholder for the prefix of the output image files. When the PDF is converted, multiple PPM image files will be generated, and this prefix will be used to form their names. You need to replace it with the desired prefix for the image files.

To execute this command, you should replace "${filename-pdf}" with the actual PDF file name and "${image_nameprefix}" with the desired prefix for the output image files. For example, if you have a PDF file called "document.pdf" and you want the output image files to have the prefix "page", the command would look like:

pdftoppm -gray document.pdf page_

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the pdftoppm tool