@qrcommunication/gigapdf-lib 0.67.0 → 0.68.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 +56 -0
- package/dist/index.cjs +46 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -1
- package/gigapdf.wasm +0 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -365,6 +365,12 @@ declare class GigaPdfEngine {
|
|
|
365
365
|
modelToHtml(model: GigaDocument): string;
|
|
366
366
|
/** Raise a model to RTF (decoded UTF-8 string). */
|
|
367
367
|
modelToRtf(model: GigaDocument): string;
|
|
368
|
+
/** Raise a model to Markdown (decoded UTF-8 string). */
|
|
369
|
+
modelToMarkdown(model: GigaDocument): string;
|
|
370
|
+
/** Raise a model to CSV (decoded UTF-8 string). */
|
|
371
|
+
modelToCsv(model: GigaDocument): string;
|
|
372
|
+
/** Raise a model to an EPUB e-book (`.epub`). */
|
|
373
|
+
modelToEpub(model: GigaDocument): Uint8Array;
|
|
368
374
|
}
|
|
369
375
|
/** A Google font the HTML engine needs (resolved from the catalogue). */
|
|
370
376
|
interface HtmlFontRequest {
|
|
@@ -1481,6 +1487,35 @@ declare class GigaPdfDoc {
|
|
|
1481
1487
|
strokeAlpha?: number;
|
|
1482
1488
|
dash?: number[];
|
|
1483
1489
|
}): boolean;
|
|
1490
|
+
/**
|
|
1491
|
+
* Re-style **sub-ranges** of text run `index` on `page` in place — the
|
|
1492
|
+
* by-character-run companion of {@link setPathStyle}. Each span sets the style
|
|
1493
|
+
* of the `[start, end)` UTF-16 slice of the run's *decoded* text (bold / italic
|
|
1494
|
+
* / underline / strike / colour / size); the run is split so the rest keeps its
|
|
1495
|
+
* original style and **positioning is preserved** (the original glyph codes,
|
|
1496
|
+
* including `TJ` kerning, are sliced and re-emitted — never re-encoded — and
|
|
1497
|
+
* each styled slice is wrapped in `q … Q`). Spans may be given in any order and
|
|
1498
|
+
* are clamped to the run's length.
|
|
1499
|
+
*
|
|
1500
|
+
* Notes on each field: `color` is `[r,g,b]` in `0..=1` (text fill); `sizePt`
|
|
1501
|
+
* rescales the slice's font in the run's own text scale; `bold` is faux-bold
|
|
1502
|
+
* (fill+stroke render mode) when no bold variant font is wired; `italic` is a
|
|
1503
|
+
* no-op without an italic/oblique variant (a stream edit can't shear glyphs
|
|
1504
|
+
* without disturbing advances); `underline`/`strike` draw a thin rule in page
|
|
1505
|
+
* space. Returns `false` when `index` does not resolve to a top-level text run
|
|
1506
|
+
* (e.g. it addresses form-XObject text), like {@link setPathStyle} for a
|
|
1507
|
+
* non-matching element.
|
|
1508
|
+
*/
|
|
1509
|
+
setTextRunStyle(page: number, index: number, spans: Array<{
|
|
1510
|
+
start: number;
|
|
1511
|
+
end: number;
|
|
1512
|
+
color?: [number, number, number];
|
|
1513
|
+
sizePt?: number;
|
|
1514
|
+
bold?: boolean;
|
|
1515
|
+
italic?: boolean;
|
|
1516
|
+
underline?: boolean;
|
|
1517
|
+
strike?: boolean;
|
|
1518
|
+
}>): boolean;
|
|
1484
1519
|
/**
|
|
1485
1520
|
* Set a constant opacity on element `index` on `page` — text, image **or**
|
|
1486
1521
|
* shape — by registering an `/ExtGState` (`/ca` = `/CA` = `fillAlpha`, clamped
|
package/dist/index.d.ts
CHANGED
|
@@ -365,6 +365,12 @@ declare class GigaPdfEngine {
|
|
|
365
365
|
modelToHtml(model: GigaDocument): string;
|
|
366
366
|
/** Raise a model to RTF (decoded UTF-8 string). */
|
|
367
367
|
modelToRtf(model: GigaDocument): string;
|
|
368
|
+
/** Raise a model to Markdown (decoded UTF-8 string). */
|
|
369
|
+
modelToMarkdown(model: GigaDocument): string;
|
|
370
|
+
/** Raise a model to CSV (decoded UTF-8 string). */
|
|
371
|
+
modelToCsv(model: GigaDocument): string;
|
|
372
|
+
/** Raise a model to an EPUB e-book (`.epub`). */
|
|
373
|
+
modelToEpub(model: GigaDocument): Uint8Array;
|
|
368
374
|
}
|
|
369
375
|
/** A Google font the HTML engine needs (resolved from the catalogue). */
|
|
370
376
|
interface HtmlFontRequest {
|
|
@@ -1481,6 +1487,35 @@ declare class GigaPdfDoc {
|
|
|
1481
1487
|
strokeAlpha?: number;
|
|
1482
1488
|
dash?: number[];
|
|
1483
1489
|
}): boolean;
|
|
1490
|
+
/**
|
|
1491
|
+
* Re-style **sub-ranges** of text run `index` on `page` in place — the
|
|
1492
|
+
* by-character-run companion of {@link setPathStyle}. Each span sets the style
|
|
1493
|
+
* of the `[start, end)` UTF-16 slice of the run's *decoded* text (bold / italic
|
|
1494
|
+
* / underline / strike / colour / size); the run is split so the rest keeps its
|
|
1495
|
+
* original style and **positioning is preserved** (the original glyph codes,
|
|
1496
|
+
* including `TJ` kerning, are sliced and re-emitted — never re-encoded — and
|
|
1497
|
+
* each styled slice is wrapped in `q … Q`). Spans may be given in any order and
|
|
1498
|
+
* are clamped to the run's length.
|
|
1499
|
+
*
|
|
1500
|
+
* Notes on each field: `color` is `[r,g,b]` in `0..=1` (text fill); `sizePt`
|
|
1501
|
+
* rescales the slice's font in the run's own text scale; `bold` is faux-bold
|
|
1502
|
+
* (fill+stroke render mode) when no bold variant font is wired; `italic` is a
|
|
1503
|
+
* no-op without an italic/oblique variant (a stream edit can't shear glyphs
|
|
1504
|
+
* without disturbing advances); `underline`/`strike` draw a thin rule in page
|
|
1505
|
+
* space. Returns `false` when `index` does not resolve to a top-level text run
|
|
1506
|
+
* (e.g. it addresses form-XObject text), like {@link setPathStyle} for a
|
|
1507
|
+
* non-matching element.
|
|
1508
|
+
*/
|
|
1509
|
+
setTextRunStyle(page: number, index: number, spans: Array<{
|
|
1510
|
+
start: number;
|
|
1511
|
+
end: number;
|
|
1512
|
+
color?: [number, number, number];
|
|
1513
|
+
sizePt?: number;
|
|
1514
|
+
bold?: boolean;
|
|
1515
|
+
italic?: boolean;
|
|
1516
|
+
underline?: boolean;
|
|
1517
|
+
strike?: boolean;
|
|
1518
|
+
}>): boolean;
|
|
1484
1519
|
/**
|
|
1485
1520
|
* Set a constant opacity on element `index` on `page` — text, image **or**
|
|
1486
1521
|
* shape — by registering an `/ExtGState` (`/ca` = `/CA` = `fillAlpha`, clamped
|
package/dist/index.js
CHANGED
|
@@ -806,6 +806,27 @@ var GigaPdfEngine = class _GigaPdfEngine {
|
|
|
806
806
|
(p, l) => this._str((o) => this.ex.gp_model_to_rtf(p, l, o))
|
|
807
807
|
);
|
|
808
808
|
}
|
|
809
|
+
/** Raise a model to Markdown (decoded UTF-8 string). */
|
|
810
|
+
modelToMarkdown(model) {
|
|
811
|
+
return this._withStr(
|
|
812
|
+
JSON.stringify(model),
|
|
813
|
+
(p, l) => this._str((o) => this.ex.gp_model_to_md(p, l, o))
|
|
814
|
+
);
|
|
815
|
+
}
|
|
816
|
+
/** Raise a model to CSV (decoded UTF-8 string). */
|
|
817
|
+
modelToCsv(model) {
|
|
818
|
+
return this._withStr(
|
|
819
|
+
JSON.stringify(model),
|
|
820
|
+
(p, l) => this._str((o) => this.ex.gp_model_to_csv(p, l, o))
|
|
821
|
+
);
|
|
822
|
+
}
|
|
823
|
+
/** Raise a model to an EPUB e-book (`.epub`). */
|
|
824
|
+
modelToEpub(model) {
|
|
825
|
+
return this._withStr(
|
|
826
|
+
JSON.stringify(model),
|
|
827
|
+
(p, l) => this._buffer((o) => this.ex.gp_model_to_epub(p, l, o))
|
|
828
|
+
);
|
|
829
|
+
}
|
|
809
830
|
};
|
|
810
831
|
function packHtmlResources(resources) {
|
|
811
832
|
let size = 4;
|
|
@@ -1037,6 +1058,31 @@ var GigaPdfDoc = class {
|
|
|
1037
1058
|
(p, l) => this.ex().gp_set_path_style_json(this.h, page, index, p, l)
|
|
1038
1059
|
) === 0;
|
|
1039
1060
|
}
|
|
1061
|
+
/**
|
|
1062
|
+
* Re-style **sub-ranges** of text run `index` on `page` in place — the
|
|
1063
|
+
* by-character-run companion of {@link setPathStyle}. Each span sets the style
|
|
1064
|
+
* of the `[start, end)` UTF-16 slice of the run's *decoded* text (bold / italic
|
|
1065
|
+
* / underline / strike / colour / size); the run is split so the rest keeps its
|
|
1066
|
+
* original style and **positioning is preserved** (the original glyph codes,
|
|
1067
|
+
* including `TJ` kerning, are sliced and re-emitted — never re-encoded — and
|
|
1068
|
+
* each styled slice is wrapped in `q … Q`). Spans may be given in any order and
|
|
1069
|
+
* are clamped to the run's length.
|
|
1070
|
+
*
|
|
1071
|
+
* Notes on each field: `color` is `[r,g,b]` in `0..=1` (text fill); `sizePt`
|
|
1072
|
+
* rescales the slice's font in the run's own text scale; `bold` is faux-bold
|
|
1073
|
+
* (fill+stroke render mode) when no bold variant font is wired; `italic` is a
|
|
1074
|
+
* no-op without an italic/oblique variant (a stream edit can't shear glyphs
|
|
1075
|
+
* without disturbing advances); `underline`/`strike` draw a thin rule in page
|
|
1076
|
+
* space. Returns `false` when `index` does not resolve to a top-level text run
|
|
1077
|
+
* (e.g. it addresses form-XObject text), like {@link setPathStyle} for a
|
|
1078
|
+
* non-matching element.
|
|
1079
|
+
*/
|
|
1080
|
+
setTextRunStyle(page, index, spans) {
|
|
1081
|
+
return this.g._withStr(
|
|
1082
|
+
JSON.stringify(spans),
|
|
1083
|
+
(p, l) => this.ex().gp_set_text_run_style_json(this.h, page, index, p, l)
|
|
1084
|
+
) === 0;
|
|
1085
|
+
}
|
|
1040
1086
|
/**
|
|
1041
1087
|
* Set a constant opacity on element `index` on `page` — text, image **or**
|
|
1042
1088
|
* shape — by registering an `/ExtGState` (`/ca` = `/CA` = `fillAlpha`, clamped
|