Join our Discord community for support and discussions! Connect with us →

Tutorials

Multi-Page Processing

By default, PDF2IMG converts the pages in a PDF file into multiple single-page image files. The system assigns a name to each image file with an underscore character (_) added between the file name prefix and the sequence counter number. For example, the five pages in a PDF input file called Convert.PDF would be exported as five bitmap files:

By default, PDF2IMG converts the pages in a PDF file into multiple single-page image files. The system assigns a name to each image file with an underscore character (_) added between the file name prefix and the sequence counter number. For example, the five pages in a PDF input file called Convert.PDF would be exported as five bitmap files:

  • convert_1.BMP
  • convert_2.BMP
  • convert_3.BMP
  • convert_4.BMP
  • convert_5.BMP

If you are working with a long PDF document, the software will pad the sequence number with leading zeroes as needed to keep export files in order by name. So if Convert.PDF has 128 pages, the first files will be:

  • convert_001.BMP
  • convert_002.BMP
  • convert_003.BMP

You can control multi-page output using these optional command line arguments:

  1. pdf-rasterize-split / pdf-split — Export a PDF document as a series of separate PDF files (one per page), rather than a graphic format like PNG or BMP. Pair with the pdf2img_set_pdf_output_type() API call.
  2. firstonly — Convert only the first page of the input PDF. Useful for testing a conversion before processing a series of long documents.
  3. multipage — Convert a multipage PDF into a single multipage TIFF document.
  4. digits — Specify the number of digits for numbering output files and suppress the underscore character. For example, -digits=3 produces FILE001.JPG, FILE002.JPG, and so on.
  5. output — Specify an alternate output file name prefix. The value given will be used as the base name, with a sequence number and appropriate extension appended, such as sample_1.gif, sample_2.gif, and so on.
An alternate folder location can be specified for output files, but that folder must already exist. PDF2IMG will not create it automatically.