Fork me on GitHub
Digital Commons

The whole of PDF
in Go, with no C anywhere.

Read a file, write one, rearrange it, draw it, read it back as words and pictures, and edit it with other people โ€” in a browser tab if you like, since every one of these builds for js/wasm. Fonts are parsed and shaped by go-opentype, pages are rasterised by go-gfx.

17 repositories8 architectures, tests run118 863 real PDFs measured
pdfops โ€” zsh
$ pdfops merge out.pdf a.pdf b.pdf
$ pdfops nup -n 4 slides.pdf handout.pdf
$ pdfops encrypt -user letmein -allow print,copy plain.pdf locked.pdf
$ pdfops text -layout -pages 1 paper.pdf
Measured on a page, in points, with what could not be read
marked rather than guessed at.
$ pdfops images paper.pdf pictures/
a JPEG comes out a JPEG
$ pdfops addfields -fields fields.json blank.pdf form.pdf
added 3 field(s)
One organisation, 17 libraries, every one of them pure Goand the whole suite runs on 8 of them, big-endian and 32-bit included
Measured, not asserted

Against 118 863 real PDFs, not a handful written to pass a test.

arXiv's figures, Matplotlib and Mathematica and pdfTeX and Ghostscript and Adobe. That corpus is what found a stroke that came out at half its colour, a font that took the dots off every i, and a colour transform that turned every plot's paper yellow. Each of them is in the release notes of the library it was found in.

๐Ÿ“‚

They open

118 833 of the 118 835 files that really are PDFs. Of the 118 863 collected, 27 are PNGs named .pdf and one is a PostScript file; of the rest, two are truncated past recovery.

๐Ÿ”

They round-trip

1 536 769 753 content operations read, and every one of them rewrites to an identical fingerprint. 118 833 files encrypt, decrypt and compress with every page byte for byte the same.

๐Ÿ–Œ๏ธ

They draw

4 108 pages rasterise with no panics and six blank, and the biggest changes are put beside what the operating system's own renderer draws โ€” pixels hashed before and after, never an exit status.

๐Ÿ”ค

They read back

121 946 pages come back as 34 million characters, each piece with a page, a place, a size and what it says. A piece the document gave no way to read is marked rather than guessed at.

The API

Verbs on a document, and a page as pixels.

The same operations the command line exposes are a library first. Nothing shells out, nothing is fetched at run time, and the whole of it compiles to one js/wasm module with no SharedArrayBuffer and no CDN.

main.go
// Take three pages out of a report, turn one the right way up,
// stamp the lot, and write it out.
doc, _ := ops.Open(bytes)
doc.Select("4-6")
doc.SetRotation("2", 90)
doc.Watermark("all", "DRAFT")
out, _ := doc.Bytes()

// Draw a page, and read one back.
img, _ := render.Page(src, 1, render.Options{DPI: 150})
text, _ := extract.Text(src, 1)
The organisation

One library a job, and they compose.

Each is its own module with its own release line, so a program takes the reader without the rasteriser, or the rasteriser without the writer.

reader ready

Reads and writes the format itself. Lexer and object model, cross-reference tables and streams with hybrid files and /Prev chains, object streams, repair by scanning when the table is wrong, every filter (Flate, LZW with early change, ASCIIHex, ASCII85, RunLength, PNG and TIFF predictors), the standard security handler from RC4-40 to AES-256, content streams and inline images, the page tree with inherited attributes โ€” and a writer that produces the same bytes twice. Of 118 863 real PDFs, 118 833 open; the thirty that do not are 27 PNGs named .pdf, one PostScript file and two truncated past recovery. It also writes a LINEARIZED file since v0.16.0 โ€” Annex F’s eleven parts, both cross-reference sections and a hint stream carrying the page offset and shared object tables โ€” and qpdf --check reports nothing about the output it does not also report about the input. Since v0.18.0 that includes documents whose pages share objects, which the page tree’s own inheritance makes the ordinary multi-page PDF: one /Resources on the pages node is reached by every page, and F.4.2’s shared object hint table now says which of part 6’s and part 8’s objects each page after the first depends on. Measured over eight shapes against qpdf 12.4.2 โ€” private pages, a shared content stream, two and twenty-five pages inheriting one resource dictionary, and pages 2 and 3 sharing an object page 1 never reaches. โš  What it still does not say is where in a page a shared object is first used: F.4.1’s fraction is written 0/1, so a reader may fetch one earlier than it needs it, never later. โ›” Since v0.19.0 it also refuses three bombs of one shape โ€” a count the file chose, used as a size. An object stream declaring /N 10000000000000 asked for a 160 TB slice from a 51-byte object and ended the process with a fatal out-of-memory, which recover() does not catch and GOMEMLIMIT does not prevent; a 102-byte file asked for a 932 MiB predictor row; a fax bounded its width only when /Rows was present, and /Rows is optional. Each ceiling is now derived from bytes actually held rather than from a number the file asserts. None was found by reading the code โ€” the object stream and the predictor row came from fuzzing, and the fax from the audit that the object stream’s issue asked for, which is why FuzzCCITTDecode no longer pins the parameters it is meant to vary. It reads and verifies digital signatures since v0.20.0: Document.Signatures lists the signed fields, Document.SignedBytes returns the bytes a signature covers after validating its /ByteRange, and the reader/signature sub-package verifies adbe.pkcs7.detached and ETSI.CAdES.detached on top of go-authn/cms. It was checked against poppler pdfsig 26.10.0 on OpenSSL-made fixtures โ€” RSA, ECDSA and CAdES valid; an incremental update leaves the earlier signature valid, not whole-file; two stacked signatures; seven tamperings refused by both. One deliberate difference: pdfsig calls a SHA-1 signature valid and this package refuses it by name. A /ByteRange the file does not bear out is refused, and a signer’s claimed name, reason, location and time are reported only when the signature covers the dictionary that holds them. At most 64 distinct signatures and 1 GiB of signed bytes are verified per document. โš  Trust โ€” the certificate chain and revocation โ€” is the caller’s.

repository ยท pkg.go.dev

ops ready

The verbs, and the pdfops command โ€” 64 of them, counted from the source of its command table at v0.45.1. Merge, select, delete, reverse, move, rotate, crop, resize, split, n-up, booklet, poster, divide, duplex, overlay, blank pages, watermarks, page numbers, Bates stamps, a placed picture โ€” a signature or a logo โ€” page labels, layers, text colour, sanitize, flatten, compress, encrypt, decrypt, permissions, repair, attachments, forms โ€” and reading a page back as text, pictures, tables (CSV, JSON or Markdown) or a whole document in Markdown. Links and bookmarks are carried over and pointed at the pages they became. It signs a PDF since v0.39.0: ops.Sign and pdfops sign add a digital signature as an incremental update, so every earlier signature still verifies, with a detached CMS from go-authn/cms โ€” RSA, RSA-PSS, ECDSA or Ed25519 โ€” under adbe.pkcs7.detached or ETSI.CAdES.detached. poppler pdfsig calls the RSA and ECDSA signatures valid; โš  it reports an Ed25519 one as Invalid, while reader/signature and openssl cms -verify accept the same bytes. Since v0.40.0 the signature can be visible: SignOptions.Appearance and pdfops sign -visible x0,y0,x1,y1 [-image file] [-text words] draw a picture and text in a box on the page, inside the signed bytes. โ›” The text is Latin only (WinAnsi): a Cyrillic or CJK character is refused by name, not dropped. It signs with a .p12 / .pfx file since v0.41.0: SignOptions.LoadPKCS12 and pdfops sign -p12 f.p12 [-p12pass <file or ->] take the key, certificate and chain from one password-protected PKCS #12 file, the password never an argument or an environment variable. โ›” The certificate is not judged โ€” no validity dates, key usage or chain to a root are checked. โ›” Not claimed: a PAdES baseline, timestamps or LTV, or an encrypted file, which is refused. It turns text into paths since v0.43.0: OutlineText and pdfops outlinetext leave a page that looks as it did and holds no font, with /ActualText, /Alt and /E removed too. โ›” Past a bound it refuses, and vertical writing is refused by name; annotation text is not reached, and counted. It makes a scan searchable since v0.45.0: AddInvisibleText and pdfops ocrtext draw a recogniser’s words (JSON, or Tesseract hOCR) over the page in invisible text, Tesseract’s GlyphLessFont design, and the page renders pixel for pixel as before. โ›” It does not recognise anything itself, and a redacted page is refused. Every verb is measured on the whole corpus: 118 833 files compressed and read back page for page identical, 35.2 GB down to 33.6 GB.

repository ยท pkg.go.dev

render ready

Turns a page into pixels. The transform stack, every painting operator, both winding rules, strokes with caps/joins/miter/dashes, clipping, every colour space, transparency, form XObjects; images at every depth with soft and stencil masks; text from TrueType, OpenType, bare CFF, PostScript Type 1, composite and Type 3 fonts; PDF functions of all four kinds, all seven shadings โ€” axial, radial, function-based, and the four mesh kinds, triangles and Coons and tensor patches โ€” and shading and tiling patterns, placed in the space of the form that names them. Rasterises with go-gfx and reads outlines with go-opentype. Builds for js/wasm.

repository ยท pkg.go.dev

pdffont ready

What a document says about a font โ€” not the outlines, which are the program’s business. Which codes a string holds, how wide each is, what each is called, and what text each stands for, through /ToUnicode and the encodings. It refuses one guess: a symbolic font read through an assumed encoding gives the wrong letter with nothing to say so. The glyph-name table is checked against the documents themselves โ€” 63 515 names, 99.31% agreement.

repository ยท pkg.go.dev

convert ready

Pictures into a PDF, and a PDF back into pictures โ€” or into SVG. Reads PNG, JPEG, GIF, BMP, TIFF, WebP and PSD, and writes all of those but PSD โ€” which it refuses by name, because writing a layered document is a different job and a PNG under a .psd name would be worse than saying no. PDF to SVG (pdfconv to-svg, v0.17.0): text becomes outlines so the file needs no font, one page is name.svg and several are name_svg.zip, and it is all or nothing โ€” a zip with page 4 of 9 missing would look complete, so no file is left behind. Bounded before it is spent: 1000 pages, 64 MiB a page, 256 MiB and five minutes a run. โ›” Passwords no longer go on the command line: -password is gone from every verb, replaced by -password-file (a breaking change). WebP writes in both of its codecs: quality 100 is the lossless one, half the size of PNG on a rasterised page of text; below that the lossy one, 12ร— smaller again on a detailed page. The content decides a format, never the file’s name. Only the DPI says which page a picture is: 2480ร—3508 is A4 at 300 and a page a metre tall at 72. Fitting onto paper uses one scale for both axes and only ever shrinks.

repository ยท pkg.go.dev

doc2pdf ready

Any document into a PDF, from a shell. doc2pdf report.docx โ€” Word, Excel, PowerPoint, OpenDocument Text, Markdown, reStructuredText, HTML, plain text, CSV, JSON, XML, EPUB, MOBI, FictionBook, RTF and email, through richdoc and document; XPS and OpenXPS (v0.4.0) are read directly into a vector PDF under one 160 MiB memory budget per conversion; HEIC and HEIF pictures (v0.5.0) become one page each (doc2pdf). Pure Go, CGO-free, no TeX. --max-input BYTES refuses an input over the limit before reading it (16 MiB for RTF, 256 MiB for every other format), and the output is written atomically. It exists because thirteen libraries were finished, tested, released and unusable from a shell: measured across thirty repositories of this fleet, four shipped a command and twenty-five did not, and a reader nothing can call is in a different state from an unfinished one โ€” easy to mistake for it. โ›” Nothing is fetched. A document arrives from something somebody was handed and its images carry URLs the author chose; following them would make every conversion a request to an address of their choosing, from the converting machine. What was refused is printed, because a page with holes in it must not be silent. A failure names the reader โ€” thirteen libraries stand behind it and “cannot read it” sends you to the wrong one โ€” and every reader in the table is held by a test that converts a real file of that format.

repository ยท pkg.go.dev

extract ready

Reads a page back: the text with where each piece of it sits, the pictures with the box each covers, and the grids its text lines up into. A page holds instructions for drawing glyphs, not text โ€” so where the document says nothing about what they mean, this says so rather than guessing. A column boundary is a stretch of page every row leaves empty, and three things that look like columns are not: a bullet, a column nothing was drawn in, and a page number. On one 213-page document those three took the count from 588 tables to 40, which are the real ones; a prose report in the same run reports none. Over the whole corpus: 121 946 pages, 34 million characters, 1.89% of runs that nothing in the document could name, 300 685 pictures located, no panics.

repository ยท pkg.go.dev

document ready

A PDF read back as a document rather than as text โ€” headings, paragraphs, lists and tables, into the richdoc model, which gets Markdown, reST and HTML out of a PDF through code the fleet already has. A page has no headings: it has glyphs at places, and everything above that is an inference. A heading is text set larger than the body and rare with it โ€” measured over six real documents, heading sizes hold 0.01% to 5.76% of the characters and a second body size holds a third, and taking “larger” alone gave a nine-page report 131 headings of which 130 were prose. What it will not read is published too: ruled lines, columns of a multi-column layout, and footnotes.

repository ยท pkg.go.dev

coedit ready

A PDF several people edit at once. What is shared is not the file โ€” merging two piles of bytes cannot be done โ€” but the plan: which pages, from which files, in which order, turned and cropped how, with which bookmarks over them. A list, a tree and a handful of fields, which a CRDT merges without asking anybody. Checked with 25 editors making random edits for 40 rounds, merged in a random order, all agreeing on the same document.

repository ยท pkg.go.dev

forms ready

Read, fill and draw an AcroForm โ€” the boxes somebody types into, the squares they tick, the lists they choose from. A field’s value is not what gets drawn: what gets drawn is a little content stream beside it, so a reader that fills a field and does not rewrite that stream leaves the page blank. An AcroForm dictionary with an empty field list is not a form โ€” 561 of the 118 833 figure-corpus files are exactly that, left behind by a producer. Builds for js/wasm.

repository ยท pkg.go.dev

xfa ready

The form inside a PDF whose pages are blank. Of 2 240 real government forms, 560 carry an XFA package and 546 are static โ€” a second, proprietary copy of a form already drawn on the pages, which forms fills without help. The other fourteen are dynamic: their pages hold a panel reading Please wait… your PDF viewer may not be able to display this type of document, and the document exists only as XML. Adobe removed the format from PDF 2.0, and no browser lays one out.

repository ยท pkg.go.dev

html2pdf ready

Static HTML to VECTOR PDF, zero C. No headless browser and no screenshot-then-slice: it drives go-webengine’s own layout tree straight into pdfkit’s text, rect and stroke calls, so the text in the PDF is real text โ€” selectable, searchable, small โ€” rather than a picture of text. v0.4.0: Options.Fetch and html2pdf.Offline render with no network access at all (a refused stylesheet or image is left out, counted through OnRefused; data: images still render; --offline on the command), a second barrier for a server that renders HTML built from untrusted text. v0.3.0: list markers painted (::marker, every list-style-type), CSS escapes and counters; @page margin boxes with counter(page) / counter(pages) for page numbers, target-counter() for a table of contents, and a html2pdf command (cobra, POSIX flags, --title, --author, --subject, --keywords).

repository ยท pkg.go.dev

latex ready

The other direction: reconstruct LaTeX source from a PDF. A PDF that came from TeX does not contain a document; it contains the marks TeX made putting one on paper โ€” glyphs at absolute positions, from fonts whose names are the only surviving record of what the author asked for. Reconstruct gives back the .tex, and writes out the pictures its includegraphics commands name.

repository ยท pkg.go.dev

conformance ready

Where all of the above is judged by implementations that are not ours, over corpora of real PDFs. A file our own reader reads back perfectly can draw nothing anywhere else โ€” that has happened here: a rebuilt cross-reference stream our reader was delighted with, and macOS drew a blank page. So these tools ask poppler rather than asking ourselves. A figure is only as honest as the population it came from, so the corpora are chosen and stated rather than collected.

repository ยท pkg.go.dev

playground ready

A PDF workbench that runs in a browser tab and nowhere else. Open a file, turn its pages, rotate one, drop one, lay it out two to a sheet, write across it, save it back out โ€” and none of it leaves the machine, because there is nowhere for it to go. Its commands are a ribbon of seven tabs: the ribbon carries the verbs and a panel beside the page carries what each verb is told, so choosing a tab opens the settings that tab’s verbs read. Down the left, a rail you can widen: the document’s own table of contents above its minipages, and the links it carries when it has no outline โ€” which most documents do not, so a contents view offered only to the minority is one nobody finds. Each link’s row says the words it sits on, which is the only name a link has; one that leaves the document is shown and not followed, because nothing leaves this tab and that includes you. The status line names the build it is running, because an old binary and a missing feature are otherwise the same screen. Widen the rail and the minipages are re-rendered at their new width when you let go. The whole tool is one wasm binary the browser downloads once and a service worker then keeps. Driven in CI by a real Chrome over the DevTools protocol, pressing each control where the workbench says it is, dragging the divider the way a hand does โ€” press, move while held, let go โ€” and reading the canvas pixels back. That last part is new, and it found two defects on its first run: everything the check did before was a press, and a press is one point, so the one control that answers only to a gesture had never been exercised at all.

repository ยท pkg.go.dev

pdfkit ready

The document builder: pages, vector graphics, and text set in embedded, subsetted fonts. TrueType and OpenType/CFF embed as Type0 (Identity-H) composite fonts with a /ToUnicode CMap; JPEG and raster images place directly; a widget bridge prints a go-widgets tree onto a page, rasterised or as selectable vector text. With the zero Options the output has no timestamps and a content-derived /ID, so identical inputs produce byte-identical PDFs.

repository ยท pkg.go.dev

Where it runs

8 architectures, and the tests run on every one.

Cross-compiling proves a program builds. It says nothing about what it does when a byte order, a word size or a floating-point unit differs โ€” and that is where a format parser lives. Every repository here runs its whole suite on each of these on every push: amd64, arm64, riscv64, loong64, ppc64le, s390x, 386 and arm.

๐Ÿ”„

s390x is big-endian

Every lane was green from the first run, which is the useful kind of result: nothing in the stack had quietly assumed a byte order. A PDF is full of two- and four-byte integers, and a reader that reads them the wrong way round on one machine is a reader nobody can trust on any.

๐Ÿ“

386 and arm are 32-bit

They found four real defects. One of them โ€” a guard converting a float before it could judge it โ€” crashes on arm64 as well, so a 32-bit lane paid for itself on a 64-bit machine. 386 runs natively, not under emulation, because an emulator that loses floating-point state across a preemption makes a flaky lane out of correct code.

โš ๏ธ

loong64 is pinned, and we say why

Its lane names Go 1.26.4 rather than the current release, because golang/go#81000 miscompiles a float-to-integer conversion there and the backport is still open. We found it with this suite, on real LoongArch silicon, and reported it upstream. A pinned lane with a reason beats a green one with a workaround nobody wrote down.

๐ŸŒ

and js/wasm, which is the workbench

The same libraries compile to one wasm binary with no C, no CDN and no SharedArrayBuffer โ€” which is why the workbench opens a file, rearranges it and saves it back without any of it leaving the machine. Open takes a PDF, a picture, an SVG โ€” on the page as real paths, so it stays sharp, and the workbench says so when a gradient or a clip path forced it to draw the page instead โ€” or a comic archive, whose pictures become pages in the order their names put them, page 10 after page 2. Make a field for this turns a printed form into one somebody can fill in: a blank form is a page of questions, so selecting one names a fillable field and places it under those words โ€” a box to type in or a tick, with the name taken from the words and the punctuation left out, because a field's name travels into exported data and into whatever script fills the form. Add files after this one takes as many as you choose, in the order you chose them, and a file among them that cannot be read stops the merge rather than leaving a document part-way through a job. Arrange the pages puts every page where the page was, as a grid of tiles: press one to pick it up, press the page it should go in front of, and it goes there โ€” two presses rather than a drag, because what is held has to be visible between them and a tile can say it where a drag cannot. Turn them by an angle takes the turns a quarter cannot say โ€” any number of degrees, with the paper growing so that no corner of the turned page ends up over the edge of its sheet, which is the one thing straightening a crooked scan does not do and does not need to. Head and foot them writes a header and a footer in one press, each from its own box, with {page} and {pages} filled in โ€” as they are for any stamp, which is what makes a stamp at top centre a header with a page number in it. The page you are reading is a picture, so the words on it are read and placed as a layer of their own: drag across them to select them โ€” or type into Find and have the workbench turn to the page and light the words for you, which is the same selection a drag would have made, so everything below works on what was found โ€” and Highlight, Underline, Strike out or Squiggle under writes a real text-markup annotation over them โ€” QuadPoints in the page's own space, the content stream untouched, so the words stay selectable and the mark can be taken off again. Box them, Ring them and Point at them draw a rectangle, an ellipse or an arrow โ€” always round the passage or stopping short of it, because a shape over the glyphs hides the very words it draws attention to. Put a note on it and Write in the margin say something of your own instead: a sticky note that goes beside the passage rather than over it, because an opaque icon would hide the very words it is about, and a comment pencilled in the margin next to it. Redact is the opposite act and says so: it takes the words out of the file rather than drawing a box over them โ€” a box is the standard leak, since the text is still in the stream for anyone to copy out from under it โ€” and a picture the region crosses has the samples under it destroyed and the picture written back, because the spec asks for that in so many words and a mask over them is only the image-shaped version of the same box. Which is what a reader of scanned paper needs, a scan being one picture across the whole page โ€” and a scan is a JPEG, which is why that sentence described a page nobody has until ops v0.38.0: the JPEG is now decoded and written back as plain samples rather than re-encoded, because re-encoding re-quantises the photograph block by block and would degrade every one of them in order to destroy a corner, so what goes back is exactly what a reader of the original would have seen with the region gone, and the file grows instead of the picture changing. It still refuses, naming the reason, wherever it cannot remove everything โ€” a picture drawn turned or twice, one carrying a mask, a CMYK JPEG whose colours have no faithful way back to RGB without the profile the file does not carry, and anything past a hundred megapixels, which is read from the header because a JPEG declares its size in a handful of bytes and a decoder then asks for width ร— height ร— 3. Replace the words is the other way to change what a page says: the new text goes in with a kern that cancels the width it did not have, so the rest of the line stays where it was โ€” and where a page draws its text one letter at a time, it says how many pieces it found rather than guessing. Bookmark this page and Bookmarks from a file write the table of contents the rail down the left has always shown and the ribbon could only ever drop: one entry added to the tree already there โ€” titled with the passage you selected and pointing at the page that is on rather than at the page you happen to be looking at, since a bookmark that says one thing and goes somewhere else is worse than none โ€” or a whole tree from a text file, a title, a tab and a page number a line with two spaces of indent per level, which is the same file pdfops outline -from takes, read by the library's own parser rather than by a second one written for the browser โ€” and Write a contents page is the other kind of table of contents, the one that gets printed: a page at the front with a line for each bookmark, its page number at the right and dots leading to it, with the numbers accounting for the page it adds, because an entry that pointed at page 7 is on page 8 once a contents page is in front of it. Compare with a file reads an earlier version of the document against this one and says what changed โ€” pages added or dropped, words, pictures and comments โ€” with the pages paired by what they say rather than by their numbers, so a page inserted in the middle moves nothing after it, and with the direction written into the report, since a reader who has it backwards reads every addition as a deletion. The Redraw tab will also redraw every page as a picture โ€” inverted for reading at night, grey, on cream, brighter, or scuffed the way a flatbed scuffs them, and out as a .cbz a comic reader opens โ€” and says what that costs on the control and again in the status line, because afterwards no word on the page can be selected, searched or read out, and the trade is invisible at the moment you make it.

๐Ÿ”—

A Workflow tab, on BentoPDF's own JSON

Chain operations on a node-graph canvas and run them in the browser: one PDF out, or a ZIP. Imports and exports BentoPDF's workflow files, and keeps no password. Read the page.

Text, fonts and widgets

A subset, an encoding, and text you can still copy.

โœ‚๏ธ

Every embedded font is a subset

Identity-H encoding, a per-glyph /W width array and a /ToUnicode CMap, so copy and paste still work. TrueType glyf outlines embed as a subsetted FontFile2 / CIDFontType2 with a /CIDToGIDMap stream; CFF and OpenType outlines embed as a charstring-subsetted FontFile3 / CIDFontType0. Only a CID-keyed CFF or a CFF2 variable font falls back to embedding the whole table.

๐ŸŒ

Shaped, where shaping is the point

TextShaped runs the go-opentype shaper's GSUB and GPOS tables, so Arabic joins, Indic reorders and CJK sits where it should โ€” rather than a run of glyphs laid out left to right and called typesetting.

๐Ÿงฉ

A widget tree, printed

The subpackage pdfkit/widget (so a program that only writes PDFs does not link the toolkit): widget.Add and widget.AddVector put a go-widgets/toolkit tree on a page โ€” the first as a rasterised image XObject, pixel-identical to the screen; the second as PDF vector operators, so fills and strokes stay crisp and the text stays selectable, a TrueType widget label's own face embedded as real Type0 text.

๐Ÿ—ณ๏ธ

Forms, read and written

pdfops fields lists what a form asks for, pdfops fill fills it in, and pdfops addfields creates one โ€” text, checkbox, radio, combo, list, button and signature fields, from a description. A checkbox is written with a drawing for each of its states, because NeedAppearances does not cover a button: one written without them is a box that never looks ticked however often it is clicked.

๐ŸŽฏ

The same bytes twice

The writer is deterministic: the same document written twice is the same file, which is what makes a before-and-after comparison mean anything at all.

100 % statement coverage, including the branches that report a bad file.

And it runs on 8 architectures, not merely compiles for them.

Read the source on GitHub โ†’