pdf

A PDF document, such as a form, a report or a scanned record. Its text is read from the page images, so a scan reads like any other PDF: read it by page and line, and look at a page as a picture when the layout matters.

At a glance

Writing

Written as

A JSON object.

Create options

Options for rendering markdown, HTML, SVG or plain text as a new PDF.

Reading

Querying

The text is indexed in passages, so the search operators find a PDF by what it says, scanned ones included once their text has been read, a little after the save (see the HQL reference). For a PDF, match.start and match.end count lines of the document's text from 0 (one less than the line in a page, line: label), not pages.

Form | pdf_copy ~~ "payment terms" | select id, match.text, match.start | limit 10
Message | ~* "invoice" | match.dtype = "pdf" | select id, match.field, match.text | limit 20

content.dtype asks whether a message carries a PDF at all, without searching:

Message | content.dtype = "pdf" | select id, created_at | limit 50

size.pages counts the PDF's pages. Like the text, it arrives after the save; while the PDF's own page count is not known yet, it counts up to the last page with text:

Form | pdf_copy.size.pages > 10 | order by pdf_copy.size.pages desc | select id, pdf_copy.size{pages,bytes}

Editing

In agent tools

Metadata

Derived values kept with a stored value:

Operations

Through the dtypes resource: