@qrcommunication/gigapdf-lib 0.115.0 → 0.117.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
@@ -6,6 +6,67 @@ project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.117.0] - 2026-07-04
10
+
11
+ Exhaustive two-way fidelity release (see the root
12
+ [`CHANGELOG.md`](../CHANGELOG.md) for the full engine-level detail).
13
+
14
+ ### Added
15
+ - `htmlToPdf(html, options?)` — optional page size, margins, header/footer and
16
+ `landscape`; `htmlRenderWith` documented as the canonical configurable path.
17
+ - New model types surfaced on `pageBlocks` / structured output:
18
+ `direction` (RTL), `footnotes` + `FootnoteRef`, per-level list styles
19
+ (`levels`) and `marker_prefix`, per-cell table borders (`GigaParaBorder`),
20
+ image `size_pt` + `crop`, sheet `freeze`, cell `rotation_deg` + `diagonal`,
21
+ gradient fills (`GigaGradient`) + `shadow` (`GigaShadow`), first-page /
22
+ even-odd section headers, multi-column geometry, extended character styles
23
+ (caps, small-caps, double-strike, baseline shift, char scale, kerning),
24
+ `LinkTarget::Anchor` / `Other`, paragraph `soft_breaks`, `indent_left_pt` /
25
+ `space_before_pt`, `page_break_before`.
26
+ - Office→PDF can emit a tagged `/StructTreeRoot` (opt-in; default off while the
27
+ tag-tree list-marker fidelity is finalized).
28
+
29
+ ### Fixed
30
+ - `modelToPdf` now draws images and renders full Unicode (routed through the
31
+ rich model→HTML→PDF renderer instead of the WinAnsi std-14 path).
32
+ - Chart data labels (`c:dLbls`) parsed and rendered as extractable text.
33
+ - The JSON reader accepts exact u64 image-resource ids (pre-0.116 dumps).
34
+
35
+ ### Changed
36
+ - `GigaImageRef.resource` stays `string | number`; `PageBlockGroup` and the
37
+ paragraph-style shape carry the new optional fields above (all additive —
38
+ existing consumers are unaffected).
39
+
40
+ ## [0.116.0] - 2026-07-03
41
+
42
+ ### Fixed — images survived NO JSON-bridged export (html, rtf, epub, md)
43
+
44
+ `ImageRef.resource` — the u64 content hash keying `resources.images` — was
45
+ serialized as a **raw JSON number**. JavaScript rounds integers beyond 2^53,
46
+ so any host round-tripping the model through JSON (`toModel()` →
47
+ `modelToHtml`/`modelToRtf`/`modelToEpub`/`modelToMarkdown`) corrupted every
48
+ image id and the resource lookup failed silently: **zero images** in HTML/RTF
49
+ output, EPUB packages with orphaned (unreferenced) images, wrong Markdown
50
+ file names. The id is now serialized as a **string** (the Rust reader accepts
51
+ both forms, so older JSON still loads). A pitch deck went from 0 to 37 images
52
+ in HTML, RTF and EPUB exports. Direct exports (`toDocx`…) were unaffected.
53
+
54
+ ### Changed — PDF→XLSX/ODS export through the reconstructed model
55
+
56
+ `toXlsx()`/`toOds()` used a legacy glyph-grid path that dropped text runs the
57
+ model keeps (names, dates, reference numbers measurably missing on a real
58
+ letter) and produced untyped, unstyled grids. They now export through
59
+ `reconstruct_model` like every other format: typed tables with merged cells
60
+ (`col_span`), bold header rows and shading — and when a PDF has no
61
+ spreadsheet blocks, a worksheet is synthesized per page from the model
62
+ (tables as real rows/cells, paragraphs/headings/lists as reading-order
63
+ rows). The grid writer stays available for host-provided grids
64
+ (`gridsToXlsx`).
65
+
66
+ ### SDK
67
+
68
+ - `GigaImageRef.resource` is typed `string | number` (canonical: string).
69
+
9
70
  ## [0.115.0] - 2026-07-03
10
71
 
11
72
  Fidelity release across the whole conversion matrix, both directions —
package/dist/index.cjs CHANGED
@@ -344,7 +344,24 @@ var GigaPdfEngine = class _GigaPdfEngine {
344
344
  txtToPdf(text) {
345
345
  return this._withStr(text, (p, l) => this._buffer((o) => this.ex.gp_txt_to_pdf(p, l, o)));
346
346
  }
347
- htmlToPdf(html) {
347
+ /**
348
+ * HTML → PDF. With no `options` this is the fixed US-Letter portrait / 0.5in
349
+ * path (byte-for-byte unchanged). Pass `options` — a named/explicit page size,
350
+ * `landscape`, per-side `margin`, or a running `header`/`footer` — to configure
351
+ * the page; that route delegates to {@link GigaPdfEngine.htmlRenderWith}, the
352
+ * canonical rich path (use it directly for embedded fonts, host-fetched images,
353
+ * or `{{page}}`/`{{pages}}` tokens). External `<img>`/font URLs are omitted here
354
+ * (no host fetch); supply them through `htmlRenderWith`.
355
+ *
356
+ * ```ts
357
+ * const a4 = giga.htmlToPdf(html); // 612×792
358
+ * const land = giga.htmlToPdf(html, { pageSize: "A4", landscape: true });
359
+ * ```
360
+ */
361
+ htmlToPdf(html, options) {
362
+ if (options && Object.keys(options).length > 0) {
363
+ return this.htmlRenderWith(html, [], options);
364
+ }
348
365
  return this._withStr(html, (p, l) => this._buffer((o) => this.ex.gp_html_to_pdf(p, l, o)));
349
366
  }
350
367
  rtfToPdf(rtf) {
@@ -694,6 +711,9 @@ var GigaPdfEngine = class _GigaPdfEngine {
694
711
  pw = sz.w;
695
712
  ph = sz.h;
696
713
  }
714
+ if (options.landscape && ph > pw) {
715
+ [pw, ph] = [ph, pw];
716
+ }
697
717
  const m = options.margin ?? 36;
698
718
  const mg = typeof m === "number" ? { top: m, right: m, bottom: m, left: m } : { top: m.top ?? 36, right: m.right ?? 36, bottom: m.bottom ?? 36, left: m.left ?? 36 };
699
719
  const headerOffset = options.headerOffset ?? 18;