Document to PDF
Renders a Word document, an e-mail, an HTML, Markdown or text file, or an image as a PDF.#
/lmkit/v1/document-to-pdfGives a document without pages of its own a PDF the page tools can act on (pdf-redact, pdf-search, pdf-layout). A Word document (.docx) and the text formats are rendered through their Markdown reading; an e-mail (.eml, Outlook .msg) is rendered with its headers and body, its attachments embedded in the PDF as files; an image becomes one page per frame; a PDF passes through unchanged. 'source_format' names the input; omitted, it is read from the content and the stored file name. The PDF is stored on the server and its 'file_id' returned. Involves no AI model. Returns 400 with error 'unsupported_format' for any other input. If processing exceeds the configured timeout, returns 202 Accepted with a job_id. Poll GET /lmkit/v1/jobs/ for status and results.
Request body
application/json ·
| Property | Type | Description |
|---|---|---|
inputrequired | string | The input document. When input_format is 'Base64EncodedFile', provide a base64-encoded payload. When 'FileIdentifier', provide the file ID previously returned by the lmkit/v1/files/upload endpoint. |
input_format | How the input is provided: 'Base64EncodedFile' or 'FileIdentifier'. Defaults to 'Base64EncodedFile'. | |
source_format | string | What the input is: 'docx', 'eml', 'msg', 'html', 'md', 'txt', 'pdf' or 'image'. Omit to read it from the content (a PDF, a ZIP package holding a Word document, an Outlook message, an image) and the stored file name. |
strip_quotes | boolean | For an e-mail: drops the quoted earlier messages of a reply. Default: false. |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | OK | |
| 202 | Accepted | |
| 400 | Bad Request | |
| 404 | Not Found | |
| 500 | application/json | Internal Server Error |
curl -X POST "$LMKIT_ONE_URL/lmkit/v1/document-to-pdf" \
-H "Authorization: Bearer $LMKIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "",
"input_format": "Base64EncodedFile",
"source_format": "string",
"strip_quotes": false
}'