@qrcommunication/gigapdf-lib 0.116.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,37 @@ 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
+
9
40
  ## [0.116.0] - 2026-07-03
10
41
 
11
42
  ### Fixed — images survived NO JSON-bridged export (html, rtf, epub, md)
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;