pdfops-mcp
v0.7.2PDF tools for AI agents: fill, merge, edit, read text and tables, create, protect and invoice PDFs.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
pdf_inspect Inspect PDF form fields
List the form fields (AcroForm) of a PDF: names, types, options, current values and per-field maxLength where declared, plus a fillTemplate object ready to pass to pdf_fill and a hasXFA flag (hybrid AcroForm/XFA inputs lose their XFA layer when filled). A PDF with no fillable form returns count 0. Read-only: the PDF is fetched or read but never modified. pdf_fill rejects unknown field names and over-length values; this tool lists the names and the maxLength values it checks against.
| Parameter | Type | Description |
|---|---|---|
pdf_path * | string | PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when t… |
password | string | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). |
pdf_fill Fill PDF form
Fill form fields (AcroForm) in a PDF and save or return the filled PDF. Field names must exist in the PDF (pdf_inspect lists them). All values are strings; checkboxes take "true"/"false"; dropdown/radio/optionlist values must be one of the field's options; text values must respect the field's maxLength from pdf_inspect. The source PDF is never modified. Returns the filled PDF written to output_path, or inline as an application/pdf resource when output_path is omitted; an existing file at output_path is overwritten. Owner-locked PDFs (empty user password, common for government blanks) fill with…
| Parameter | Type | Description |
|---|---|---|
fields * | object | Field name → string value (from pdf_inspect's fillTemplate) |
pdf_path * | string | Template PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI wor… |
flatten | boolean | Bake values into page content and drop the AcroForm so fields are no longer editable |
output_path | string | Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without it (as when running remotely) th… |
password | string | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). |
pdf_merge Merge PDFs
Merge two or more PDFs into one, in the order given, and save or return the result. Source files are read only and never modified; an existing file at output_path is overwritten. Returns the merged PDF written to output_path, or inline as an application/pdf resource when output_path is omitted. This tool only concatenates whole documents: it does not reorder, rotate or delete pages within them (pdf_extract_pages, pdf_rotate and pdf_delete_pages do), does not fill forms (pdf_fill does) and does not build documents from data (pdf_invoice does). An unreadable or rejected input fails with an error…
| Parameter | Type | Description |
|---|---|---|
pdf_paths * | array | In order, each a PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data… |
output_path | string | Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without it (as when running remotely) th… |
password | string | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). Applies to every input. |
pdf_invoice Generate invoice PDF
Generate an invoice PDF from structured data (seller, buyer, line items, tax); no template needed. Deterministic: the same input produces byte-identical output. Without a paid PDFops key the output carries a small "Generated with pdfops.dev" footer line. Returns the invoice written to output_path, or inline as an application/pdf resource when output_path is omitted; an existing file at output_path is overwritten. An existing invoice PDF or a fillable template is populated with pdf_fill instead. Setting invoice.e_invoice to "factur-x" produces an e-invoice instead: a PDF/A-3 file with the invoi…
| Parameter | Type | Description |
|---|---|---|
invoice * | object | Invoice data |
output_path | string | Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without it (as when running remotely) th… |
pdfops_usage Check PDFops quota
Check the current PDFops API quota for the configured key: tier, limit, used, remaining, the billing period, and the reset timestamp. Read-only and safe to call before a batch to confirm there is headroom. Requires PDFOPS_API_KEY.
pdf_extract_pages Extract pages from PDF
Extract pages from a PDF: keep only the listed pages, in the order given, and return them as a new PDF. Because order follows the spec, it also reorders pages ("3,1,2") and can duplicate them. It pulls a section out of a document; pdf_delete_pages removes pages instead, pdf_split makes several output files and pdf_merge joins documents. Returns the result written to output_path, or inline as an application/pdf resource when output_path is omitted (results over 7 MB are never returned inline and need output_path); an existing file at output_path is overwritten. The source is never modified. Fai…
| Parameter | Type | Description |
|---|---|---|
pages * | string | 1-based page spec, e.g. "1-3,5,8-" (open-ended range runs to the last page) |
pdf_path * | string | PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when t… |
output_path | string | Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without it (as when running remotely) th… |
password | string | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). |
pdf_delete_pages Delete pages from PDF
Delete pages from a PDF: remove the listed pages and return the remaining pages in their original order, for example to drop a cover, blank or sensitive pages. pdf_extract_pages takes the opposite approach and names the pages to keep. Returns the result written to output_path, or inline as an application/pdf resource when output_path is omitted (results over 7 MB are never returned inline and need output_path); an existing file at output_path is overwritten. The source is never modified. Deleting every page fails with no_pages_left.
| Parameter | Type | Description |
|---|---|---|
pages * | string | 1-based pages to REMOVE, e.g. "2,4-6,9-" |
pdf_path * | string | PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when t… |
output_path | string | Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without it (as when running remotely) th… |
password | string | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). |
pdf_rotate Rotate PDF pages
Rotate pages of a PDF clockwise by 90, 180 or 270 degrees (or -90). Rotation adds to each page's existing rotation. Omit pages to rotate every page. It fixes sideways scans. Returns the result written to output_path, or inline as an application/pdf resource when output_path is omitted (results over 7 MB are never returned inline and need output_path); an existing file at output_path is overwritten. The source is never modified.
| Parameter | Type | Description |
|---|---|---|
degrees * | Clockwise rotation to add | |
pdf_path * | string | PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when t… |
output_path | string | Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without it (as when running remotely) th… |
pages | string | 1-based page spec such as "1-3,5"; default all pages |
password | string | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). |
pdf_split Split PDF into parts
Split one PDF into several PDFs, either by explicit ranges (each comma group becomes one part: "1-2,3-5" gives two parts) or into fixed-size chunks (every=2 on 5 pages gives 1-2, 3-4, 5). Give exactly one of ranges or every. With output_dir the parts are written there as part-1.pdf, part-2.pdf, …; otherwise each part comes back inline as an application/pdf resource. Either way the result also includes a structured parts list (pages, page_count, bytes, and output_path or resource_uri). Existing part-N.pdf files with those names are overwritten, and part-N.pdf files from earlier runs in that d…
| Parameter | Type | Description |
|---|---|---|
pdf_path * | string | PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when t… |
every | integer | Chunk size in pages; the last part may be shorter |
output_dir | string | Path of an existing directory inside the allowed directories (PDFOPS_ROOT, default the working directory) to write part-1.pdf, part-2.pdf, … into. Without it (as when running remotely) the parts are… |
password | string | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). |
ranges | string | 1-based page spec; each comma group becomes one part, e.g. "1-2,3-5" |
pdf_watermark Add text watermark to PDF
Add a diagonal text watermark to pages of a PDF (default: centered, 45 degrees, grey, 15% opacity). Text is upright and centered for any page size or existing page rotation. Standard Helvetica only: characters outside WinAnsi (e.g. CJK, emoji) fail with unsupported_characters. Typical text is DRAFT or CONFIDENTIAL; pdf_page_numbers adds page numbers instead. Returns the result written to output_path, or inline as an application/pdf resource when output_path is omitted (results over 7 MB are never returned inline and need output_path); an existing file at output_path is overwritten. The source…
| Parameter | Type | Description |
|---|---|---|
pdf_path * | string | PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when t… |
text * | string | Watermark text, WinAnsi characters only |
color | string | Hex #rgb or #rrggbb, default #808080 |
opacity | number | Default 0.15 |
output_path | string | Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without it (as when running remotely) th… |
pages | string | 1-based page spec such as "1-3,5"; default all pages |
password | string | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). |
position | string | Default center |
rotation | number | Degrees counter-clockwise as the viewer sees it, default 45 |
size | number | Font size in points, default 48 |
pdf_page_numbers Add page numbers to PDF
Add page numbers to a PDF using a format template with {n} (page number) and {total} (page count), e.g. "Page {n} of {total}". Default is "{n} / {total}" at bottom-center, 10 pt. Numbers sit upright for any page size or rotation. Standard Helvetica only (WinAnsi characters). Page i always shows start+i-1 even when pages selects only some pages. Returns the result written to output_path, or inline as an application/pdf resource when output_path is omitted (results over 7 MB are never returned inline and need output_path); an existing file at output_path is overwritten. The source is never modif…
| Parameter | Type | Description |
|---|---|---|
pdf_path * | string | PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when t… |
format | string | Template with {n} and {total}, default "{n} / {total}" |
margin | number | Distance in points from the page edge, default 24 |
output_path | string | Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without it (as when running remotely) th… |
pages | string | 1-based page spec such as "1-3,5"; default all pages |
password | string | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). |
position | string | Default bottom-center |
size | number | Font size in points, default 10 |
start | integer | Number shown on page 1, default 1 |
pdf_unlock Remove PDF restrictions
Remove a PDF's password protection and its print/copy/modify restrictions by saving an unencrypted copy. Works for owner-locked files (empty user password) with no password, and for user-password files when you pass the password. It does NOT crack unknown passwords: a wrong or missing user password fails with encrypted_pdf. A PDF that was not encrypted is returned re-saved, with note "not-encrypted". Returns the result written to output_path, or inline as an application/pdf resource when output_path is omitted (results over 7 MB are never returned inline and need output_path); an existing file…
| Parameter | Type | Description |
|---|---|---|
pdf_path * | string | PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when t… |
output_path | string | Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without it (as when running remotely) th… |
password | string | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). |
pdf_protect Password-protect PDF
Encrypt a PDF with a password. user_password is required to open the result; owner_password lifts the permission restrictions. Give at least one (each 1 to 32 Latin-1 chars). permissions lists what stays ALLOWED from print, copy, modify, annotate, fill-forms (default all, except modify when an owner password is set; an empty list allows none). Restrictions only bind viewers when an owner password is set. Not byte-deterministic (random salts). Returns the result written to output_path, or inline as an application/pdf resource when output_path is omitted (results over 7 MB are never returned inl…
| Parameter | Type | Description |
|---|---|---|
pdf_path * | string | PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when t… |
output_path | string | Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without it (as when running remotely) th… |
owner_password | string | Password that lifts the restrictions |
password | string | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). |
permissions | array | Actions to ALLOW; omit for the default, [] for none |
user_password | string | Password required to open the output |
pdf_metadata Read PDF metadata
Read a PDF's document info: page_count, per-page width/height (points) and rotation, title, author, subject, keywords, creator, producer, creation_date, modification_date (ISO 8601, null when absent), whether it was encrypted, and has_form / form_field_count. The page count and per-page sizes describe a document's shape for splitting, rotating or filling. Read-only: the PDF is fetched or read but never modified.
| Parameter | Type | Description |
|---|---|---|
pdf_path * | string | PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when t… |
password | string | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). |
pdf_set_metadata Set PDF metadata
Write document info fields (title, author, subject, creator, keywords) into a PDF. Give at least one; an empty string sets an empty value. Unicode is fine. Keywords may be a list or a comma-separated string. The output is saved unencrypted. pdf_metadata reads the current values. Returns the result written to output_path, or inline as an application/pdf resource when output_path is omitted (results over 7 MB are never returned inline and need output_path); an existing file at output_path is overwritten. The source is never modified.
| Parameter | Type | Description |
|---|---|---|
pdf_path * | string | PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when t… |
author | string | |
creator | string | |
keywords | Comma-separated string or list of keywords | |
output_path | string | Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without it (as when running remotely) th… |
password | string | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). |
subject | string | |
title | string |
pdf_edit Add text, images or barcodes to a PDF
Add text, images (logos, signature images, photos) and barcodes or QR codes to specific pages of an existing PDF at exact positions. Coordinates are PDF points measured from the bottom-left corner of the page as the viewer sees it (1 inch = 72 pt; US Letter is 612 x 792), so stamps land upright on any page size or rotation. Text uses standard fonts (WinAnsi characters only: CJK and emoji fail with unsupported_characters) and can wrap to max_width. Images are PNG or JPEG, up to 2 MB each and 10 distinct images per call (the PDF and all images together must stay under 4.5 MB), given as a local p…
| Parameter | Type | Description |
|---|---|---|
items * | array | Stamps to draw, in order (later items draw on top). |
pdf_path * | string | PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when t… |
output_path | string | Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without it (as when running remotely) th… |
password | string | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). |
pdf_extract_text Extract text and tables from a PDF
Extract text and tables from a born-digital PDF (one made by software: invoices, statements, reports, contracts, forms), page by page, in reading order, plus any tables found from the text layout as rows of cells. Scanned PDFs (images of pages) have no text layer and come back listed in pages_without_text: OCR is not supported. Set include_lines to also get each line with its position in PDF points from the bottom-left of the page as the viewer sees it, the same frame pdf_edit uses, so you can stamp text next to something you found. Up to 200 pages per call; pass pages to read a large document…
| Parameter | Type | Description |
|---|---|---|
pdf_path * | string | PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when t… |
include_lines | boolean | Also return every line of text with x, y, width and font size in points. Default false (smaller output). |
output_path | string | Only with tables_format xlsx: path of a .xlsx file to write the workbook to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without… |
pages | string | Pages to read, 1-based: "1-3,5,8-". Default: all pages. |
password | string | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). |
tables_format | string | csv adds a csv string (RFC 4180, CRLF line ends) to each table next to rows. xlsx instead returns one Excel workbook, one sheet per table ("Page 3 Table 1"), with a short summary (no text, lines or ro… |
pdf_text_to_pdf Create a PDF from Markdown, plain text or CSV
Create a new PDF from Markdown, plain text or a CSV table, with no template and no input PDF. This is NOT HTML-to-PDF: it does not render HTML or CSS, and it has no custom fonts or images (images in Markdown stay literal text). Text is set in the standard Helvetica family, code and monospace text in Courier, on Letter or A4 pages. Markdown supports headings 1-6, bold, italic, inline code, links (printed as text plus the URL; http(s) and mailto links are also clickable), fenced code blocks, bullet and numbered lists, one-level blockquotes, horizontal rules, pipe tables (header shaded and repeat…
| Parameter | Type | Description |
|---|---|---|
content * | string | The document: Markdown (default), plain text or CSV, up to 512 KiB of UTF-8. |
font_size | number | Body text size in points, 6-36. Default 11. |
format | string | How to read content. Default markdown. |
margin | number | Page margin in points, 18-144. Default 54. |
monospace | boolean | Set the text in Courier. Only used with format text. Default false. |
output_path | string | Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without it (as when running remotely) th… |
page_numbers | boolean | Print "Page n of N" at the bottom of every page. Default false. |
page_size | string | Default letter. |
title | string | PDF Title metadata (not printed on the page), up to 200 characters. |
pdf_find_text Find text in a PDF
Find text in a PDF: search a born-digital PDF (one made by software: invoices, statements, reports, contracts, forms) for a word, phrase or pattern and get each hit with its page and box in PDF points from the bottom-left of the page as the viewer sees it, y on the text baseline: the same frame pdf_edit uses, so a hit's x, y, width and height tell you where to stamp. Case-insensitive unless case_sensitive is true. Set regex to treat query as a regular expression from a safe subset (literals, classes, dot, anchors, word boundaries, groups, alternation, quantifiers including lazy ones); backrefe…
| Parameter | Type | Description |
|---|---|---|
pdf_path * | string | PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when t… |
query * | string | Text to find, or a pattern when regex is true. At most 200 characters. |
case_sensitive | boolean | Default false: matching ignores case. |
max_hits | integer | Stop once more hits than this exist. Default 100. If truncated is true but next_page is null, hits on a page listed in pages_skipped beyond max_hits can be retrieved only by raising max_hits or narrow… |
pages | string | Pages to search, 1-based: "1-3,5,8-". Default: all pages. At most 200 pages per call. While next_page in the result is not null, calling again with pages set to next_page followed by a dash (for examp… |
password | string | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). |
regex | boolean | Treat query as a regular expression (the supported subset). Default false. |
whole_word | boolean | Only report matches with no letter, digit, underscore or combining mark directly before or after. Default false. |
pdf_detect_fields Detect fillable fields in a flat PDF
Detect fillable form fields in a flat PDF (one with no form fields; pdf_inspect lists none): finds blanks drawn on the page as lines, boxes, underscores and checkboxes and returns a text or checkbox field for each, named from the nearest printed label, with a confidence from 0 to 1. Each entry has type, name, page, x, y, width, height in PDF points from the bottom-left of the page as the viewer sees it, the frame pdf_add_fields and pdf_edit use. The entries can be reviewed (wrong ones dropped, others renamed or adjusted) and passed to pdf_add_fields as fields (label and confidence are ignored…
| Parameter | Type | Description |
|---|---|---|
pdf_path * | string | PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when t… |
max_pages | integer | Analyse at most this many pages. Default 40. At most 100. |
min_confidence | number | Drop fields below this confidence. Default 0.4 (drops only the weakest candidates, such as unlabelled shapes); 0.6 gives slightly higher precision and about a quarter fewer checkboxes. |
pages | string | Pages to analyse, 1-based: "1-3,5,8-". Default: all pages (up to max_pages). Large forms: a call stops at its time and work limit, so while truncated is true the returned fields can be added with pdf_… |
password | string | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). |
pdf_add_fields Add fillable form fields to a PDF
Add fillable form fields (AcroForm) to an existing PDF at exact positions, or (detect true) find them on a flat PDF automatically: text, multiline text, checkbox, radio group, dropdown and signature box. Coordinates are PDF points measured from the bottom-left corner of the page as the viewer sees it (1 inch = 72 pt; US Letter is 612 x 792), the same frame and 1-based page numbers as pdf_edit; x and y are the field's bottom-left corner and the whole rectangle must lie inside the page (each side at least 4 pt). Every entry needs type, name and page; every type except radio also needs x, y, widt…
| Parameter | Type | Description |
|---|---|---|
pdf_path * | string | PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when t… |
detect | boolean | Instead of fields: detect the blanks drawn on a flat PDF (lines, boxes, underscores, checkboxes) and add a text or checkbox field for each, in one request. The answer reports how many fields were adde… |
fields | array | Fields to create. Required unless detect is true. Nothing is added unless every entry is valid. Required keys: every entry type, name, page; text, checkbox, dropdown and signature also x, y, width, he… |
max_pages | integer | With detect: analyse at most this many pages. Default 40. |
min_confidence | number | With detect: drop fields below this confidence. Default 0.4. |
output_path | string | Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without it (as when running remotely) th… |
pages | string | With detect: pages to analyse, "1-3,5,8-". Default all. |
password | string | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). |
pdf_image_to_pdf Make a PDF from JPG and PNG images
Make a PDF from JPG and PNG images: one image per page, in the order given. Each image is a local path (.png, .jpg, .jpeg), an https:// URL or a data:image/jpeg;base64,… or data:image/png;base64,… URI; the type is detected from the bytes, not the name. At most 100 images, each up to 4 MB, 4.5 MB in total. page_size "fit" (default) makes each page the image's own size at 72 dpi (1 px = 1 pt; pages longer than 5,000 pt on a side are scaled down, tiny images are enlarged to a 3 pt minimum); "a4" or "letter" put the image on a standard page, centred, shrunk to fit inside the margin and never e…
| Parameter | Type | Description |
|---|---|---|
image_paths * | array | In order, one page each: a local path (.png, .jpg, .jpeg) inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:image/jpeg;base64,… / data:image/png… |
margin | number | Points, 0-200. Default 0 for fit, 36 for a4 and letter. |
orientation | string | a4 and letter only; auto (default) picks portrait or landscape per image. |
output_path | string | Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without it (as when running remotely) th… |
page_size | string | fit (default): page = image size. a4 or letter: standard page, image centred and shrunk to fit. |
pdf_add_attachment Embed files in a PDF
Embed one or more files (for example an XML or CSV data file) in a PDF as attachments. Each entry in files has a source (a local path, an https:// URL or a data: URI with base64) and optional name, mime_type, description (at most 1,000 characters) and relationship (Alternative, Data, Source, Supplement or Unspecified, default Unspecified; the PDF/A-3 AFRelationship value). A local path must end in .xml, .csv, .json, .txt, .md, .html, .xlsx, .pdf, .png, .jpg or .jpeg and lie inside the allowed directories (PDFOPS_ROOT, default the working directory). name is 1-255 characters and at most 255 UTF…
| Parameter | Type | Description |
|---|---|---|
files * | array | Files to embed. Nothing is added unless every entry is valid. |
pdf_path * | string | PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when t… |
output_path | string | Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without it (as when running remotely) th… |
password | string | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). |
pdf_html_to_pdf Create a PDF from HTML
Render an HTML string to a PDF with a headless browser, so layout, CSS (flexbox, grid, print styles), images and web fonts come out as in a browser print. It takes HTML text only: there is no URL input, and JavaScript is switched off, so scripts do not run and pages that build themselves with JavaScript render empty. External resources (images, stylesheets, fonts) load only over https from public hosts; anything else (http, file, private or internal addresses, redirects to them) is blocked and skipped, and the PDF is still made. Data URIs work and are the safest way to include images. Letter o…
| Parameter | Type | Description |
|---|---|---|
html * | string | The document as HTML text, up to 1 MB of UTF-8. A full document or a fragment. Frames, iframes, objects, embeds, audio and video are not rendered, and an inline or fetched image is decoded and checked… |
landscape | boolean | Landscape orientation. Default false. |
margin | number | Margin on every side in points, 0-144. Default 36. |
output_path | string | Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Without it (as when running remotely) th… |
page_size | string | Default letter. |
print_background | boolean | Print background colors and images. Default true. |
scale | number | Page content scale, 0.1-2. Default 1. |