Pular para o conteúdo principal

PDF Toolkit

The PDF toolkit gives agents PDF-specific tools: extract text, turn a page into an image, and generate PDFs from plain text or from an image. No connection or API key is required.

Add it on the agent Toolkits tab, then reference the tools with @ in the personality prompt when the agent should work with PDFs.

Prerequisites​

  • An agent you can edit
  • For extraction or page conversion: a PDF from a chat upload, a Knowledge Base file, a public HTTPS URL, or a base64 PDF data URL
  • For image-to-PDF: an image as a base64 data URL or HTTPS URL (JPEG, PNG, GIF, or WebP)

Available tools​

ToolDescription
Extract TextExtracts text from every page of a PDF and returns the combined text with page and character counts.
Convert to ImageConverts one PDF page to a PNG image. Set the page number (1-based) and optional DPI (default 200).
Text to PDFBuilds a PDF from plain text with wrapping and pagination. Optional filename (default output.pdf).
Image to PDFEmbeds an image into a single-page PDF sized to the image. Optional filename (default output.pdf).

How PDF inputs are resolved​

For Extract Text and Convert to Image, the agent can pass:

  • A chat attachment filename from the current conversation
  • A Knowledge Base file name or path in the current project
  • An https:// URL to a PDF
  • A base64 data URL (data:application/pdf;base64,…)

If several chat or KB files share the same name, ask for the exact filename or full KB path.

Image to PDF accepts base64 or HTTPS image URLs only (not chat/KB filename resolution).

Use cases​

  • Pull clauses or tables of contents out of uploaded policy PDFs during a conversation
  • Convert a cover page or diagram page to an image for review or further analysis
  • Generate a short PDF summary or receipt from text the agent produced
  • Wrap a generated chart or screenshot into a one-page PDF for download

Tips​

  • Prefer Extract Text for searchable/text PDFs. Scanned image-only PDFs may return little or no text — use Knowledge Base ingest or OCR elsewhere for those.
  • Convert to Image handles one page per call. Repeat with the next page number for multi-page output.
  • Generated PDFs and images are returned as data for the conversation — they are not automatically saved as Knowledge Base documents. Use Document Manager or File Helpers when you need a stored file workflow.
  • For general file read/save (DOCX, XLSX, CSV, re-encoding), use File Helpers instead.

Troubleshooting​

SymptomWhat to check
Empty or sparse extracted textThe PDF may be scanned/image-only; try a text-based PDF or KB ingest with OCR
Ambiguous file nameMultiple chat or KB matches — use the exact name or full path
Convert to Image failsConfirm page number is within the PDF; try a lower DPI if the page is very large
Image to PDF rejects the fileUse a base64 data URL or HTTPS image URL (not a chat/KB filename alone)
Confused with Document ManagerDocument Manager creates/edits in-chat markdown documents; PDF toolkit works on PDF files