Documents Contract

link-documents-contract is what Link documents, lnk-link-documents, answers: the text of a PDF or a Word document, for Link Memory to read (Read PDFs and Word documents).

Its caller runs it as a child, the document on its stdin, and reads one Extracted on its stdout, as JSON: {"text": "..."}, the document's text, or {"unread": "..."}, why it has none. Any other key is refused.

Its formats

Format::Pdf is named pdf and Format::Word docx, on the command line and as the extension a document's name is known by, in any case (Taxes 2025.PDF). A name with any other extension, .doc among them, is read as text.

Its limits

DOCUMENT_MAX is the largest document read, 32 MiB, a long report, scanned pages aside. TEXT_MAX is the most text kept of one, 2 MiB: the rest isn't indexed.

The plugin

PLUGIN is the plugin's name, link-documents, whose program is lnk-link-documents.