tclpdf

tclpdf 1.8 — what it does, and what it deliberately does not
Login

tclpdf 1.8 — what it does, and what it deliberately does not

A pure Tcl package that writes PDF documents, and reads enough of them to take a page over, continue a file, or say what a file contains. No compiler, no binary extension, no Tk. It needs Tcl 8.6.11 or newer and runs under Tcl 9 as well — and since 1.7.3 the same script writes the same file under both; zlib is a built-in command rather than a package, and tdom is needed for the XMP metadata packet of a PDF/A, PDF/UA or ZUGFeRD document — that is the one place it is required. The SVG module uses it too where it is present, and prefers it: measured, it parses 27 to 48 times faster than the parser this package brings along. Without tdom, SVG still works, and the two parsers answer the same file the same way: what one refuses the other refuses under the same error code, both expand the entities a document declares, and an entity expansion is refused by either before anything is drawn. The parser brought along copies what it reads and never evaluates it.

This note lists the whole of it. What a feature costs, what it was measured against and why a decision fell the way it did is in the manual at the feature itself — here it is one line each, so that the shape of the package is visible in one reading. It replaces the note of the same name for 1.7. What changed between the two came in two steps. 1.7.3 added no feature and closed a class of defect that no validator sees: a value of digits with a leading zero, which Tcl 8.6 reads as octal and Tcl 9 as decimal, and a text that merely looks like a number, which an expr ternary turns into one under both — why that took a release of its own: https://fossil.sowaswie.de/tclpdf/technote/85872757e9. 1.8 adds class rules from an SVG <style> block, a replacement for a missing glyph on request, a repair for markup that people type, room of its own around a heading, page numbers for a section of a document, and an invoice embedded from bytes. With 1.7.1 and 1.7.2 between the two, the data the package ships carries the licence notices of its sources, after a provenance review.

In numbers

Version 1.8
Modules 109 Tcl files, loaded lazily — package require tclpdf registers all of them and loads one; a document that draws a rectangle and is written loads fifteen, one with a line of text seventeen, and a script that never touches a picture, an SVG, an invoice, a signature or a foreign file never reads most of the other ninety
Tests 4992, in 96 test files, green under Tcl 8.6.18 and Tcl 9.0.4 — all 4992 under 8.6, 4989 and three skipped under 9.0
Examples 93 scripts writing 103 documents, every one run, validated and rendered on every acceptance
Documented commands 134 command forms — 123 methods of a document, 11 package commands — every command, option and value with a test of its own
Reviews eight norm-review rounds up to 1.3, the last two with twelve and fourteen reviewers reading the code against the standards it claims and 29 and 74 findings, all built, each with a test that a single reverted line turns red; 1.4 to 1.7 add features to that state rather than another round; 1.7.3 and 1.8 built from three field reports and a measured class of defect
Dependencies none for the core; tdom required for XMP and preferred for SVG, http — and tls for an https authority — for a document timestamp, tzint if you want barcodes

make check is the full acceptance in one run: the suite under every interpreter present, every example, qpdf --check over every document, veraPDF against the profile each document itself claims, Mustangproject over every hybrid invoice, pdfsig over every signed or stamped file, every interactive form filled and read back, pdfinfo as a plain reader, the reference code of the packaged skill under both interpreters, whether the error code table in the manual is the one the source makes, and whether the manual is newer than its source — 91 checks, all passed for this release. Since 1.6 a failing test is named in the run's own output, with its result, its expectation and its errorInfo, where the summary used to say only how many had failed; the full log is kept beside it, and each interpreter runs the suite in a temporary directory of its own, and since 1.7.3 the suite leaves no file behind in the directory it was started from.

Module versions, since 1.6.1: every module that changed since a release carries a new number, and a module that calls new code of another requires that version, so two releases installed side by side load the files of the newer one, or fail at package require rather than halfway through drawing a table. tests/release.test holds it: a module whose number equals the one in a version-* tag has to be that tag's file byte for byte, and the youngest release installed beside the tree, in both orders on auto_path, has to lose against it. It needs fossil and a checkout and skips itself otherwise. Why that took a release of its own: https://fossil.sowaswie.de/tclpdf/technote/138a1467ec. Since 1.8 make install builds pkgIndex.tcl afresh before it copies, so a version raised since the last configure no longer installs the previous index into the new directory, and it sets every file it puts down to u=rw,go=r and every directory to u=rwx,go=rx, so a checkout made with mode 0600 no longer installs a package nobody else can read.

Documents and pages

Pages in mm, pt, cm or in, in the formats a document names or in any size given; y counts from the top, which is the opposite of PDF's own convention and the one thing to know before writing the first line. All five page boxes (media, crop, bleed, trim, art), page rotation, page labels for the reader's page field, and the viewer preferences a file can ask for. Document information, with CreationDate and — since 1.8 — ModDate stamped from the one moment of the first write and kept, so the pairs agree with the XMP packet and a second write gives the same bytes; beside an XMP packet of the caller's own neither is stamped, since a stamped date could only disagree with it. An outline of bookmarks, links to a URL, to a page or to a structure element, and named destinations. Content is written straight out — a document of a thousand pages does not hold a thousand pages in memory.

Output goes to a file or to a channel, and a channel may be a pipe or a socket: a CGI response is written with the headers in front of it. Two writes of the same document are byte-identical, which is what makes a regression measurable at all. Every feature is checked against the PDF version the document is written as — a key that needs 1.5 in a 1.4 file is refused by name, not written and hoped for.

The same file under both interpreters, since 1.7.3. A number with a leading zero is read in decimal wherever a caller hands one over — coordinates, sizes, angles, counts, indices and the components of a colour: 010 is ten and 08 eight, where Tcl 8.6 alone read the first as octal eight and refused the second, and the call writes the same bytes as the one without the zeros; 0x1A stays hexadecimal, as its prefix says. A value that is text made of digits — a field name, an export value, a keyword, a link address, a font alias — keeps its zeros, because no text passes through expr any more: 0123 used to come out as 83 under 8.6 and 123 under 9.0, and 1.10 as 1.1 under both. Each place has a test that feeds 0123, 010, 1.10 or 0x1A and reads the file back, and the example 00.04-leading-zeros draws one page with and without the zeros and compares the content.

Files as bytes, on one road since 1.6: a font, a picture or an attachment read in, and a file that a signature, a timestamp or an incremental update writes out, all pass through one place that opens the file inside try, closes it on every way out, and leaves no channel open after a refusal. Whether a path was missing or a directory is asked only after the open failed (TCLPDF IO MISSING, TCLPDF IO DIRECTORY), never checked in front of it, where the answer can go stale before the open — measured, a directory opens for reading under both interpreters and only the read after it fails. An error on closing a written file, which is where a full disk shows, reaches the caller. An attachment and an invoice take a path or -data bytes, and since 1.8 both together, or neither, are refused before anything is read (TCLPDF ATTACH ARGUMENT source, TCLPDF ZUGFERD ARGUMENT source). With thanks to Ralf Fassel, who pointed out the channel a refusal left open.

Graphics

Lines, rectangles, circles, ellipses, arcs in three styles, polygons, Bézier curves and arbitrary paths; dashing, line joins and caps, the miter limit, clipping, transformations, the graphics state stack. Fill and stroke in RGB, CMYK, grey, Lab, a spot colour as Separation, an ICC profile as ICCBased, and 148 colour names. Transparency as constant alpha, the sixteen blend modes, all seven shading types — axial, radial, function-based, the free-form and lattice-form Gouraud meshes, Coons and tensor patches — tiling patterns, overprint with its mode, and form XObjects: draw once, place as often as wanted, scaled, rotated about the point named, faded.

Layers (optional content) as a reader shows them: a group is declared, drawn into, switched on or off, and several groups can be tied into a radio set. A PDF/A document may carry them. A Tk canvas is drawn into a page as vectors — an example rather than a feature, because a canvas gives away everything a drawing command needs.

Every number that reaches the file is checked on the value the file will carry, not on the value given: a dash, a shading stop, a pattern step or a box that would round to a forbidden zero is refused before the operator is written, and a placement whose matrix would be singular is refused the same way.

Text and fonts

The fourteen standard faces without embedding anything, and four formats to embed: TrueType, subset to the glyphs actually used, as Type0/CIDFontType2 with Identity-H and a ToUnicode CMap that gives a character its own CID where two share a glyph; OpenType with CFF outlines, a bare CFF table, and Type 1, all whole; a TrueType collection is read by face. A Type 3 font whose glyphs are drawn by the caller — a glyph is a piece of the same drawing the page uses, so it may carry colour, a gradient or a picture. Colour fonts in three forms: the layers of a COLR version 0 face, the paint graph of a COLR version 1 face with its gradients, clips and compositions, and the PNG pictures of an sbix face such as Apple Color Emoji, each drawn into a Type 3 font so that a two-colour logo or an emoji sets like text; what each glyph was built from — bands, clips, a constant opacity or a soft mask — is reported, so a caller who needs a document free of soft masks can count them. Variable fonts are embedded as the instance asked for, with the metrics of that instance from MVAR and the vertical metrics from the variations. A fallback chain names the faces that may set what the family cannot, per character — the no-break spaces and non-breaking hyphen a pasted text brings and a main face often lacks included —, and the line still comes out of a text extractor whole. Vertical writing with Identity-V.

A missing glyph, replaced on request, new in 1.8. A character no face of the chain has is refused by default, as it always was, and the default writes the bytes it always wrote. font -missing replace turns the refusal into a mark: the character is drawn as -replacement — U+FFFD unless said otherwise — in the first face of the chain that has it, with the character that was written beside it as ActualText, so copying, searching and a screen reader get the original and the document stays PDF/A-3u and PDF/UA-1 valid, measured with veraPDF. It reaches everything the chain reaches: a paragraph, a table cell, textPath, leader, pageNumbers and text inside an SVG drawing. textMissing names every such character of a string in one call before anything is drawn, as {codepoint position …} in code points — under Tcl 8.6 the position of a refusal is not an index string replace can use beyond the BMP —; textReplaced counts what was drawn as a replacement since it was last asked, and the glyphReplaced event says it per character, where it is drawn and never where it is measured. A replacement the chain cannot set is refused at the call (TCLPDF FONT REPLACEMENT), and so are .notdef and a character that is never drawn; the hyphen the line breaker sets is the package's own and is never replaced.

Runs inside a paragraph, since 1.5: a bold, italic or bold-italic word, an underlined or struck one, a link, and a heading of three levels in the middle of flowing text, with the line breaker running over all of it and measuring every piece in its own face; a run keeps the paragraph's size and colour, a heading is a paragraph of its own — larger, bold, never the last line of a page — and a list item is one too, indented with a bullet or a counted number in front of its first line. The primitive is a list of {text options} pairs; two notations become that list, tags (<b>, <i>, <u>, <s>, <a href>, <h1> to <h3>, <ul>, <ol>, <li>) and Markdown (**, *, ~~, [text](url), #, -, 1.), both read strictly — a run left open is refused with its position, under either notation, never guessed at — and both proven to set the same bytes. For strings that people type, since 1.8, ::tclpdf::markdown::repair and ::tclpdf::markup::repair write only the places the strict reading refuses as literal text — the whole delimiter of a run left open, the bracket of a broken link, the < of a refused tag as &lt; — and hand back the codes of what they removed, so one stray ** in a remark does not cost the paragraph its formatting, the caller has the list to log, and the strict reading stays strict; example 01.17 shows such a paragraph refused once and repaired once. -headingSpacing, also new in 1.8, gives every heading of the three notations room above and below of its own, on top of -paragraphSpacing, never above a heading that opens the block, a column or a page and never below one that closes it; textHeight, textLines, -height, -paginate and -balance measure the same. An embedded family reaches its bold face through font family, and a face the family does not have is refused by name rather than set regular in silence. Underline and strikeout take their place and weight from the face's own tables, the AFM's for the standard fourteen. In a tagged document the headings are H1 to H3, a list is L with LI, Lbl and LBody, checked green by veraPDF for PDF/UA-1 and UA-2. A url run writes the link annotation and nothing more — no Link structure element and no Contents —, so a tagged document with one cannot claim PDF/UA, and a link it needs is set with link and structure Link. That was so in 1.5 as well; the manual of 1.5 said otherwise, and 1.6 corrects it.

Single lines and paragraphs with justification, indents, a height limit that hands back what did not fit, a type area the document is given, columns balanced on the last page, text flowing around shapes, leader rows, text along a path, and a pagination that is linear in the length of the text. A leading under half the size is refused once a paragraph has two lines (TCLPDF TEXT LEADING), naming the leading in points that was probably meant — the usual cause is the factor of a table's leading key written as -leading, which takes points. Page numbers with a placeholder for the total, and since 1.8 placed by the same -anchor a line of text takes — baseline, top, middle or bottom — and set for a section of a document: -to names the last page numbered and -start the number the first one carries, so an appendix counts "page 2 of 4" on its own between a delivery note and a copy sheet with no number at all (example 04.06), and a call without the two writes the bytes it always wrote. Kerning and the standard ligatures from the face's own tables, both on by default. GPOS in full for the horizontal line: pair and single adjustment, cursive attachment, chained contextual positioning, and marks placed by their anchors on a base, on the component of a ligature they belong to, and on another mark — so decomposed text comes out where composed text comes out, on the baseline and on a path alike. GSUB in full: ligatures, contextual and chained substitution, reverse chaining, with the feature stages HarfBuzz runs and measured against hb-shape word for word. Hyphenation by Liang patterns, per language, off by default, a two-level dictionary read as its two levels; the patterns are not shipped, because every published set carries a licence of its own and this package is MIT — the manual names where a system keeps them, on Debian the package hyphen-de for the German ones. A break hyphen in a tagged document is bracketed so that the word extracts whole, and text -breakHyphen says the same of a line a caller broke himself. Since 1.6 it may stand beside -width for a line of runs, which then has to stay one line at that width or is refused (TCLPDF TEXT BREAKHYPHEN lines) — the road a table takes to draw a cell of runs line by line.

Right-to-left text: Hebrew by order alone, Arabic with its contextual forms, ligatures and marks from the face's own tables, Nastaliq with its cursive descent, digits and brackets where UAX #9 puts them, marks in the order UTR #53 asks for. What cannot be set correctly is refused by name rather than drawn wrong — a line that mixes both directions in one call, and the scripts that need a shaper this package does not have.

Text is filled, outlined, both, or drawn nowhere at all — the last of those is how a scanned page carries its recognised text under the picture of itself.

Pictures

JPEG and PNG, both passed through unchanged wherever possible: a JPEG goes in as DCTDecode with the colour transform its markers call for, a PNG without alpha as FlateDecode with its own predictor, and a colour-key transparency stays a colour-key mask on the same pass-through. Only an alpha channel is decoded, into a soft mask. TIFF is read too — the format scans arrive in: Deflate, PackBits, CCITT Group 3 and 4 and Technote 2 JPEG are passed through as the PDF filter that undoes them, LZW is unpacked and rewritten as Flate so that PDF/A holds, and a picture whose compression carries state from one row to the next becomes one image per strip, stacked by the placement. Inline images where the caller asks for them.

A one-bit picture can be a stencil mask that lets the fill colour through its bits — one logo embedded once and placed in as many colours as wanted — and any picture can be the soft mask of another. An embedded ICC profile becomes the picture's colour space. Every format is asked what resolution it states about itself — a PNG pHYs chunk, a JFIF density, an Exif tag, a TIFF XResolution — so a 200 dpi scan comes out 219 mm wide rather than the 610 mm that assuming 72 dpi would give it. Two pictures are two pictures even when a hash says otherwise: the bytes decide. Every question that can turn a picture or its mask away is asked before an object is written.

SVG is drawn as vectors, not rasterised: shapes, paths, transforms, groups, reuse, nested viewports, viewBox, gradients with their stops and inheritance, clip paths and masks, group opacity, dash offset and miter limit, units from em to mm, switch, visibility, currentColor, and text set with the package's own font handling. Every number in a drawing is read in decimal, as SVG knows no other, a gradient stop takes its colour through the reader fill and stroke use — rgb(), rgba() with its alpha multiplied into stop-opacity, percentages, currentColor —, where a stop in rgb() used to cost the whole drawing, and a coordinate written with an exponent reaches the stream as a PDF number. Class rules of a <style> block, new in 1.8 (svgCss): the way an Illustrator export writes its colours and its clipping, .cls-1 {fill: #0086b3} and class="cls-1" on the shape, read from every block of the drawing, <defs> included, in document order, comma groups too; a class sets what a presentation attribute or style="" sets, clip-path, mask and clip-rule among it, in the cascade of SVG 1.1, 6.4 — attribute below class, class below style="", the later of two rules winning. The example 03.12 draws a drawing styled by classes beside the same drawing styled inline. What a drawing loses — a filter, whatever a <style> block holds besides single-class rules, a spreadMethod, an error in path data — is reported by name through svg info, never dropped in silence, and a drawing that is refused leaves the page untouched.

Tables

Column widths that follow the content or are given, cell wrapping and hyphenation per column or cell, alignment including on the decimal point, three themes, per-cell styling, row and column spans, page breaks with the header repeated and the footer where it belongs, a table too wide for the page broken across its width and tagged as one table, and a layout that can be asked for before anything is drawn.

Runs and markup in a cell, since 1.6. The occasion was an application that had written {runs …} into a cell and found the string on the paper as it was written, because runs was not a key a cell knew. Now it is: runs holds the {text options} pairs of text -runs 1 — a bold client name, a struck old estimate, an underlined term, a link — as a program writes them from its data, and markup is a style key that names the notation a cell's text is written in, plain, tags or markdown, said once for the table, a section or a column, and otherwise by a single cell. A cell of runs is measured as it is drawn: every piece in its own face, so the row is as tall and the automatic column as wide as the bold words make them; its first baseline is the baseline of the plain cell beside it; hyphenate breaks inside a run, with the break hyphen bracketed in a tagged document as in any other cell. Refused by name and before anything is drawn: text beside runs and a list of odd length (TCLPDF TABLE CELL runs), markup written as a pair or beside runs (TCLPDF TABLE CELL markup), a value outside the three (TCLPDF TABLE STYLE markup), a body cell of runs in a decimal column, a heading inside a cell (TCLPDF TABLE CELL paragraph heading), and a right-to-left cell. A notation left open is refused as text -markup refuses it — nothing falls back to plain text in silence; a caller who wants that fallback writes it in the -didParseCell hook, whose answer is checked like a cell that was written, and since 1.8 the same hook can hand a cell that people typed to repair, which keeps the rest of the cell formatted. The same hook keeps the words of a heading a cell cannot have: translated with ::tclpdf::markdown::parse and heading replaced by style bold, ## Service comes out as a bold line at the cell's size. The example 04.05-table-markup shows all of it, the refusals, such hooks and two cells holding a list included:

set client "Weber & Sohn"
$doc table -at {20 30} -width 170 -head {{Date Activity Hours}} -body [list \
    {2026-09-03 "**Mueller GmbH** - review, see [ticket 4711](https://fossil.sowaswie.de/tclpdf)" 1.5} \
    [list 2026-09-04 [list runs [list $client {style bold} " - on-site training" {}]] 4] \
    {2026-09-05 {text "<b>Schmidt AG</b> - <u>final acceptance</u> signed" markup tags} 1} \
    [list 2026-09-07 "**Mueller GmbH** - maintenance, covering:\n- minor faults in running operation\n- simple questions by telephone" 2] \
    {2026-09-08 {text "<b>Schmidt AG</b> - support: <ol><li>call logged</li><li>remote session</li></ol>" markup tags} 1.5}] \
    -columns {{width 24} {markup markdown} {width 18 align decimal}}

Lists in a cell, since 1.7. A list item keeps the size and leading of the cell and only moves its lines in by its label, so it is a paragraph in a cell as it is in a block: item bullet and item number, with start and continued, mean in a pair what they mean under text -runs 1, and the notations read them from <ul>, <ol> and <li> under markup tags and from - and 1. under markup markdown. Indent and label are those of flowing text, an item breaks inside its indent, consecutive items of one kind are one list, and the row grows with the lines the items break into, at the cell's one leading. A cell that holds a list is set in one call, from the pairs it was measured with — the indent of a list follows its widest label, which only the whole list knows, and a line set on its own would get a label of its own —; every other cell is set as before and writes the same bytes as in 1.6. In a tagged document the TD or TH holds an L with an LI, Lbl and LBody per item, checked green by veraPDF for PDF/UA-1. The draw hooks see such a cell measured: runs with the pairs, lines with every line of an item carrying the item's {item ...}, hyphens one flag per line as before, and listed set to 1. Refused by name and before anything is drawn: a column narrower than the indent of its list, as text refuses it (TCLPDF TEXT INDENT width), a list in a decimal body column, as a cell of runs is (TCLPDF TABLE CELL decimal), and still a heading, which is a paragraph of its own size while the lines of a cell are one height (TCLPDF TABLE CELL paragraph heading).

Annotations and forms

Sticky notes, stamps, the four ways to mark a passage — highlight, underline, strikeout, squiggly — the five geometry annotations (line, square, circle, polygon, polyline) and a file attachment, each with an appearance the package draws itself, so no reader has to invent one. Interactive form fields of six kinds — text, check box, radio group, push button, list box, combo box — with their appearance streams written here, /NeedAppearances never set, a fillable field's face embedded whole so the recipient can type what the writer never wrote, and every field a structure element under PDF/UA. A field's appearance is set in its own face alone, without the document's fallback chain and without a replacement, so a character that face lacks in a value stays a refusal (TCLPDF FIELD GLYPH) rather than a mark the recipient would type over. An export value, a field name or the chosen state of a check box or radio group made of digits stays the text it was — /V, /DV and /AS agree for 01 as they do for yes. An annotation belongs to a page: inside a form script it is refused, because its rectangle would be in the wrong space.

Tagged, accessible and archivable

A structure tree with the standard types and the 2.0 additions, nesting checked as it is built and refused where ISO/TS 32005 forbids it, artifacts marked as such, alternative text, expansions, structure destinations, /Ref between an element and the one it points at, and a structure script that rolls back what it opened when it fails before it marked anything — and that runs its body in the caller's frame on the first call of a process as on every later one, where a variable set in it used to be lost when that call was the one that loaded the module. PDF/A parts 2 and 3 in the levels B, U and A, with the output intent, the XMP packet and the colour guard that holds every colour space against the intent. PDF/UA-1 and PDF/UA-2, and the WTPDF profile for well-tagged documents; what UA-2 forbids — a Link element with two targets, a footnote without its reference pair, a page destination, a second caption — is refused rather than written. A table cell of runs stays a TD or TH marked as a paragraph of runs is, and a repeated head of runs is a pagination artifact like a plain one — veraPDF reads such a table as PDF/UA-1 over three pages. A cell holding a list carries its L inside the TD, and a list paragraph drawn inside a form, a pattern or a repeated table head leaves no empty L or LI in the structure tree. Every contributor to the XMP packet, PDF/UA, ZUGFeRD and a caller's own extension schema, shares one pdfaExtension:schemas bag, so the combinations validate together; the Info dictionary and the packet say the same text for Keywords, Creator and the creating tool, where a keyword of digits used to differ between the two while veraPDF reported PASS. A packet the caller sets with metadata is checked against entity expansion before tdom parses it, as every other XML the package reads is (TCLPDF XML ENTITY), and then for every schema the document's claims need.

Electronic invoices

ZUGFeRD / Factur-X and Order-X as PDF/A-3B: the ICC profile, the output intent, the XMP extension schema, the embedded XML with its relationship, its modification date and the associated-files entry, all from one call; an XRECHNUNG profile under the name the standard reserves for it. Since 1.8 the invoice may come as bytes, zugferd -data, for one built in memory with no temporary file in between; -date is then required, because there is no file to take a time from and the clock is never stamped in, so the same invoice written twice gives the same bytes — and bytes and date are checked before the PDF/A claim is made (example 05.13). The visible page and the attached XML are the same document, which is the whole point of the format — and the acceptance run reads the attachment back with Mustangproject to prove it.

Reading an existing PDF

One page of a foreign file is taken over as a form and placed as often as wanted — a letterhead is taken over instead of being rebuilt, its layers reach the document's own, and its marked content is stripped so that the page can be a described figure under PDF/UA. Both cross-reference flavours are read, the classic table and cross-reference streams with object streams, hybrid files included, incremental updates followed, every object identified by number and generation, every filter of the standard decoded and refused where its data are not what the encoding allows. A number the file writes with leading zeros is the number without them, under Tcl 8.6 as under Tcl 9 — /Count 011 is eleven pages and /Rotate 090 a quarter turn, where 8.6 used to read octal —, and a field name of digits comes back from pdf fields as written. A finished file is continued by an incremental update, so every byte already in it stays where it is. And what a file says about itself is answered as a dictionary: version, cross-reference flavour, revisions, identifier, encryption, pages and their sizes, the information dictionary, the PDF/A and PDF/UA claims, tagging, form type, output intents, attachments, signatures, certification — with fonts, pages, metadata and the fields of a form as separate calls, because they cost more.

Protection

Encryption with the standard security handler in revision 6 — AES-256 for strings, streams and the file as a whole, the metadata left in the clear on request — in pure Tcl, with no cryptographic library to build. Permissions are named rather than numbered. The deprecated revisions and RC4 are deliberately not offered.

Signatures: an approval signature over the whole file, invisible or with a place on a page and a description a screen reader can announce, signed as the document is written; a certification signature with its permission level; a two-stage road for signing that happens elsewhere and later; and a second signature onto an already signed file as an incremental update, so the first signature keeps the bytes it covers. What is signed comes from outside — a card, an HSM, a signing service, openssl — because that is where a key belongs.

Document timestamps, since 1.4: an RFC 3161 token over every byte of a finished file — signed or not — appended as an incremental update, so a file proves when it existed without anyone having to prove who wrote it. The authority is the caller's choice with a public default: any RFC 3161 service over HTTP or HTTPS, or a command prefix that owns the transport entirely, which is also how the tests run without a network, against a local openssl ts. The reply is verified against the request's own digest and nonce before a byte is written, a stamped PDF/A file stays PDF/A — the acceptance run measures that — and any number of stamps may follow over the years, each covering everything before it: how an archive keeps a signature provable after its certificate expires.

What is deliberately left out

Not everything absent is missing. These are decisions, each with a reason at the feature in the manual:

Left out Why
Object and cross-reference streams for writing they compress the structure, not the content; measured on this package's own documents the gain is a fraction of a percent, and the cost is that the file stops being readable with an editor. Both are read
Linearisation it optimises the first page over a slow network for a reader that fetches byte ranges; it buys nothing for a document that is generated and then sent whole
LZW, CCITT, JBIG2 and JPX as writers every one of them is worse than Flate for what this package produces, and the good ones are patented history. LZW and CCITT are read, which is where they actually occur; JBIG2 and JPX pass through inside an imported page
Progressive JPEG, interlaced PNG PDF has no place for either; they would have to be decoded and re-encoded, which is exactly what the pass-through avoids
TIFF with an alpha channel, tiles, separate planes, BigTIFF a second stage of the TIFF reader that the stock measured did not contain
CalRGB and CalGray Lab covers what a calibrated space is asked for, and an ICC profile covers the rest
CBDT and OpenType SVG colour fonts two more formats for what COLR and sbix already do; the faces that carry them were measured and none of them lacks a COLR or sbix table
Alternate substitution (GSUB type 3) a choice the caller would have to make per glyph, and no face in the stock offers one worth an option
A missing glyph replaced in silence a blank or a box that nothing reports is a document quietly not what was asked for; the default stays the refusal, and a replacement is there on request — font -missing replace, drawn with the original as ActualText and counted by textReplaced
A lenient reading of the notations a fallback without a way back; the strict reading stays strict, and text that people type is made settable by markdown::repair or markup::repair, which escape only the refused places and name every one of them
CSS in an SVG beyond class rules the single-class rule is what exporters write and has been read since 1.8; @-rules, every other selector and !important — which would outrank style="", a priority this package does not keep — are reported by svg info as style
Multimedia, 3D, JavaScript, portfolios not a document, and each of them a security question of its own
Halftones and transfer functions a printer's setting, not a document's
Filling a foreign form reading its fields is there; filling would mean redrawing every appearance with a font the file brings and this package did not embed
Nested lists, and runs that change the size or the colour a list has one level, and a run changes the face and its decorations only: the size belongs to the paragraph, which is what keeps every line one height — a heading changes it as a paragraph of its own
A heading inside a table cell a heading is a paragraph of its own size and leading, while the lines of a cell are one height; refused by name (TCLPDF TABLE CELL paragraph heading), whether written as a pair or read from <h1> or # in the notation. A -didParseCell hook can set its words as a bold line at the cell's size, and a cell holds a list since 1.7
A body cell of runs or a list in a decimal column a decimal column hangs one string on one separator, and a line of pieces has none (TCLPDF TABLE CELL decimal); a head or foot cell of runs over such a column is set flush right like a plain heading
A Link element and Contents for a url run a run writes the annotation only; a tagged document that has to claim PDF/UA sets its links with link and structure Link
Bidirectional text in one call (UAX #9) separate calls cover the address block, which is where mixed writing actually appears; the full algorithm was measured and priced, and the answer was that the stock does not need it
PDF/X there is no validator for it here, and building a promise that the acceptance run cannot measure is worse than not making it
GIF and BMP neither occurs in the stock this package was measured against; TIFF did, and was built
EPS as artwork it is PostScript, and drawing it means interpreting PostScript
Encryption revisions before 6, and RC4 broken, and offering them would invite their use

Where the limits are stated

Every refusal in this package names itself, the thing it refuses and the way out, and carries an error code that a trap can catch — TCLPDF FONT GLYPH, TCLPDF IMPORT, TCLPDF TIFF, TCLPDF COLORFONT, TCLPDF SVG and the rest are a documented contract, listed in the manual under Error codes in a table the source itself generates, fifty-eight topics long. A message quotes what it names up to sixty characters and cuts the rest, so a long word handed to the wrong option no longer fills the screen, while the error code carries it whole. That is the deliberate opposite of writing a file that looks like what was asked for and is not: a missing glyph nobody asked to replace, a colour space the output intent does not admit, a foreign file whose cross-reference chain runs in a circle or whose object stream names another object than its table, a picture that would draw nothing, a loop that would never return, a table cell whose notation was left open, an XML file one parser would have read differently from the other — each stops the call rather than reaching the reader, and stops it before a byte of the stream, a resource or a structure element is written.

Where something is knowingly left as it is, the manual says so beside the feature: how the two-level hyphenation differs from libhyphen's own program in about one German compound in twenty, that a mask whose data fail only while its streams are built leaves the ICC profile of its carrier as an unreferenced object, that of a <style> block in an SVG only the single-class rules are read and the rest is reported, that a fillable field overrides an explicit -subset 1 on its face and never gets the fallback chain or a replacement, that a copied object of a foreign file carries 10 where the file wrote 010, and that a url run keeps a tagged document from claiming PDF/UA. A limit that is named is a limit; one that is not would be a defect.