Skip to content

PDF To Images

Type: pdf-to-images  ·  Package: PDF Activities v1.2.4  ·  Output: List

Since: v1.1.0

Renders the pages of a PDF to PNG files. It is the bridge between a scanned PDF (no selectable text) and the activities that work on images: OCR and the vision ones.

Renders each requested page to a PNG inside outputDir (created if it doesn’t exist) and returns the list of paths of the files created, in page order. The original PDF stays intact.

Files are named <prefix>_<page>.png with the page number as three digits — for example invoice_001.png, invoice_002.png. If you don’t set prefix, the source PDF name without extension is used. Files with the same name are overwritten.

dpi sets the render quality: higher DPI improves OCR accuracy, at the cost of time and file size. The default is 200, usually a good balance for documents; 300 helps with small print. An A4 sheet at 200 DPI gives an image of about 1654 × 2339 pixels.

Before rendering it checks the DPI and that all the requested pages exist: if something is wrong, no file is created.

ParameterTypeDefaultDescription
pathstring—Path of the source PDF.
outputDirstring—Folder where the PNGs are saved. Created if it doesn’t exist.
ParameterTypeDefaultDescription
pagesstring | List"all"Pages to render: "all" or a range like "1-3,5,7-9", or a list of numbers such as the one from PDF Search Text. Since 1.2.4.
dpiint200Render resolution, an integer between 36 and 1200.
prefixstringsource namePrefix of the file names. By default, the PDF name without extension.

Returns a List of string with the full paths of the PNGs created, one per rendered page and in ascending page order (e.g. ["C:/temp/pages/invoice_001.png", "C:/temp/pages/invoice_002.png"]).

MessageCause and fix
Page(s) out of range: …. The document has … pages.The range asks for pages that don’t exist.
'dpi' must be an integer. Received: ….dpi is not an integer.
'dpi' must be between 36 and 1200. Received: ….Resolution outside the supported range.
File not found.The path doesn’t exist.
'path' is required. / 'outputDir' is required.The parameter was left empty or its expression returned null.
Error opening or rendering the PDFPassword-protected or damaged PDF. See Protected and damaged PDFs.

Read a scanned PDF by running it through OCR page by page:

PDF To Images path = scannedPath outputDir = "C:/temp/pages" dpi = 300 → output: images
For Each items = images itemVariable = image
└─ activities:
OCR Recognize File path = image language = "eng" → output: text
Log message = text

Render only the first page:

PDF To Images path = filePath outputDir = "C:/temp" pages = "1" prefix = "cover" → output: images
  • OCR Recognize File — read the text of the generated images.
  • PDF Get Words — if the PDF does have text, get the words with coordinates that match these images at the same DPI.
  • PDF Get Text — extract text without going through images.