Codumentor logo Codumentor Enterprise

Working with PDFs

The assistant can open, read, and fill PDF files (.pdf) as part of a conversation. It can read the text layer, fill interactive form fields, flatten a filled form so it can no longer be edited, and render pages as images so it can actually look at the document — including scanned pages that have no text at all. Saved files show a download card in the conversation.

Opening a PDF

Ask the assistant to open a PDF from one of your repositories.

"Open repo/forms/tax-return.pdf and fill in the taxpayer details."

By default the assistant edits the file in place; ask it to save to a different path if you want to keep the original untouched.

"Copy contract.pdf to contract-signed.pdf and fill in the party names there."

Only one PDF is open at a time. If another one is already open, the assistant closes it first — but only when it has no unsaved changes there.

Reading a PDF

Once a PDF is open the assistant reads the text layer page by page. Pages whose extraction comes back empty are reported as probably scanned — the assistant then renders those pages as images and reads them visually instead. Scanned documents work this way without any OCR step; reading accuracy is the model's vision, so treat a rendered page as a picture, not as searchable text.

Filling forms

For a PDF with an interactive form (AcroForm), the assistant works through the fields in three steps: it lists the fields first, fills them with the exact names and allowed values the listing reports, and checks the result by rendering the pages before saving.

"Fill in the applicant's name and address in application.pdf, tick the consent box, and save it as application-filled.pdf."

The field listing reports each field's name, type (text, checkbox, radio group, dropdown, list, signature), current value, and what it accepts: a checkbox's on-state, a radio group's export values, a dropdown's or list's options, max lengths and read-only/required flags. The assistant never guesses what a field means from its name alone when rendering the page would show the label.

Filling is validated before anything is written: an unknown field name, a value that is not one of a dropdown's options, or an over-long text fails the whole call and nothing changes. Checkboxes take true/false; radio groups take one of their export values; multi-select lists take a list of options. Fields marked read-only are refused, and signature fields are reported but never filled.

The filled values stay in memory until the assistant saves. Every filling step reminds it that the document is unsaved, and closing with unsaved changes either saves first or throws the edits away — they are never dropped silently.

Flattening a form

Ask for a flattened copy when the recipient should see the filled values but not be able to edit the fields: the values are baked into the page content and the form fields are removed entirely.

"Flatten it so the fields can't be changed, and save as final.pdf."

A signed document is refused flattening — altering those bytes would break the signatures.

Signed documents

If a PDF carries a digital signature, the assistant saves it as an incremental update: the original bytes stay untouched as a prefix and the edits are appended, so the existing signatures remain valid. The save result says this. Note that after a structural edit (rotating or deleting pages, metadata, annotations) the signatures will still verify but will report the document as changed — the save tells the assistant when that applies.

XFA forms

Two form technologies exist under the ".pdf form" umbrella. Plain AcroForm fields are fully supported. XFA forms are detected and handled honestly:

Looking at pages

The assistant can render any PDF's pages as images — the open document with its unsaved edits included, or any PDF in a repository without opening it at all (the way to read a scanned letter). A render shows at most 6 pages per call, defaulting to the first three.

"Show me pages 4-5 of the contract so I can check the signature block."

Rendering is done by an optional helper program on the server (poppler's pdftoppm by default, else MuPDF's mutool, else LibreOffice), so fonts and fidelity can differ slightly from a desktop viewer. If no rasteriser is installed, everything else still works — only the images are missing, and the assistant says what the administrator can install.

Advanced edits

For things the dedicated tools don't cover — rotating or deleting pages, setting metadata, adding bookmarks or a simple text annotation, inspecting a field's raw dictionary — the assistant can fall back to a small sandboxed script run directly against the open PDF (pdf_python, the same escape hatch the other editors have). Common recipes: pages[0].rotate(90), writer.remove_page(1), writer.add_metadata({'/Title': ...}), writer.add_outline_item('Section', 0), or an annotation via from pypdf.annotations import FreeText.

It is not a text editor: changing existing page text means rewriting PDF content streams, which the library does not support. The assistant checks every structural change by rendering the pages afterwards. As a safety measure, a save is refused if the script added content a viewer would execute (JavaScript or launch actions); other additions such as web links are listed in the save result.

Saving and downloading

Nothing is written to disk until the assistant saves. When it does, a PDF saved card appears in the conversation with the file name, size, page count, and a download link. Saving without edits writes the original bytes; the write is atomic, so a failed save never damages the existing file.

Limits you should know about

This feature may not be available in all setups. If the assistant can't open or edit a PDF for you, it may not be enabled by the administrator.

Like other actions the assistant takes, PDF edits show up as transparent tool calls in the transcript — see What the Assistant Can Do.