Repository navigation
v1.7.0 — LTV signatures, charts v2, emoji sequences
pdfnative v1.7.0
Released 2026-08-21
The long-term-validation release. pdfnative now signs PDFs that stay verifiable for decades — the complete PAdES baseline ladder (B-B → B-T → B-LT → B-LTA, ETSI EN 319 142-1) with RFC 3161 timestamps, embedded revocation material and document timestamps, all through injected network providers so the engine itself never opens a socket. Around it: charts v2 (stacked/area/scatter, dual/log/time axes), colour-emoji flag & ZWJ sequences, print production (bleed/trim boxes, printer's marks, /Trapped, /UserUnit), UAX #9 digit-order and glyph-mirroring conformance fixes, PDF/A declaration guards, and a hardening pass over the incremental writer and xref reader. 100% backward-compatible with v1.6.0 — every new capability is a new API or an additive option; existing inputs render byte-identically except where the previous behaviour was outright wrong (reversed RTL digits, unmirrored delimiters, mis-joined Arabic letterforms, per-revision /ID reuse — the Upgrade section lists every deliberate change). Zero runtime dependencies, 2665 tests across 122 files.
Highlights
- PAdES LTV signing, B-B → B-LTA —
signPdfBytesWithTimestamp()(RFC 3161 signature timestamps),addValidationInfo()(/DSS+/VRIwith OCSP/CRL material),addDocumentTimestamp()(/DocTimeStamprevisions), multi-signature flows, andlistSignatures()inspection. Network transport is injected (TimestampProvider/RevocationProvider); a rejected or tampered TSA token is never embedded. New LTV guide. - Charts v2 — stacked bars, area, scatter, secondary right axis, log and UTC-deterministic time scales, per-point data labels, and x-label collision handling (automatic stride +
labelStride/labelRotation, #67). - Colour-emoji sequences — 51 flags + 22 ZWJ sequences render as single COLR ligature glyphs via a GSUB-resolved table and a longest-match pre-pass; anything uncovered degrades to the historical per-codepoint rendering. CLI:
--sequences/--sequence-list(skin-tone forms included). - RTL correctness — digit runs keep logical order in RTL text (UAX #9 I1/I2, #70) and paired delimiters mirror through the full 428-pair
BidiMirroring.txttable (rule L4, #71). The previous behaviour silently produced wrong data — reversed amounts, dates and reference numbers. - PDF/A declaration guards — configurations that would break the declared conformance level (no embedded fonts #69, unembedded AcroForm fonts, DeviceCMYK images) surface a diagnostic:
console.warnonce per code, a customonDiagnosticsink, or a thrown error understrict: true. - Print production — bleed/trim/art/crop page boxes with a one-line
bleedshorthand, crop & registration marks drawn outside the TrimBox,/Trappedwith XMP parity, duplex/tray/page-range/copies print defaults, caller-supplied OutputIntent ICC, and large-format/UserUnit. Byte-identical when unused. New print guide.
Added
- feat(core): PAdES LTV pipeline —
signPdfBytesWithTimestamp(),collectValidationInfo()/embedValidationInfo()/addValidationInfo()(collect online through the injected provider, embed offline and deterministically),addDocumentTimestamp(),listSignatures(),vriKeyForContents(),buildDocTimeStampDict()./VRIentries key by the uppercase-hex SHA-1 of each signature's full/Contentsvalue; an existing/DSSis merged, never replaced. - feat(core): multiple signatures —
addSignaturePlaceholder({ allowMultiple, metadata, docTimeStamp }), thefieldNameselector onsignPdfBytes, and placeholder-baked/Sigmetadata (name,reason,location,contactInfo,signingTime,subFilter). Signed signatures are located by their real ByteRange values and can never be overwritten. - feat(crypto): LTV building blocks — canonical DER
SET OF(derSetOf, X.690 §11.6),derGeneralizedTime, SHA-1 (identification only, never a security digest), RSA SHA-384/512 digest agility, X.509 extension parsing (SKI/AKI, EKU +certHasEku, AIA OCSP/caIssuers URLs, CRL distribution points,ocsp-nocheck), CMSprofile: 'pades'with the ESS signing-certificate-v2 attribute (RFC 5035), CMS unsigned-attribute surgery (parseCmsSignedData,addUnsignedAttribute,buildAttribute— signed bytes untouched, fuzz-tested), RFC 3161 request/response/token handling, OCSP (RFC 6960) and CRL (RFC 5280) builders + parsers, and theTimestampProvider/RevocationProviderregistries. - feat(chart): charts v2 —
stackedBar/stackedBarH/area/scatterkinds, secondary right axis (axis2+ChartSeries.yAxis: 'right'),axis.scale: 'log',xAxis.type: 'linear' | 'time'with UTC-only tick math for byte-stable output, per-pointdataLabels, automatic x-label stride pluslabelStride/labelRotation(#67). Chart kinds 5 → 9; area fills mix toward white instead of using transparency (PDF/A-1b safe). - feat(shaping): colour-emoji flag & ZWJ sequences — GSUB-resolved
sequencestable in the generated module (both VS-16 spellings registered), longest-match pre-pass in the text pipeline, regional indicators routed to sequence-capable fonts, per-codepoint fallback. Bundled: 51 flags (EU, UN, G20 + widely used locales) + 22 skin-tone-free ZWJ sequences; module budget 4096 → 5120 KB (actual 4582 KB, tree-shakeable). CLIpdfnative-build-emoji-font --sequences flags|zwj|all|noneand--sequence-list FR,DE,1F468-200D-1F680. - feat(core): PDF/A declaration guards —
src/core/pdf-diagnostics.tsconformance channel with additivestrict/onDiagnosticlayout options; codesPDFA_NO_FONT_ENTRIES(#69),PDFA_UNEMBEDDED_FORM_FONTandPDFA_DEVICE_CMYK_IMAGE. - feat(core): print production —
layout.printpage boxes (/TrimBox,/BleedBox,/ArtBox,/CropBox, ISO 32000-1 §14.11.2;bleedshorthand; validated within the MediaBox), printer's marks (§14.11.3 — 8 corner crop hairlines + 4 edge registration targets, strictly outside the TrimBox, configurable length/offset/weight),metadata.trapped(/Info /Trapped+pdf:TrappedXMP parity, declared via a PDF/A extension schema per ISO 19005 §6.6.2.3.2 so validators accept it;Unknownmaps to XMP absence per ISO 32000-1 Table 317), print viewer preferences (duplex,pickTrayByPDFSize, 1-basedprintPageRange→ 0-based/PrintPageRange,numCopies),layout.outputIntent(caller-supplied RGB ICC profile + condition strings under tagged modes; non-RGB profiles rejected with an actionable message), andprint.userUnitfor large formats (header raised to%PDF-1.7only when set; rejected underpdfa1b). Boxes and/UserUnitnow survivemergePdfs/splitPdf/extractPages(previously dropped). Byte-identical output when unused. - feat(parser):
PdfModifier.updateMetadata()— re-issues/Info(adding/ModDate) and keeps the XMP packet in sync (xmp:ModifyDate=xmp:MetadataDate, CreateDate andpdfaid:*preserved) per ISO 19005 §6.7.3 parity;PdfParams.metadataforwards author/subject/keywords to both/Infoand XMP inbuildPDF. - feat(samples):
signature-ltv(PAdES B-B/B-T/B-LT/B-LTA + multi-signature, offline mock PKI),charts-v2-showcase, colour-emoji sequences page,incremental-metadata, BiDi digits & mirroring page, andpersian-showcase(Persian joining, digits and mirrored delimiters) andprint-showcase(bleed + marks, explicit boxes, large-format banner, custom OutputIntent) — sample corpus 228 → 242 PDFs across 48 generators. - feat(validation): PDF/A validation hardening —
npm run validate:pdfaauto-detects everypdfaid:part-claiming sample (18 PDF/A-claiming samples today) and now enforces a coverage canary againstdeclared.pdfaSamplesindocs/assets/ecosystem.json; CI validates with a pinned veraPDF (1.30.2) and the publish workflow re-runs docs verification, sample generation and the blocking PDF/A gate beforenpm publish;verify:docsgains a 17th rule (playground-syntax: every inline playground/homepage module script must parse undernode --check). CONTRIBUTING documents the local veraPDF setup for all three OSes, Windows.batlaunchers included. - chore(meta):
THIRD-PARTY-NOTICES.mdaggregates the third-party licenses (Noto fonts — SIL OFL 1.1; Unicode Character Database — Unicode License v3) and ships in the npm package; the projectLICENSEstays pure MIT.
Changed
- chore(meta): documentation single-source-of-truth —
docs/assets/ecosystem.json+ the 17-rulenpm run verify:docsverifier (weekly--onlinenpm-drift job in CI), international SEO head block on every indexable page, and the full documentation-alignment train staged since v1.6.0 (see CHANGELOG for the per-file record). - chore(crypto): CMS signed attributes now encode in canonical X.690 §11.6 order in both profiles — the previous fixed order was technically DER-invalid (tolerated by validators); signature bytes change, semantics do not.
Fixed
- fix(shaping): Arabic ALEF joining and Persian letter forms — ALEF is now right-joining per UCD (a joining-range bug classed it dual-joining, corrupting every word with a non-final alef: سال، كتاب، السلام), and the presentation-form table gains the Forms-A entries for the Persian/Urdu letters (پ چ ژ ک گ ی …) that previously rendered isolated in every position. The bundled font always had every form; the shaper never requested them. Arabic visual baselines regenerated.
- fix(shaping): RTL digit runs no longer character-reverse — UAX #9 I1/I2 even embedding levels for AN/EN in both paragraph directions; U+06F0–U+06F9 corrected from AN to EN per DerivedBidiClass; L2 rewritten run-based (#70). The affected class is silently-wrong data: amounts, dates and reference numbers in Persian, Arabic and Hebrew documents.
- fix(shaping): UAX #9 rule L4 glyph mirroring — odd-level runs substitute paired delimiters through the full 428-pair
BidiMirroring.txttable (Unicode 17.0.0, generated module): logical(X)no longer renders)X(around RTL content (#71). - fix(parser): incremental writer & xref reader conformance hardening — per-revision trailer
/ID(ID[0] preserved byte-exact, ID[1] regenerated deterministically, ISO 32000-1 §14.4); explicit integrity error on a present-but-invalid/Previnstead of silent chain truncation;/DecodeParms /Predictorsupport in xref streams; EOL framing after a bare%%EOF;/Sizerecovery from the xref's highest entry. - fix(core): complete base-14
/ToUnicodecoverage in both builders — base-14 dicts reached under tagged mode, and the AcroForm/Helvdict in every mode; cmap inversion keeps a legitimately-mapped U+0000. - fix(fonts): COLRv1
PaintCompositedegradation — an unsupported SOURCE subtree renders its backdrop alone instead of dropping the whole glyph (Noto's flags render flat instead of falling back to tofu). - fix(docs): the signatures guide described a multiple-signature flow the code prevented, and claimed RFC 3161 was unsupported; both corrected (see Documentation).
- fix(scripts):
validate:pdfanow works on Windows — the veraPDF.batlauncher is spawned through a shell with quoted arguments (Node's CVE-2024-27980 hardening rejects direct batch spawns; the swallowed error previously reported every sample as non-compliant). 18/18 PDF/A-claiming samples validate locally.
Documentation
- docs(guides): new Long-term validation guide (guide count 26 → 28); signatures, charts, PDF/A, colour-emoji (+ CLI) and troubleshooting guides updated for every v1.7.0 capability; README highlights, API reference and comparison table refreshed.
- docs(meta): ROADMAP — Charts v2, colour-emoji sequences, LTV, PDF/A guards, RTL conformance and the incremental hardening pass moved to Released.
Install
npm install pdfnative@1.7.0Upgrade
No breaking changes. Drop-in replacement for v1.6.0. A few deliberate behaviour changes to be aware of:
- RTL text: digit runs now keep logical order, paired delimiters mirror, ALEF joins correctly (right-joining) and Persian letters take their positional forms — every Arabic-script document renders differently, and correctly; documents that depended on the previous (non-conformant) rendering will differ.
- Charts: the x-label collision fix is default-on — a chart whose labels previously overlapped now draws every Nth label. Non-overlapping charts are byte-identical;
labelStride: 1restores the old draw-everything behaviour. - Form documents: the AcroForm
/Helvfont dictionary now carries/ToUnicodein every mode (form text becomes searchable/extractable), so all form-carrying outputs change bytes (+~20 bytes in non-tagged mode, structure unchanged; tagged form documents additionally gain the shared CMap object). - Tagged documents on base-14 fonts: a tagged/PDF-A document with no embedded
fontEntries(Latin text rendered through standard-14 Helvetica) now emits the shared WinAnsi/ToUnicodeCMap that tagged mode previously suppressed — bytes and object numbering change. Tagged documents with embedded fonts (CIDFont-only) stay byte-identical. The same configuration now also surfaces aPDFA_NO_FONT_ENTRIESdiagnostic (console.warnonce per code where v1.6.0 was silent; redirect withonDiagnostic, escalate withstrict: true— output bytes are unaffected by the diagnostic itself). - Incremental updates: revisions regenerate
/ID[1]per ISO 32000-1 §14.4 (/ID[0]stays byte-exact), and an EOL is inserted before the appended revision when the base document ends without one — every incremental output (placeholders, signatures, modifier saves) changes bytes; earlier revisions are still preserved verbatim as a prefix. - CMS signatures: signature bytes change (canonical DER attribute order, X.690 §11.6); signatures remain valid and verifiable.
- TypeScript: implementers of the
PdfModifierinterface (as opposed to consumers ofcreateModifier()) must add the newupdateMetadatamethod; theChartTypeandSignatureAlgorithmunions widened, which can surface errors in downstream exhaustive switches.
Downstream integration notes
- New public APIs (see Added) are additive;
pdfnative-clican wiresign --timestampontosignPdfBytesWithTimestamp()and itsverify --revocationpath can now consume/DSSwritten by the library. pdfnative-mcpadd_chartpasses through the new chart options unchanged (all JSON-serialisable).ChartTypewidened 5 → 9 — narrowing switch statements over it in downstream code will see new variants.- The generated colour-emoji module gains a
sequencesexport; older pdfnative runtimes ignore it, older modules remain valid (FontData.sequencesis optional).