@qrcommunication/gigapdf-lib 0.64.0 → 0.66.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,51 @@ All notable changes to `@qrcommunication/gigapdf-lib` are documented here.
4
4
  The format follows [Keep a Changelog](https://keepachangelog.com/) and the
5
5
  project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [0.66.0] - 2026-06-23
8
+
9
+ ### Added
10
+
11
+ - **HTML/CSS rendering — LibreOffice-level fidelity.** `htmlRender` gains real **CSS
12
+ grid** (`fr`/`minmax`/`repeat`/`span`/`auto-rows`) and **complete flexbox**
13
+ (basis/grow/shrink/wrap/justify/align), **multi-column** (`column-count`/`columns`/
14
+ `column-gap`), **pragmatic RTL/bidi** (`direction`/`dir`, RTL block/inline/run
15
+ layout), table fidelity (colspan/rowspan, LibreOffice-level), text styling
16
+ (super/sub, underline, strike), `@media`, font shorthand and further CSS-2 coverage.
17
+ - **Document reconstruction (`structuredText`) — waves R1–R10.** Typed + populated
18
+ `pageBlocks` bodies, merged-cell spans, strikethrough, hyperlinks, paragraph
19
+ spacing, super/subscript, document outline + figure captions, list nesting +
20
+ continuation lines, multi-column reading order, multiple tables per page
21
+ (connected-component split), borderless right/decimal-aligned columns, true
22
+ decimal-tab alignment.
23
+ - **PDF permissions — 8 functional flags.** `getPermissions` + correct `/P` encoding
24
+ of the 8 standard permission bits (print, modify, copy, annotate, fill-forms,
25
+ extract, assemble, high-res print).
26
+ - **Model structural edits.** Table & sheet structural-edit ModelOps.
27
+
28
+ ### OCR (native `gigapdf-ocr-rten` crate — host-side, not bundled in the npm package)
29
+
30
+ - Pivoted the OCR engine to **PaddleOCR PP-OCR on RTen** (pure-Rust ONNX, no C++/
31
+ Tesseract): 13 printed languages incl. our own **Hebrew** model, with automatic
32
+ per-line **script selection**.
33
+ - **Handwriting** recognizer (`latin_hw`) — our own CRNN trained on real handwriting
34
+ (IAM/RIMES/NorHand/…; standard `nn.LSTM` → dynamic-width ONNX), **opt-in** via
35
+ `recognize_page_handwriting` / `recognize_page_with(img, "latin_hw")`.
36
+ - Full OCR documentation refresh (architecture, training data, SDK, cookbook).
37
+
38
+ ## [0.65.0] - 2026-06-22
39
+
40
+ ### Added
41
+
42
+ - **Office→PDF phase-2 fonts** — `officeToPdfWith(office, fonts)` (ABI
43
+ `gp_office_to_pdf_with_fonts`, core `office_to_pdf_with_fonts`) completes the
44
+ two-phase font flow opened by `officeNeededFonts`: hand back the host-fetched
45
+ faces for the families a container **references but doesn't embed** (e.g.
46
+ Carlito for a Calibri reference) and styled runs lay out + paint with the right
47
+ metrics instead of drifting onto the bundled fallback. The supplied faces are
48
+ merged with whatever the document embeds itself — **embedded faces win on
49
+ conflict** — so an empty `fonts` array yields exactly `officeToPdf`'s output
50
+ (no regression). `fonts` uses the same packed blob as `htmlRender`.
51
+
7
52
  ## [0.64.0] - 2026-06-22
8
53
 
9
54
  Office↔PDF fidelity program — import all formats → PDF and export PDF → all
package/dist/index.cjs CHANGED
@@ -281,6 +281,32 @@ var GigaPdfEngine = class _GigaPdfEngine {
281
281
  (p, l) => this._jsonOrNull((o) => this.ex.gp_office_needed_fonts(p, l, o))
282
282
  );
283
283
  }
284
+ /**
285
+ * Phase 2 for {@link officeNeededFonts} — render an Office container to PDF with
286
+ * the host-fetched `fonts` embedded, so families the container **references but
287
+ * doesn't embed** (reported by {@link officeNeededFonts}) lay out with the right
288
+ * metrics (e.g. Carlito for a Calibri reference) instead of drifting onto the
289
+ * bundled fallback. Faces the container embeds itself win on conflict, so an
290
+ * empty `fonts` array yields exactly {@link officeToPdf}'s output. Empty array
291
+ * if the bytes are not a recognized Office container.
292
+ *
293
+ * @example
294
+ * const reqs = giga.officeNeededFonts(docx); // phase 1: what to fetch
295
+ * const fonts = await Promise.all( // host fetches each url → TTF
296
+ * (reqs ?? []).map(async (r) => ({ ...r, ttf: await fetchTtf(r.url) }))
297
+ * );
298
+ * const pdf = giga.officeToPdfWith(docx, fonts); // phase 2: render with them
299
+ */
300
+ officeToPdfWith(office, fonts = []) {
301
+ const blob = packHtmlFonts(fonts);
302
+ return this._withBytes(
303
+ office,
304
+ (op, ol) => this._withBytes(
305
+ blob,
306
+ (fp, fl) => this._buffer((o) => this.ex.gp_office_to_pdf_with_fonts(op, ol, fp, fl, o))
307
+ )
308
+ );
309
+ }
284
310
  /**
285
311
  * Image (PNG/JPEG/GIF/WebP/AVIF) → one-page PDF, format auto-detected: the
286
312
  * image is centred and scaled to fit on an A4 portrait page. PNG/JPEG embed