Loopfour
Blocks

PDF Block

Read text, extract selected pages, or inspect PDF files in a workflow

The PDF block reads text from a document, creates a smaller PDF from selected pages, or reports basic file information. It is a core block and does not require a connection or API key.

Use a workspace file ID when possible. The block also accepts a public HTTP(S) URL or inline base64 content; when more than one source is set, fileId takes precedence, followed by url, then content.

PDF sources are limited to 64 MiB. URL downloads are time-bounded, revalidate every redirect, and refuse private-network destinations. For reliable large-file workflows, save the document to workspace files first and pass its fileId.

Operations

OperationBehaviour
readTextExtract text from selected pages. Reads at most 500 pages and returns at most 10 MiB of text.
extractPagesCreate a PDF containing the selected pages. Saves to workspace files by default.
getInfoReturn page count, filename, byte size, and encryption status without extracting text.

Source and Page Selection

All operations accept one source:

FieldDescription
fileIdID returned by a workspace-file or persisted-download step. Preferred for large files.
urlPublic http or https URL. Embedded URL credentials and private-network targets are rejected.
contentInline PDF content. contentEncoding defaults to base64; use text only when the input is literal text bytes.

readText and extractPages share the same 1-based page selectors:

  • pages: explicit pages and ranges, such as 1-5, 8, 11-13
  • firstPages: take pages from the start
  • lastPages: take pages from the end

Selectors combine and duplicate pages are removed. Leave all three blank to use the entire document. A range beyond the end is clamped; an individual out-of-range page is ignored.

Read Text

readText returns both pages (one string per selected page) and text (the same strings joined in order). pagesRead reports the selected 1-based page numbers, while pageCount remains the source document's total.

{
  "id": "read_invoice",
  "type": "action",
  "name": "Read invoice summary",
  "action": "pdf.readText",
  "config": {
    "operation": "readText",
    "fileId": "{{steps.download_invoice.fileId}}",
    "pages": "1",
    "lastPages": 3
  }
}

Extract Pages

extractPages defaults to output: "file". It saves the result in workspace files and returns fileId, filePath, fileName, sizeBytes, pageCount, and source metadata. Set baseName, folderPath, or folderId to control the destination. When both folder fields are set, folderPath is created beneath folderId.

If the selection covers every page, an existing workspace source is reused only when no destination or filename override was supplied. URL and inline sources are still saved when file output is requested.

{
  "id": "trim_invoice",
  "type": "action",
  "name": "Keep invoice summary pages",
  "action": "pdf.extractPages",
  "config": {
    "operation": "extractPages",
    "fileId": "{{steps.download_invoice.fileId}}",
    "pages": "1",
    "lastPages": 3,
    "output": "file",
    "baseName": "invoice-{{input.invoiceId}}",
    "folderPath": "Invoices/Prepared"
  }
}

Set output: "content" only for a small direct handoff. Inline output is base64 and is retained in the run state, so its raw PDF size has an immutable 14 MiB ceiling even when maxSizeBytes is larger. Saved-file output avoids that retained payload.

Get Info

Use getInfo before conditional routing when you only need document facts:

{
  "id": "inspect_pdf",
  "type": "action",
  "name": "Inspect PDF",
  "action": "pdf.getInfo",
  "config": {
    "operation": "getInfo",
    "fileId": "{{steps.download_invoice.fileId}}"
  }
}

Frequently Asked Questions

On this page