PDF Tools
Page count and metadata, text extraction, merge, extract or split pages, rotate, text watermark and images to PDF, parsing in a killable, heap-capped worker, page caps, new output files only
Stable v0.1.0 Node.js 8 actions
About
A Graphrt plugin for local PDF files. Workflows and agents can read a PDF's page count, metadata and text, and build new PDFs by merging, extracting, splitting, rotating, watermarking, or from images. It uses pdf-lib for structure and Mozilla's pdfjs-dist (legacy build) for text. Every result is a new file in one output directory.
What it can do
- info: page count, encrypted, title, author, subject, keywords, creator, producer, creation and modification dates, and the size and rotation of up to 100 pages.
- extract_text: the text layer per page for pages (e.g. "1-3,5,8-"), capped by max_chars (default 100000) with a truncated flag. There is no OCR: scanned pages come back empty (use the ocr-tesseract plugin).
- merge: 2–50 PDFs in order.
- extract_pages: the selected pages, in the order given ("3,1-2"), into one PDF.
- split: one PDF per entry of ranges (["1-2", "3-"]), or every every pages (default one file per page), at most 200 files.
- rotate: 90, 180 or 270 degrees clockwise, added to each selected page's rotation.
- watermark: a Helvetica text line (Latin-1 characters) with font_size, opacity, angle, color and placement (center, top, bottom) on the selected pages.
- images_to_pdf: jpeg/png images, one per page, at their own size (fit) or scaled into A4/Letter with a margin.
Actions
Each action is a step you can add to a workflow. Agents can also use most of them as tools.
- Read PDF info
pdf-tools.info - Extract PDF text
pdf-tools.extract_text - Merge PDFs
pdf-tools.merge - Extract pages
pdf-tools.extract_pages - Split a PDF
pdf-tools.split - Rotate pages
pdf-tools.rotate - Add a text watermark
pdf-tools.watermark - Images to PDF
pdf-tools.images_to_pdf
Settings
Graphrt starts plugins with a clean environment. Only these values reach the plugin, and secrets stay out of logs.
-
PDF_TOOLS_INPUT_DIRS(required)Comma-separated directories (absolute or ~/...) that files may be read from, subdirectories included -
PDF_TOOLS_OUTPUT_DIR(none)Existing directory for outputs. Without it only info and extract_text work. Outputs can be read back as inputs. -
PDF_TOOLS_MAX_INPUT_BYTES100 MiBLargest input file -
PDF_TOOLS_MAX_OUTPUT_BYTES200 MiBLargest output, nothing is written above it -
PDF_TOOLS_MAX_PAGES2000Most pages per input, and per merged output -
PDF_TOOLS_TIMEOUT_MS120000Per call (1000 to 280000), the worker process is killed when it passes -
PDF_TOOLS_MAX_MEMORY_MB1024Memory budget of the worker process: heap cap and resident-memory (RSS) watchdog -
PDF_TOOLS_MAX_TOTAL_INPUT_BYTES200 MiBMost bytes read in one call across all inputs (merge, images_to_pdf)
How to use it
In Graphrt Desktop
- Open Plugins and search for PDF Tools.
- Click Install and approve it.
- Follow the setup steps on the plugin's page, then paste the settings it needs.
- Describe a job that needs it, and the builder adds the steps.
With the CLI
terminal
$ graphrt plugin install pdf-tools workflow.yaml
- id: pdf_tools type: pdf-tools.info