@qrcommunication/gigapdf-lib 0.59.0 → 0.60.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,41 @@ 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.60.0] - 2026-06-22
8
+
9
+ ### Added
10
+
11
+ - **`pageBlocks(page)`** — per-page layout blocks (paragraphs, headings, tables,
12
+ lists, columns) in reading order, each run carrying its `source_index` for
13
+ lossless editing. Surfaces the existing `recon/` reconstruction pipeline
14
+ (until now whole-document only, via `toModel()`) one page at a time, for
15
+ continuous / lazily-virtualised editors. Routes through form XObject text so
16
+ cerfa / invoice template text is reconstructed into blocks too.
17
+ - **Base-14 standard fonts in the rasterizer** — `renderPage` now draws the
18
+ standard 14 fonts (Helvetica / Arial / Times / Courier / Symbol /
19
+ ZapfDingbats) via a bundled metric-compatible face, **in memory only**
20
+ (nothing is written to the PDF). Authoritative Symbol + ZapfDingbats
21
+ `code → Unicode` tables (e.g. ZapfDingbats `0x34` → U+2714 ✔, not the digit).
22
+
23
+ ### Changed
24
+
25
+ - **Form-field appearances reference the field's `/DA` standard font** (e.g.
26
+ `/Helv`) instead of injecting a bundled font resource into the PDF. Filling a
27
+ text field adds **no** font to the document; Adobe draws the standard font
28
+ natively. A `/DA` font missing from `/DR` is registered as a bare base-14
29
+ `/Type1` dict (no `FontFile`), exactly what a clean AcroForm carries.
30
+
31
+ ### Fixed
32
+
33
+ - Embedded **Type1 / CFF subsets with a base-14 BaseFont** (e.g. `Times-Bold`)
34
+ now render — they were drawn as `.notdef` (invisible) because the base-14
35
+ substitution was applied even when the font embeds its own program. The
36
+ substitute is now used only when no program is embedded.
37
+ - Glyph advances honour the PDF **`/Widths`** (`/W` + `/DW`, or `/Widths` +
38
+ `/FirstChar`) authoritatively per ISO 32000-1 §9.2.4; the embedded-font
39
+ advance is the fallback. Fixes collapsed / overlapping words on subset fonts
40
+ whose charstring advances are degenerate.
41
+
7
42
  ## [0.59.0] - 2026-06-21
8
43
 
9
44
  ### Added — Universal font decoding (text extraction matches Adobe, zero OCR)
package/dist/index.cjs CHANGED
@@ -36,7 +36,21 @@ var OCR_MODEL_FILES = {
36
36
  tamil: "ocr_taml.gpocr",
37
37
  cjk: "ocr_cjk.gpocr",
38
38
  japanese: "ocr_jpn.gpocr",
39
- korean: "ocr_kor.gpocr"
39
+ korean: "ocr_kor.gpocr",
40
+ thai: "ocr_thai.gpocr",
41
+ telugu: "ocr_telu.gpocr",
42
+ kannada: "ocr_kann.gpocr",
43
+ malayalam: "ocr_mlym.gpocr",
44
+ gujarati: "ocr_gujr.gpocr",
45
+ gurmukhi: "ocr_guru.gpocr",
46
+ oriya: "ocr_orya.gpocr",
47
+ sinhala: "ocr_sinh.gpocr",
48
+ georgian: "ocr_geor.gpocr",
49
+ armenian: "ocr_armn.gpocr",
50
+ khmer: "ocr_khmr.gpocr",
51
+ lao: "ocr_laoo.gpocr",
52
+ myanmar: "ocr_mymr.gpocr",
53
+ amharic: "ocr_ethi.gpocr"
40
54
  };
41
55
  var ALL_OCR_SCRIPTS = [
42
56
  "alpha",
@@ -46,7 +60,21 @@ var ALL_OCR_SCRIPTS = [
46
60
  "tamil",
47
61
  "cjk",
48
62
  "japanese",
49
- "korean"
63
+ "korean",
64
+ "thai",
65
+ "telugu",
66
+ "kannada",
67
+ "malayalam",
68
+ "gujarati",
69
+ "gurmukhi",
70
+ "oriya",
71
+ "sinhala",
72
+ "georgian",
73
+ "armenian",
74
+ "khmer",
75
+ "lao",
76
+ "myanmar",
77
+ "amharic"
50
78
  ];
51
79
  var GigaPdfEngine = class _GigaPdfEngine {
52
80
  constructor(ex) {
@@ -944,6 +972,23 @@ var GigaPdfDoc = class {
944
972
  structuredText(page) {
945
973
  return this.g._json((o) => this.ex().gp_structured_text_json(this.h, page, o));
946
974
  }
975
+ /**
976
+ * The **layout blocks** of a single page — the structural reconstruction
977
+ * (paragraphs, headings, lists, tables, shapes, images) of the page's flat
978
+ * glyph/path geometry, in reading order (column-major), each {@link GigaBlock}
979
+ * keeping a top-down `frame` and every text run its `source_index` back to the
980
+ * editable content-stream operator.
981
+ *
982
+ * The **per-page** counterpart of {@link GigaPdfDoc.toModel} (which
983
+ * reconstructs the whole document at once): a continuous / lazily-virtualized
984
+ * editor calls this one page at a time. Identifies 1- and 2-column layouts,
985
+ * merges lines into justified/left/centred/right paragraphs, promotes large
986
+ * isolated lines to headings, and recovers ruled tables. An out-of-range page
987
+ * yields `[]`.
988
+ */
989
+ pageBlocks(page) {
990
+ return this.g._json((o) => this.ex().gp_page_blocks_json(this.h, page, o));
991
+ }
947
992
  search(query, caseInsensitive = true) {
948
993
  return this.g._withStr(
949
994
  query,