@qrcommunication/gigapdf-lib 0.59.0 → 0.61.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/dist/index.d.cts CHANGED
@@ -33,7 +33,7 @@ type Exports = {
33
33
  * for an absent blob instead of throwing, so listing them in
34
34
  * {@link ALL_OCR_SCRIPTS} stays safe.
35
35
  */
36
- type OcrScript = "alpha" | "arabic" | "devanagari" | "bengali" | "tamil" | "cjk" | "japanese" | "korean";
36
+ type OcrScript = "alpha" | "arabic" | "devanagari" | "bengali" | "tamil" | "cjk" | "japanese" | "korean" | "thai" | "telugu" | "kannada" | "malayalam" | "gujarati" | "gurmukhi" | "oriya" | "sinhala" | "georgian" | "armenian" | "khmer" | "lao" | "myanmar" | "amharic";
37
37
  /** Every trained script — load all for "recognize text in any language". */
38
38
  declare const ALL_OCR_SCRIPTS: readonly OcrScript[];
39
39
  /** Loaded engine module. Create documents with {@link open} / {@link openEncrypted}. */
@@ -1010,6 +1010,21 @@ declare class GigaPdfDoc {
1010
1010
  */
1011
1011
  vectorPaths(page: number): VectorPathInfo[];
1012
1012
  structuredText(page: number): TextLine[];
1013
+ /**
1014
+ * The **layout blocks** of a single page — the structural reconstruction
1015
+ * (paragraphs, headings, lists, tables, shapes, images) of the page's flat
1016
+ * glyph/path geometry, in reading order (column-major), each {@link GigaBlock}
1017
+ * keeping a top-down `frame` and every text run its `source_index` back to the
1018
+ * editable content-stream operator.
1019
+ *
1020
+ * The **per-page** counterpart of {@link GigaPdfDoc.toModel} (which
1021
+ * reconstructs the whole document at once): a continuous / lazily-virtualized
1022
+ * editor calls this one page at a time. Identifies 1- and 2-column layouts,
1023
+ * merges lines into justified/left/centred/right paragraphs, promotes large
1024
+ * isolated lines to headings, and recovers ruled tables. An out-of-range page
1025
+ * yields `[]`.
1026
+ */
1027
+ pageBlocks(page: number): GigaBlock[];
1013
1028
  search(query: string, caseInsensitive?: boolean): SearchHit[];
1014
1029
  /** OCR a (scanned) page → words with PDF-space boxes. `scale` ≥ 2 for small text. */
1015
1030
  ocr(page: number, scale?: number): OcrWord[];
package/dist/index.d.ts CHANGED
@@ -33,7 +33,7 @@ type Exports = {
33
33
  * for an absent blob instead of throwing, so listing them in
34
34
  * {@link ALL_OCR_SCRIPTS} stays safe.
35
35
  */
36
- type OcrScript = "alpha" | "arabic" | "devanagari" | "bengali" | "tamil" | "cjk" | "japanese" | "korean";
36
+ type OcrScript = "alpha" | "arabic" | "devanagari" | "bengali" | "tamil" | "cjk" | "japanese" | "korean" | "thai" | "telugu" | "kannada" | "malayalam" | "gujarati" | "gurmukhi" | "oriya" | "sinhala" | "georgian" | "armenian" | "khmer" | "lao" | "myanmar" | "amharic";
37
37
  /** Every trained script — load all for "recognize text in any language". */
38
38
  declare const ALL_OCR_SCRIPTS: readonly OcrScript[];
39
39
  /** Loaded engine module. Create documents with {@link open} / {@link openEncrypted}. */
@@ -1010,6 +1010,21 @@ declare class GigaPdfDoc {
1010
1010
  */
1011
1011
  vectorPaths(page: number): VectorPathInfo[];
1012
1012
  structuredText(page: number): TextLine[];
1013
+ /**
1014
+ * The **layout blocks** of a single page — the structural reconstruction
1015
+ * (paragraphs, headings, lists, tables, shapes, images) of the page's flat
1016
+ * glyph/path geometry, in reading order (column-major), each {@link GigaBlock}
1017
+ * keeping a top-down `frame` and every text run its `source_index` back to the
1018
+ * editable content-stream operator.
1019
+ *
1020
+ * The **per-page** counterpart of {@link GigaPdfDoc.toModel} (which
1021
+ * reconstructs the whole document at once): a continuous / lazily-virtualized
1022
+ * editor calls this one page at a time. Identifies 1- and 2-column layouts,
1023
+ * merges lines into justified/left/centred/right paragraphs, promotes large
1024
+ * isolated lines to headings, and recovers ruled tables. An out-of-range page
1025
+ * yields `[]`.
1026
+ */
1027
+ pageBlocks(page: number): GigaBlock[];
1013
1028
  search(query: string, caseInsensitive?: boolean): SearchHit[];
1014
1029
  /** OCR a (scanned) page → words with PDF-space boxes. `scale` ≥ 2 for small text. */
1015
1030
  ocr(page: number, scale?: number): OcrWord[];
package/dist/index.js CHANGED
@@ -14,7 +14,21 @@ var OCR_MODEL_FILES = {
14
14
  tamil: "ocr_taml.gpocr",
15
15
  cjk: "ocr_cjk.gpocr",
16
16
  japanese: "ocr_jpn.gpocr",
17
- korean: "ocr_kor.gpocr"
17
+ korean: "ocr_kor.gpocr",
18
+ thai: "ocr_thai.gpocr",
19
+ telugu: "ocr_telu.gpocr",
20
+ kannada: "ocr_kann.gpocr",
21
+ malayalam: "ocr_mlym.gpocr",
22
+ gujarati: "ocr_gujr.gpocr",
23
+ gurmukhi: "ocr_guru.gpocr",
24
+ oriya: "ocr_orya.gpocr",
25
+ sinhala: "ocr_sinh.gpocr",
26
+ georgian: "ocr_geor.gpocr",
27
+ armenian: "ocr_armn.gpocr",
28
+ khmer: "ocr_khmr.gpocr",
29
+ lao: "ocr_laoo.gpocr",
30
+ myanmar: "ocr_mymr.gpocr",
31
+ amharic: "ocr_ethi.gpocr"
18
32
  };
19
33
  var ALL_OCR_SCRIPTS = [
20
34
  "alpha",
@@ -24,7 +38,21 @@ var ALL_OCR_SCRIPTS = [
24
38
  "tamil",
25
39
  "cjk",
26
40
  "japanese",
27
- "korean"
41
+ "korean",
42
+ "thai",
43
+ "telugu",
44
+ "kannada",
45
+ "malayalam",
46
+ "gujarati",
47
+ "gurmukhi",
48
+ "oriya",
49
+ "sinhala",
50
+ "georgian",
51
+ "armenian",
52
+ "khmer",
53
+ "lao",
54
+ "myanmar",
55
+ "amharic"
28
56
  ];
29
57
  var GigaPdfEngine = class _GigaPdfEngine {
30
58
  constructor(ex) {
@@ -922,6 +950,23 @@ var GigaPdfDoc = class {
922
950
  structuredText(page) {
923
951
  return this.g._json((o) => this.ex().gp_structured_text_json(this.h, page, o));
924
952
  }
953
+ /**
954
+ * The **layout blocks** of a single page — the structural reconstruction
955
+ * (paragraphs, headings, lists, tables, shapes, images) of the page's flat
956
+ * glyph/path geometry, in reading order (column-major), each {@link GigaBlock}
957
+ * keeping a top-down `frame` and every text run its `source_index` back to the
958
+ * editable content-stream operator.
959
+ *
960
+ * The **per-page** counterpart of {@link GigaPdfDoc.toModel} (which
961
+ * reconstructs the whole document at once): a continuous / lazily-virtualized
962
+ * editor calls this one page at a time. Identifies 1- and 2-column layouts,
963
+ * merges lines into justified/left/centred/right paragraphs, promotes large
964
+ * isolated lines to headings, and recovers ruled tables. An out-of-range page
965
+ * yields `[]`.
966
+ */
967
+ pageBlocks(page) {
968
+ return this.g._json((o) => this.ex().gp_page_blocks_json(this.h, page, o));
969
+ }
925
970
  search(query, caseInsensitive = true) {
926
971
  return this.g._withStr(
927
972
  query,