For the complete documentation index, see llms.txt. This page is also available as Markdown.

Document To Image

Convert a document into images so a model can see its layout.

Document To Image converts an existing document — PDF, DOCX, XLSX — into one or more raster images (PNG by default), one per page or sheet.

The point is not the file format. It's that many capable models are trained to see: layout, position, and visual structure carry meaning that flat extracted text loses. Converting first lets the agent look at a document rather than only read it.

How it works

  1. Input resolution — uses $input (the previous skill's output), $agent (agent-level variables), and $secret (vault secrets).

  2. Processing:

    • Pulls the source file from internal storage using documentId.

    • Streams pages/sheets to the rendering engine, respecting pageLimit.

    • Encodes each page/sheet as an image and writes it to outputStorage.

    • Generates lightweight metadata — page number, sheet name — for each rendered image.

  3. Execution — blocking, typically completing in one invocation for 50 pages or fewer. Large files may be handed to an async worker, but the skill still behaves as blocking.

  4. Response:

    • Success — an imagesResult array, one entry per page/sheet.

    • Partial — some pages failed; the error message explains which.

    • Failure — unrecoverable errors, such as an unconvertible format, throw a workflow-catchable exception.

Document To Image processing flow

Worked example: visually classifying financial statements

A workflow receives a mix of financial documents — PDF tax returns, scanned balance sheets that are also PDFs. The agent needs to classify them: is this a balance sheet or an income statement? The visual layout usually answers that faster and more reliably than the text does.

The problem. Models that classify well from images can't read a raw PDF the same way. Handing over the file directly wastes the visual cues that make the classification easy.

The approach. Put a Document To Image skill between the upload and the classifier. Convert the document to page images, then pass those to a reasoning or classification step.

Set pageLimit deliberately — for classification you usually need the first page, not all forty. Every extra page is render time and model cost for information that doesn't change the answer.

Configuring the source document and page limit

Configuration reference

Field
Type
Required
Description

documentId

string

The document to convert.

source

string

conversation for a temporary file, storage for a persistent one.

sourceStoragePath

string

The path, when source='storage'.

pageLimit

number

Maximum pages to convert, starting at page 1.

outputStorage

string

conversation (default) or storage — where images are written.

outputstoragePath

string

Allowed when outputStorage='storage'.

name

string

Display name for this skill instance.

description

string

Longer description shown in the builder.

Output

Field
Type
Always
Description

statusCode

number

HTTP-like — 200 success, 400/500 error.

error

string | null

Populated when statusCode is above 200.

imagesResult

array

One entry per converted page/sheet.

Each entry in imagesResult:

Property
Type
Description

images

array

Each rendered image, as { documentId: string }.

sheetName

string

Source sheet name, for spreadsheet input.

pageNumber

number

Source page number.

Each rendered image gets its own documentId, so downstream skills treat it exactly like any other document.

Errors

Error
Cause

DocumentNotFoundError

Invalid or inaccessible documentId.

UnsupportedFormatError

The file type cannot be converted.

RenderTimeoutError

Exceeded the platform time-box for large files.

Each surfaces with an error status and a descriptive message.

Testing in isolation

  • Path/skill-runtime/workflows/nodes/DocumentToImage/execute

  • MethodPOST

  • Body:


To add this skill to an agent, see Adding a Skill to the Agent.

Last updated