Forrest logo
back to the pdftocairo tool

pdftocairo:tldr:c2a91

pdftocairo: Convert to PNG cropping x and y pixels from the top-left corner.
$ pdftocairo ${filename-pdf} -png -x ${x_pixels} -y ${y_pixels}
try on your machine

This command is used to convert a PDF file into a PNG image. Here is an explanation of each part of the command:

  • pdftocairo: This is the name of the command-line tool used to convert PDF files. It is usually included in the Poppler package, which provides various utilities for working with PDF documents.

  • ${filename-pdf}: This is a placeholder for the name of the PDF file you want to convert. You need to replace ${filename-pdf} with the actual filename and file path of the PDF file you want to convert.

  • -png: This option specifies that the output format should be PNG. It tells pdftocairo to convert the PDF file into a PNG image.

  • -x ${x_pixels}: This option specifies the desired width of the output image in pixels. You need to replace ${x_pixels} with the actual number of pixels you want for the width.

  • -y ${y_pixels}: This option specifies the desired height of the output image in pixels. You need to replace ${y_pixels} with the actual number of pixels you want for the height.

When you run this command with the appropriate values, pdftocairo will convert the specified PDF file into a PNG image with the given width and height in pixels. The resulting image will be saved in the same directory where the command is executed.

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 pdftocairo tool