PDF To Images
PDF To Images
Section titled “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.
How it works
Section titled “How it works”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.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
path | string | — | Path of the source PDF. |
outputDir | string | — | Folder where the PNGs are saved. Created if it doesn’t exist. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
pages | string | 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. |
dpi | int | 200 | Render resolution, an integer between 36 and 1200. |
prefix | string | source name | Prefix of the file names. By default, the PDF name without extension. |
Output
Section titled “Output”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"]).
Common errors
Section titled “Common errors”| Message | Cause 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 PDF | Password-protected or damaged PDF. See Protected and damaged PDFs. |
Example
Section titled “Example”Read a scanned PDF by running it through OCR page by page:
PDF To Images path = scannedPath outputDir = "C:/temp/pages" dpi = 300 → output: imagesFor Each items = images itemVariable = image └─ activities: OCR Recognize File path = image language = "eng" → output: text Log message = textRender only the first page:
PDF To Images path = filePath outputDir = "C:/temp" pages = "1" prefix = "cover" → output: imagesRelated activities
Section titled “Related activities”- 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.