@qrcommunication/gigapdf-lib 0.108.0 → 0.109.1
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 +37 -0
- package/dist/index.cjs +14 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -10
- package/dist/index.d.ts +14 -10
- package/dist/index.js +14 -10
- package/dist/index.js.map +1 -1
- package/gigapdf.wasm +0 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -193,11 +193,12 @@ declare class GigaPdfEngine {
|
|
|
193
193
|
*/
|
|
194
194
|
officeToPdfWith(office: Uint8Array, fonts?: HtmlFont[]): Uint8Array;
|
|
195
195
|
/**
|
|
196
|
-
* Image (PNG/JPEG/GIF/WebP/AVIF) → one-page PDF, format auto-detected:
|
|
197
|
-
* image is centred and scaled to fit on an A4 portrait page. PNG/JPEG
|
|
198
|
-
* directly; GIF/WebP/AVIF are transcoded to PNG first — all in pure
|
|
199
|
-
* no third-party image library. Empty array if the bytes are not a
|
|
200
|
-
* image. To combine many images into a single document, pipe each
|
|
196
|
+
* Image (PNG/JPEG/GIF/WebP/AVIF/TIFF) → one-page PDF, format auto-detected:
|
|
197
|
+
* the image is centred and scaled to fit on an A4 portrait page. PNG/JPEG
|
|
198
|
+
* embed directly; GIF/WebP/AVIF/TIFF are transcoded to PNG first — all in pure
|
|
199
|
+
* Rust/WASM, no third-party image library. Empty array if the bytes are not a
|
|
200
|
+
* recognized image. To combine many images into a single document, pipe each
|
|
201
|
+
* result
|
|
201
202
|
* through {@link mergePdfs}.
|
|
202
203
|
*/
|
|
203
204
|
imageToPdf(image: Uint8Array): Uint8Array;
|
|
@@ -2304,8 +2305,10 @@ declare class GigaPdfDoc {
|
|
|
2304
2305
|
*/
|
|
2305
2306
|
addPath(page: number, svgPath: string, ox: number, oy: number, stroke?: number | null, fill?: number | null, lineWidth?: number, opacity?: number): boolean;
|
|
2306
2307
|
/**
|
|
2307
|
-
* Embed a raster image
|
|
2308
|
-
*
|
|
2308
|
+
* Embed a raster image at `(x,y)` sized `(w,h)` in PDF user space. Format
|
|
2309
|
+
* auto-detected: **PNG, JPEG, GIF, WebP, AVIF, TIFF** (non-PNG/JPEG decoded to
|
|
2310
|
+
* RGBA in pure Rust/WASM). PNG alpha is honoured; `opacity` (0..1) sets an
|
|
2311
|
+
* overall alpha.
|
|
2309
2312
|
*/
|
|
2310
2313
|
addImage(page: number, data: Uint8Array, x: number, y: number, w: number, h: number, opacity?: number): boolean;
|
|
2311
2314
|
/**
|
|
@@ -2313,7 +2316,8 @@ declare class GigaPdfDoc {
|
|
|
2313
2316
|
* photo while every reference to it stays intact (ISO 32000-1 §8.9). `index` is
|
|
2314
2317
|
* the **unified element index** of an image on `page`, exactly the `index`
|
|
2315
2318
|
* reported by {@link imageElements} (and accepted by {@link removeElement} /
|
|
2316
|
-
* {@link transformElement}); `data` is
|
|
2319
|
+
* {@link transformElement}); `data` is any raster the engine decodes — PNG,
|
|
2320
|
+
* JPEG, WebP, GIF, TIFF or AVIF (the same set {@link addImage} accepts).
|
|
2317
2321
|
*
|
|
2318
2322
|
* Unlike a delete-then-re-add, the image keeps its object number, **every `/Do`
|
|
2319
2323
|
* placement, and its position / scale / rotation / clip matrix** — only the
|
|
@@ -2324,12 +2328,12 @@ declare class GigaPdfDoc {
|
|
|
2324
2328
|
* drawn into the same box (transform the element first to re-fit it).
|
|
2325
2329
|
*
|
|
2326
2330
|
* Returns `false` if `page`/`index` doesn't resolve to a top-level image, or the
|
|
2327
|
-
* bytes aren't a decodable
|
|
2331
|
+
* bytes aren't a decodable raster.
|
|
2328
2332
|
*/
|
|
2329
2333
|
replaceImage(page: number, index: number, data: Uint8Array): boolean;
|
|
2330
2334
|
/**
|
|
2331
2335
|
* Stamp an **image watermark** across pages from raw image bytes. Accepts the
|
|
2332
|
-
*
|
|
2336
|
+
* formats the engine decodes — **PNG, JPEG, WebP, GIF, AVIF, TIFF**. The
|
|
2333
2337
|
* image is embedded **once** and referenced on every target page.
|
|
2334
2338
|
*
|
|
2335
2339
|
* `opts.pages` is a list of 1-based page numbers; omit it (or pass `[]`) to
|
package/dist/index.d.ts
CHANGED
|
@@ -193,11 +193,12 @@ declare class GigaPdfEngine {
|
|
|
193
193
|
*/
|
|
194
194
|
officeToPdfWith(office: Uint8Array, fonts?: HtmlFont[]): Uint8Array;
|
|
195
195
|
/**
|
|
196
|
-
* Image (PNG/JPEG/GIF/WebP/AVIF) → one-page PDF, format auto-detected:
|
|
197
|
-
* image is centred and scaled to fit on an A4 portrait page. PNG/JPEG
|
|
198
|
-
* directly; GIF/WebP/AVIF are transcoded to PNG first — all in pure
|
|
199
|
-
* no third-party image library. Empty array if the bytes are not a
|
|
200
|
-
* image. To combine many images into a single document, pipe each
|
|
196
|
+
* Image (PNG/JPEG/GIF/WebP/AVIF/TIFF) → one-page PDF, format auto-detected:
|
|
197
|
+
* the image is centred and scaled to fit on an A4 portrait page. PNG/JPEG
|
|
198
|
+
* embed directly; GIF/WebP/AVIF/TIFF are transcoded to PNG first — all in pure
|
|
199
|
+
* Rust/WASM, no third-party image library. Empty array if the bytes are not a
|
|
200
|
+
* recognized image. To combine many images into a single document, pipe each
|
|
201
|
+
* result
|
|
201
202
|
* through {@link mergePdfs}.
|
|
202
203
|
*/
|
|
203
204
|
imageToPdf(image: Uint8Array): Uint8Array;
|
|
@@ -2304,8 +2305,10 @@ declare class GigaPdfDoc {
|
|
|
2304
2305
|
*/
|
|
2305
2306
|
addPath(page: number, svgPath: string, ox: number, oy: number, stroke?: number | null, fill?: number | null, lineWidth?: number, opacity?: number): boolean;
|
|
2306
2307
|
/**
|
|
2307
|
-
* Embed a raster image
|
|
2308
|
-
*
|
|
2308
|
+
* Embed a raster image at `(x,y)` sized `(w,h)` in PDF user space. Format
|
|
2309
|
+
* auto-detected: **PNG, JPEG, GIF, WebP, AVIF, TIFF** (non-PNG/JPEG decoded to
|
|
2310
|
+
* RGBA in pure Rust/WASM). PNG alpha is honoured; `opacity` (0..1) sets an
|
|
2311
|
+
* overall alpha.
|
|
2309
2312
|
*/
|
|
2310
2313
|
addImage(page: number, data: Uint8Array, x: number, y: number, w: number, h: number, opacity?: number): boolean;
|
|
2311
2314
|
/**
|
|
@@ -2313,7 +2316,8 @@ declare class GigaPdfDoc {
|
|
|
2313
2316
|
* photo while every reference to it stays intact (ISO 32000-1 §8.9). `index` is
|
|
2314
2317
|
* the **unified element index** of an image on `page`, exactly the `index`
|
|
2315
2318
|
* reported by {@link imageElements} (and accepted by {@link removeElement} /
|
|
2316
|
-
* {@link transformElement}); `data` is
|
|
2319
|
+
* {@link transformElement}); `data` is any raster the engine decodes — PNG,
|
|
2320
|
+
* JPEG, WebP, GIF, TIFF or AVIF (the same set {@link addImage} accepts).
|
|
2317
2321
|
*
|
|
2318
2322
|
* Unlike a delete-then-re-add, the image keeps its object number, **every `/Do`
|
|
2319
2323
|
* placement, and its position / scale / rotation / clip matrix** — only the
|
|
@@ -2324,12 +2328,12 @@ declare class GigaPdfDoc {
|
|
|
2324
2328
|
* drawn into the same box (transform the element first to re-fit it).
|
|
2325
2329
|
*
|
|
2326
2330
|
* Returns `false` if `page`/`index` doesn't resolve to a top-level image, or the
|
|
2327
|
-
* bytes aren't a decodable
|
|
2331
|
+
* bytes aren't a decodable raster.
|
|
2328
2332
|
*/
|
|
2329
2333
|
replaceImage(page: number, index: number, data: Uint8Array): boolean;
|
|
2330
2334
|
/**
|
|
2331
2335
|
* Stamp an **image watermark** across pages from raw image bytes. Accepts the
|
|
2332
|
-
*
|
|
2336
|
+
* formats the engine decodes — **PNG, JPEG, WebP, GIF, AVIF, TIFF**. The
|
|
2333
2337
|
* image is embedded **once** and referenced on every target page.
|
|
2334
2338
|
*
|
|
2335
2339
|
* `opts.pages` is a list of 1-based page numbers; omit it (or pass `[]`) to
|
package/dist/index.js
CHANGED
|
@@ -368,11 +368,12 @@ var GigaPdfEngine = class _GigaPdfEngine {
|
|
|
368
368
|
);
|
|
369
369
|
}
|
|
370
370
|
/**
|
|
371
|
-
* Image (PNG/JPEG/GIF/WebP/AVIF) → one-page PDF, format auto-detected:
|
|
372
|
-
* image is centred and scaled to fit on an A4 portrait page. PNG/JPEG
|
|
373
|
-
* directly; GIF/WebP/AVIF are transcoded to PNG first — all in pure
|
|
374
|
-
* no third-party image library. Empty array if the bytes are not a
|
|
375
|
-
* image. To combine many images into a single document, pipe each
|
|
371
|
+
* Image (PNG/JPEG/GIF/WebP/AVIF/TIFF) → one-page PDF, format auto-detected:
|
|
372
|
+
* the image is centred and scaled to fit on an A4 portrait page. PNG/JPEG
|
|
373
|
+
* embed directly; GIF/WebP/AVIF/TIFF are transcoded to PNG first — all in pure
|
|
374
|
+
* Rust/WASM, no third-party image library. Empty array if the bytes are not a
|
|
375
|
+
* recognized image. To combine many images into a single document, pipe each
|
|
376
|
+
* result
|
|
376
377
|
* through {@link mergePdfs}.
|
|
377
378
|
*/
|
|
378
379
|
imageToPdf(image) {
|
|
@@ -1599,8 +1600,10 @@ var GigaPdfDoc = class {
|
|
|
1599
1600
|
) === 0;
|
|
1600
1601
|
}
|
|
1601
1602
|
/**
|
|
1602
|
-
* Embed a raster image
|
|
1603
|
-
*
|
|
1603
|
+
* Embed a raster image at `(x,y)` sized `(w,h)` in PDF user space. Format
|
|
1604
|
+
* auto-detected: **PNG, JPEG, GIF, WebP, AVIF, TIFF** (non-PNG/JPEG decoded to
|
|
1605
|
+
* RGBA in pure Rust/WASM). PNG alpha is honoured; `opacity` (0..1) sets an
|
|
1606
|
+
* overall alpha.
|
|
1604
1607
|
*/
|
|
1605
1608
|
addImage(page, data, x, y, w, h, opacity = 1) {
|
|
1606
1609
|
return this.g._withBytes(
|
|
@@ -1613,7 +1616,8 @@ var GigaPdfDoc = class {
|
|
|
1613
1616
|
* photo while every reference to it stays intact (ISO 32000-1 §8.9). `index` is
|
|
1614
1617
|
* the **unified element index** of an image on `page`, exactly the `index`
|
|
1615
1618
|
* reported by {@link imageElements} (and accepted by {@link removeElement} /
|
|
1616
|
-
* {@link transformElement}); `data` is
|
|
1619
|
+
* {@link transformElement}); `data` is any raster the engine decodes — PNG,
|
|
1620
|
+
* JPEG, WebP, GIF, TIFF or AVIF (the same set {@link addImage} accepts).
|
|
1617
1621
|
*
|
|
1618
1622
|
* Unlike a delete-then-re-add, the image keeps its object number, **every `/Do`
|
|
1619
1623
|
* placement, and its position / scale / rotation / clip matrix** — only the
|
|
@@ -1624,14 +1628,14 @@ var GigaPdfDoc = class {
|
|
|
1624
1628
|
* drawn into the same box (transform the element first to re-fit it).
|
|
1625
1629
|
*
|
|
1626
1630
|
* Returns `false` if `page`/`index` doesn't resolve to a top-level image, or the
|
|
1627
|
-
* bytes aren't a decodable
|
|
1631
|
+
* bytes aren't a decodable raster.
|
|
1628
1632
|
*/
|
|
1629
1633
|
replaceImage(page, index, data) {
|
|
1630
1634
|
return this.g._withBytes(data, (p, l) => this.ex().gp_replace_image(this.h, page, index, p, l)) === 0;
|
|
1631
1635
|
}
|
|
1632
1636
|
/**
|
|
1633
1637
|
* Stamp an **image watermark** across pages from raw image bytes. Accepts the
|
|
1634
|
-
*
|
|
1638
|
+
* formats the engine decodes — **PNG, JPEG, WebP, GIF, AVIF, TIFF**. The
|
|
1635
1639
|
* image is embedded **once** and referenced on every target page.
|
|
1636
1640
|
*
|
|
1637
1641
|
* `opts.pages` is a list of 1-based page numbers; omit it (or pass `[]`) to
|