Dev.to WebDev 🛠 Dev 👁 0 📖 7 min read

PDFops v0.12: HTML to PDF, text and tables out of PDFs, stamps and e-invoices

v0.11 was the page-operations release. v0.12 is about what is inside a PDF and where one comes from. You can now turn an HTML string into a PDF, pull text and tables out of a PDF as JSON, CSV or an Excel workbook, find a

v0.11 was the page-operations release. v0.12 is about what is inside a PDF and where one comes from. You can now turn an HTML string into a PDF, pull text and tables out of a PDF as JSON, CSV or an Excel workbook, find a phrase and stamp next to it, add fillable fields to a flat file, attach files, build a PDF from images, Markdown or CSV, and write an invoice that carries its own machine-readable data. The TypeScript SDK, the Python client, the MCP server and the n8n node on npm all cover it.

Every sample below runs as written, with no signup: the keyless trial allows 100 calls per IP a month. To count calls against a key instead, add -H "X-API-Key: $PDFOPS_API_KEY" to any of them. They build on each other, so run them in order in one folder.

HTML to PDF

POST /api/html-to-pdf takes an HTML string and returns a PDF. A headless browser on our side lays it out, so CSS, images and web fonts come out as they do in a browser print, on A4 or Letter pages.

curl -X POST https://pdfops.dev/api/html-to-pdf \
  -H "Content-Type: application/json" \
  -d '{"html": "<!doctype html><style>body{font-family:Arial,sans-serif;margin:0}h1{color:green}table{width:100%;border-collapse:collapse}td,th{border-bottom:1px solid gray;padding:6px;text-align:left}</style><h1>Invoice 1042</h1><table><tr><th>Item</th><th>Qty</th><th>Amount</th></tr><tr><td>Widget</td><td>2</td><td>USD 40.00</td></tr><tr><td>Gadget</td><td>1</td><td>USD 15.50</td></tr><tr><td>Total</td><td></td><td>USD 55.50</td></tr></table><p>Thank you.</p>", "page_size": "a4"}' \
  -o invoice.pdf

The limits are part of the feature. It takes HTML text only: no URL input, and JavaScript is switched off, so a page that builds itself in the browser renders empty. External resources load over https from public hosts only, and the document can run to 50 pages. It costs 5 requests of quota per call, not 1, and once the renderer is reached a failed render counts too. Unlike every other endpoint, its output is not byte-identical between runs, because a browser wrote it.

Text out of PDFs

POST /api/extract-text reads a born-digital PDF, one made by software such as an invoice system or a bank, and returns each page's text in reading order, every line with its position, and any tables as rows of cells. tables_format asks for the tables as CSV text, or as one Excel workbook with a sheet per table. Here is the invoice from above as CSV, then as a workbook:

curl -X POST https://pdfops.dev/api/extract-text \
  -F "[email protected]" \
  -F "tables_format=csv" \
  | jq -r '.pages[].tables[].csv' > tables.csv

curl -X POST https://pdfops.dev/api/extract-text \
  -F "[email protected]" \
  -F "tables_format=xlsx" \
  -o tables.xlsx

Tables are found from where the text sits, so borderless ones work. A cell whose text wraps comes back as an extra row, and two tables side by side come back as one. There is no OCR: a scanned page is listed in pagesWithoutText. In the workbook every cell is text, so a value that starts with = is never a formula.

POST /api/find-text searches the same text layer for a literal or a regular expression and returns each hit with its page and box, in the coordinates edit uses. So a hit feeds the next call directly.

Building and marking up PDFs

POST /api/edit draws text, PNG or JPEG images and barcodes at exact positions on the pages you name. Barcodes, QR codes included, are drawn as vector shapes, so they scan at any size. This finds a total, writes a note beside it and puts a QR code in the corner:

HIT=$(curl -s -X POST https://pdfops.dev/api/find-text \
  -F "[email protected]" -F "query=USD 55.50" | jq -c '.hits[0]')

ITEMS=$(echo "$HIT" | jq -c '[
  {type:"text", page:.page, x:(.x + .width + 8), y:.y, size:.height, text:"paid"},
  {type:"barcode", page:1, x:480, y:40, format:"qrcode", value:"https://example.com/invoice/1042", width:72}
]')

curl -X POST https://pdfops.dev/api/edit \
  -F "[email protected]" \
  -F "items=$ITEMS" \
  -o stamped.pdf

POST /api/add-fields creates fillable fields in a flat PDF: text, multiline text, checkboxes, radio groups, dropdowns and empty signature boxes, each at a page and a rectangle. It signs nothing. Fill the result with fill-form:

curl -X POST https://pdfops.dev/api/add-fields \
  -F "[email protected]" \
  -F 'fields=[{"type":"text","name":"approved_by","page":1,"x":72,"y":80,"width":200,"height":20},{"type":"checkbox","name":"paid_in_full","page":1,"x":72,"y":110,"width":14,"height":14}]' \
  -o fillable.pdf

curl -X POST https://pdfops.dev/api/fill-form \
  -F "[email protected]" \
  -F 'fields={"approved_by":"Jordan Lee","paid_in_full":"true"}' \
  -o approved.pdf

Three smaller ones, each one call:

curl -X POST https://pdfops.dev/api/attach \
  -F "[email protected]" \
  -F "[email protected];type=text/csv" \
  -F 'options=[{"name":"tables.csv","description":"Invoice lines","relationship":"Data"}]' \
  -o with-data.pdf

curl -X POST https://pdfops.dev/api/image-to-pdf \
  -F "[email protected]" \
  -F "[email protected]" \
  -F "page_size=a4" \
  -o photos.pdf

curl -X POST https://pdfops.dev/api/text-to-pdf \
  -H "Content-Type: application/json" \
  -d '{"content": "# Release notes\n\nVersion **0.12** is out.\n\n- HTML to PDF\n- Text and tables out of PDFs", "title": "Release notes", "page_numbers": true}' \
  -o notes.pdf

Factur-X e-invoices

POST /api/invoice takes "e_invoice": "factur-x" and returns a PDF/A-3 file with the invoice data embedded as factur-x.xml, in the EN 16931 profile of Factur-X, also called ZUGFeRD. The page and the XML are computed by the same code with exact decimal arithmetic, so they cannot disagree. The mode needs more fields than a plain invoice, such as a currency, structured addresses, a seller VAT id and a unit code on every item; a request that misses any gets a 400 that lists every missing field.

curl -X POST https://pdfops.dev/api/invoice \
  -H "Content-Type: application/json" \
  -d '{
    "e_invoice": "factur-x",
    "invoice_number": "INV-0042",
    "date": "2026-11-22",
    "due": "2026-12-22",
    "currency": "EUR",
    "from": {"name": "Acme GmbH", "street": "Hauptstrasse 1", "postcode": "10115", "city": "Berlin", "country": "DE", "vat_id": "DE123456789"},
    "to": {"name": "Globex SARL", "street": "1 rue de la Paix", "postcode": "75002", "city": "Paris", "country": "FR"},
    "tax_rate": 19,
    "items": [
      {"description": "Consulting", "quantity": 10, "unit_price": 120, "unit": "HUR"},
      {"description": "Setup fee", "quantity": 1, "unit_price": 250, "unit": "C62"}
    ]
  }' \
  -o einvoice.pdf

qpdf --list-attachments einvoice.pdf

The exact limits of the claim: the output of every variant in our test suite is checked with the Mustang validator 2.26.0 (PDF/A-3 through veraPDF, the Factur-X schema and the EN 16931 schematron), and a file counts only when both halves pass. That is a statement about the tests we ran. It is not a certification and not advice on what a tax authority or a buyer's system accepts in your country. We do not produce XRechnung, Peppol or UBL, any other Factur-X profile, credit notes, discounts or charges, and an invoice carries one VAT category and rate. A Factur-X call costs 1 request.

The same operations in every client

The point of a small API is that each wrapper can carry all of it. Published on 22 November 2026, each of these covers everything above:

from pdfops import PdfOps

client = PdfOps()  # reads PDFOPS_API_KEY from the environment

page = client.html_to_pdf("<h1>Invoice 1042</h1><p>Total USD 55.50</p>", page_size="a4")
open("from-html.pdf", "wb").write(page.pdf)

result = client.extract_text("invoice.pdf", tables_format="csv")
for table in result["pages"][0]["tables"]:
    print(table["csv"])

hit = client.find_text("invoice.pdf", "USD 55.50")["hits"][0]
print(hit["page"], hit["x"], hit["y"])

Fixed and hardened

Also since v0.11

Try it

Turn Markdown into a PDF, with no signup. The keyless trial allows 100 calls per IP a month:

curl -X POST https://pdfops.dev/api/text-to-pdf \
  -H "Content-Type: application/json" \
  -d '{"content": "# Hello\n\nA PDF from one call.", "page_numbers": true}' \
  -o hello.pdf

A free key from /docs/signup raises that to 250 calls a month, no card. HTML to PDF counts 5 of them per call. A workflow these endpoints still do not cover, PDF to image, OCR and Office conversion among them, is the most useful thing you can tell us.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.