Skip to content

v1.7.0 — LTV signatures, charts v2, emoji sequences

Choose a tag to compare

@Nizoka Nizoka released this 21 Aug 18:58
· 7 commits to main since this release
ae2785e

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 + /VRI with OCSP/CRL material), addDocumentTimestamp() (/DocTimeStamp revisions), multi-signature flows, and listSignatures() 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.txt table (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.warn once per code, a custom onDiagnostic sink, or a thrown error under strict: true.
  • Print production — bleed/trim/art/crop page boxes with a one-line bleed shorthand, crop & registration marks drawn outside the TrimBox, /Trapped with 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(). /VRI entries key by the uppercase-hex SHA-1 of each signature's full /Contents value; an existing /DSS is merged, never replaced.
  • feat(core): multiple signatures — addSignaturePlaceholder({ allowMultiple, metadata, docTimeStamp }), the fieldName selector on signPdfBytes, and placeholder-baked /Sig metadata (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), CMS profile: '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 the TimestampProvider / RevocationProvider registries.
  • feat(chart): charts v2 — stackedBar / stackedBarH / area / scatter kinds, secondary right axis (axis2 + ChartSeries.yAxis: 'right'), axis.scale: 'log', xAxis.type: 'linear' | 'time' with UTC-only tick math for byte-stable output, per-point dataLabels, automatic x-label stride plus labelStride / 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 sequences table 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). CLI pdfnative-build-emoji-font --sequences flags|zwj|all|none and --sequence-list FR,DE,1F468-200D-1F680.
  • feat(core): PDF/A declaration guards — src/core/pdf-diagnostics.ts conformance channel with additive strict / onDiagnostic layout options; codes PDFA_NO_FONT_ENTRIES (#69), PDFA_UNEMBEDDED_FORM_FONT and PDFA_DEVICE_CMYK_IMAGE.
  • feat(core): print production — layout.print page boxes (/TrimBox, /BleedBox, /ArtBox, /CropBox, ISO 32000-1 §14.11.2; bleed shorthand; 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:Trapped XMP parity, declared via a PDF/A extension schema per ISO 19005 §6.6.2.3.2 so validators accept it; Unknown maps to XMP absence per ISO 32000-1 Table 317), print viewer preferences (duplex, pickTrayByPDFSize, 1-based printPageRange → 0-based /PrintPageRange, numCopies), layout.outputIntent (caller-supplied RGB ICC profile + condition strings under tagged modes; non-RGB profiles rejected with an actionable message), and print.userUnit for large formats (header raised to %PDF-1.7 only when set; rejected under pdfa1b). Boxes and /UserUnit now survive mergePdfs/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 and pdfaid:* preserved) per ISO 19005 §6.7.3 parity; PdfParams.metadata forwards author/subject/keywords to both /Info and XMP in buildPDF.
  • 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, and persian-showcase (Persian joining, digits and mirrored delimiters) and print-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:pdfa auto-detects every pdfaid:part-claiming sample (18 PDF/A-claiming samples today) and now enforces a coverage canary against declared.pdfaSamples in docs/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 before npm publish; verify:docs gains a 17th rule (playground-syntax: every inline playground/homepage module script must parse under node --check). CONTRIBUTING documents the local veraPDF setup for all three OSes, Windows .bat launchers included.
  • chore(meta): THIRD-PARTY-NOTICES.md aggregates the third-party licenses (Noto fonts — SIL OFL 1.1; Unicode Character Database — Unicode License v3) and ships in the npm package; the project LICENSE stays pure MIT.

Changed

  • chore(meta): documentation single-source-of-truth — docs/assets/ecosystem.json + the 17-rule npm run verify:docs verifier (weekly --online npm-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.txt table (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 /Prev instead of silent chain truncation; /DecodeParms /Predictor support in xref streams; EOL framing after a bare %%EOF; /Size recovery from the xref's highest entry.
  • fix(core): complete base-14 /ToUnicode coverage in both builders — base-14 dicts reached under tagged mode, and the AcroForm /Helv dict in every mode; cmap inversion keeps a legitimately-mapped U+0000.
  • fix(fonts): COLRv1 PaintComposite degradation — 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:pdfa now works on Windows — the veraPDF .bat launcher 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.0

Upgrade

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: 1 restores the old draw-everything behaviour.
  • Form documents: the AcroForm /Helv font dictionary now carries /ToUnicode in 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 /ToUnicode CMap 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 a PDFA_NO_FONT_ENTRIES diagnostic (console.warn once per code where v1.6.0 was silent; redirect with onDiagnostic, escalate with strict: 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 PdfModifier interface (as opposed to consumers of createModifier()) must add the new updateMetadata method; the ChartType and SignatureAlgorithm unions widened, which can surface errors in downstream exhaustive switches.

Downstream integration notes

  • New public APIs (see Added) are additive; pdfnative-cli can wire sign --timestamp onto signPdfBytesWithTimestamp() and its verify --revocation path can now consume /DSS written by the library.
  • pdfnative-mcp add_chart passes through the new chart options unchanged (all JSON-serialisable).
  • ChartType widened 5 → 9 — narrowing switch statements over it in downstream code will see new variants.
  • The generated colour-emoji module gains a sequences export; older pdfnative runtimes ignore it, older modules remain valid (FontData.sequences is optional).

Links