@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 CHANGED
@@ -6,6 +6,43 @@ project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.109.1] - 2026-06-30
10
+
11
+ ### Fixed — image-format documentation accuracy
12
+
13
+ - `addImage`, `replaceImage` and the image **watermark** path already accept the
14
+ full raster set — **PNG, JPEG, WebP, GIF, TIFF and AVIF** — since 0.109 (every
15
+ one routes through the shared `prepare_image` / `embeddable_image` decoders).
16
+ But the core and WASM docstrings, the SDK `replaceImage` docs, and the
17
+ `unsupported image` error messages still claimed **PNG/JPEG only** (or omitted
18
+ TIFF). Corrected every stale claim so the documented capability matches the
19
+ implementation. **No behaviour change** — purely documentation and error-text.
20
+
21
+ ### Added
22
+
23
+ - Regression test `replace_image_accepts_every_raster_format_not_just_png_jpeg`:
24
+ proves `replaceImage` swaps a non-PNG/JPEG raster (WebP) in place while keeping
25
+ the image's object number and every `/Do` reference intact.
26
+
27
+ ## [0.109.0] - 2026-06-30
28
+
29
+ ### Added — image conversion completeness
30
+
31
+ - `imageToPdf` and direct image embedding now accept the full format set
32
+ uniformly: **PNG, JPEG, GIF, WebP, AVIF and TIFF**. AVIF works for direct
33
+ embedding (`addImage` / watermark) and TIFF works for `imageToPdf` — closing
34
+ the gaps where one entry point supported a format the other rejected.
35
+ - New `image_conversion.test.ts` suite exercises every format → PDF through the
36
+ bundled production WASM binary (PNG, WebP, AVIF, TIFF), the non-image rejection
37
+ path, and `addImage`.
38
+
39
+ ### Added — conversion fidelity (both directions)
40
+
41
+ - HTML `letter-spacing`, `visibility:hidden`/`display:none`, `<sup>`/`<sub>` and
42
+ `<colgroup><col width>`; Markdown inline `<sup>`/`<sub>`; ODT/DOCX tab stops;
43
+ RTF `\page` page breaks — all now round-trip through the model. See the engine
44
+ [`CHANGELOG.md`](../CHANGELOG.md) for the full list.
45
+
9
46
  ## [0.107.1] - 2026-06-27
10
47
 
11
48
  ### Fixed
package/dist/index.cjs CHANGED
@@ -398,11 +398,12 @@ var GigaPdfEngine = class _GigaPdfEngine {
398
398
  );
399
399
  }
400
400
  /**
401
- * Image (PNG/JPEG/GIF/WebP/AVIF) → one-page PDF, format auto-detected: the
402
- * image is centred and scaled to fit on an A4 portrait page. PNG/JPEG embed
403
- * directly; GIF/WebP/AVIF are transcoded to PNG first — all in pure Rust/WASM,
404
- * no third-party image library. Empty array if the bytes are not a recognized
405
- * image. To combine many images into a single document, pipe each result
401
+ * Image (PNG/JPEG/GIF/WebP/AVIF/TIFF) → one-page PDF, format auto-detected:
402
+ * the image is centred and scaled to fit on an A4 portrait page. PNG/JPEG
403
+ * embed directly; GIF/WebP/AVIF/TIFF are transcoded to PNG first — all in pure
404
+ * Rust/WASM, no third-party image library. Empty array if the bytes are not a
405
+ * recognized image. To combine many images into a single document, pipe each
406
+ * result
406
407
  * through {@link mergePdfs}.
407
408
  */
408
409
  imageToPdf(image) {
@@ -1629,8 +1630,10 @@ var GigaPdfDoc = class {
1629
1630
  ) === 0;
1630
1631
  }
1631
1632
  /**
1632
- * Embed a raster image (PNG or JPEG bytes) at `(x,y)` sized `(w,h)` in PDF
1633
- * user space. PNG alpha is honoured; `opacity` (0..1) sets an overall alpha.
1633
+ * Embed a raster image at `(x,y)` sized `(w,h)` in PDF user space. Format
1634
+ * auto-detected: **PNG, JPEG, GIF, WebP, AVIF, TIFF** (non-PNG/JPEG decoded to
1635
+ * RGBA in pure Rust/WASM). PNG alpha is honoured; `opacity` (0..1) sets an
1636
+ * overall alpha.
1634
1637
  */
1635
1638
  addImage(page, data, x, y, w, h, opacity = 1) {
1636
1639
  return this.g._withBytes(
@@ -1643,7 +1646,8 @@ var GigaPdfDoc = class {
1643
1646
  * photo while every reference to it stays intact (ISO 32000-1 §8.9). `index` is
1644
1647
  * the **unified element index** of an image on `page`, exactly the `index`
1645
1648
  * reported by {@link imageElements} (and accepted by {@link removeElement} /
1646
- * {@link transformElement}); `data` is a fresh PNG or JPEG.
1649
+ * {@link transformElement}); `data` is any raster the engine decodes — PNG,
1650
+ * JPEG, WebP, GIF, TIFF or AVIF (the same set {@link addImage} accepts).
1647
1651
  *
1648
1652
  * Unlike a delete-then-re-add, the image keeps its object number, **every `/Do`
1649
1653
  * placement, and its position / scale / rotation / clip matrix** — only the
@@ -1654,14 +1658,14 @@ var GigaPdfDoc = class {
1654
1658
  * drawn into the same box (transform the element first to re-fit it).
1655
1659
  *
1656
1660
  * Returns `false` if `page`/`index` doesn't resolve to a top-level image, or the
1657
- * bytes aren't a decodable PNG/JPEG.
1661
+ * bytes aren't a decodable raster.
1658
1662
  */
1659
1663
  replaceImage(page, index, data) {
1660
1664
  return this.g._withBytes(data, (p, l) => this.ex().gp_replace_image(this.h, page, index, p, l)) === 0;
1661
1665
  }
1662
1666
  /**
1663
1667
  * Stamp an **image watermark** across pages from raw image bytes. Accepts the
1664
- * same five formats the engine decodes — **PNG, JPEG, WebP, GIF, AVIF**. The
1668
+ * formats the engine decodes — **PNG, JPEG, WebP, GIF, AVIF, TIFF**. The
1665
1669
  * image is embedded **once** and referenced on every target page.
1666
1670
  *
1667
1671
  * `opts.pages` is a list of 1-based page numbers; omit it (or pass `[]`) to