@qrcommunication/gigapdf-lib 0.58.3 → 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 +80 -0
- package/dist/index.cjs +47 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +47 -2
- package/dist/index.js.map +1 -1
- package/gigapdf.wasm +0 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,86 @@ 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
|
+
|
|
42
|
+
## [0.59.0] - 2026-06-21
|
|
43
|
+
|
|
44
|
+
### Added — Universal font decoding (text extraction matches Adobe, zero OCR)
|
|
45
|
+
|
|
46
|
+
A per-font `code → Unicode` resolver, built once at font setup via the full
|
|
47
|
+
ISO 32000 §9.10 priority chain, now covers the real-world font matrix that made
|
|
48
|
+
`textElements()`/`structuredText()` emit `�` or dingbats before:
|
|
49
|
+
|
|
50
|
+
- **Standard Macintosh Glyph Ordering** — `/gNN` glyph names (in `/Differences`
|
|
51
|
+
and via CID GID) resolve through the 258 standard Mac glyph names
|
|
52
|
+
(`g49`→`N`, `g106`→`agrave`→`à`). This is how Adobe reads subset fonts that
|
|
53
|
+
**MuPDF and poppler drop** to `�`.
|
|
54
|
+
- **Type1C (CFF) simple fonts** without `/ToUnicode` — fall back on the embedded
|
|
55
|
+
**CFF charset** (`code → gid → SID → name → Unicode`), recovering accents
|
|
56
|
+
(`à/è/ê/ç`) that were `�`.
|
|
57
|
+
- **AGL ligature names** `f_l`→`fl`, `f_i`→`fi`, `f_f_i`→`ffi` (recursive).
|
|
58
|
+
- **`/ToUnicode` CMap** (bfchar/bfrange, UTF-16BE, multi-char), **CID cmap/post**,
|
|
59
|
+
**named/embedded CMaps**, base encodings (WinAnsi/MacRoman/Standard), digit
|
|
60
|
+
names. Unmapped codes emit **nothing** (like Adobe), never an invented letter
|
|
61
|
+
or a control char.
|
|
62
|
+
|
|
63
|
+
### Added — Coloured text extraction via named colour spaces
|
|
64
|
+
|
|
65
|
+
`textElements()` now resolves `/Separation`, `/ICCBased`, `/Indexed`, `/DeviceN`
|
|
66
|
+
fill colours (running the tint transform) for text, reusing the rasteriser's
|
|
67
|
+
`NamedColorResolver`. Text painted via `cs`/`sc`/`scn` is no longer reported as
|
|
68
|
+
black `[0,0,0]`.
|
|
69
|
+
|
|
70
|
+
### Added — Right-to-left (Hebrew/Arabic) logical order
|
|
71
|
+
|
|
72
|
+
RTL runs extracted in visual order are reordered to logical Unicode order
|
|
73
|
+
(`direction:"rtl"`), guarded against double-reversal via Hebrew final-form
|
|
74
|
+
position. `"רצואה / לארשי תנידמ"` → `"מדינת ישראל / האוצר"`.
|
|
75
|
+
|
|
76
|
+
### Fixed — AcroForm text-field appearance (`/AP`)
|
|
77
|
+
|
|
78
|
+
`setTextField()`/`setChoice()` now regenerate the widget's `/AP /N` appearance
|
|
79
|
+
stream (iterating `/Kids` widgets), honouring `/DA` (font size + colour) and
|
|
80
|
+
`/Q` quadding, so filled values render natively and in Adobe.
|
|
81
|
+
|
|
82
|
+
### Fixed — Split-word run joining
|
|
83
|
+
|
|
84
|
+
Adjacent runs on a line are joined unless separated by a real horizontal gap
|
|
85
|
+
(`"N om et adresse"` → `"Nom et adresse"`, `"ENFANT S"` → `"ENFANTS"`).
|
|
86
|
+
|
|
7
87
|
## [0.58.3] - 2026-06-21
|
|
8
88
|
|
|
9
89
|
### Fixed
|
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,
|