@qrcommunication/gigapdf-lib 0.124.0 → 0.125.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 CHANGED
@@ -6,6 +6,27 @@ project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.125.0] - 2026-12-06
10
+
11
+ ### Added
12
+
13
+ - `toModel()` carries embedded font programs and aliases in `resources.fonts`;
14
+ `modelToPdf()` reuses them with their exact weight and italic variant.
15
+ - `GigaCharStyle` and `GigaStylePatch` expose optional `font_weight` (100–900).
16
+
17
+ ### Fixed
18
+
19
+ - Positioned text no longer rewraps over neighbouring source lines. Identical
20
+ images share one XObject and opaque JPEG resources retain their original bytes.
21
+
22
+ ## [0.124.1] - 2026-12-06
23
+
24
+ ### Added
25
+
26
+ - `ImageElementInfo.alt` exposes the current alternative text. `setImageAlt`
27
+ resolves page + unified image index to the correct global figure before
28
+ `toTagged({ pdfUa: true })` writes the accessible output.
29
+
9
30
  ## [0.124.0] - 2026-12-06
10
31
 
11
32
  ### Added
package/README.md CHANGED
@@ -130,6 +130,23 @@ const pdf = giga.imageToPdf(imageBytes); // PNG/JPEG/GIF/WebP/AVIF → one A4 pa
130
130
  // (image centred, shrink-to-fit, never upscaled; empty array if not an image)
131
131
  ```
132
132
 
133
+ ### Edit an image's alternative text
134
+
135
+ ```ts
136
+ const doc = giga.open(pdfBytes);
137
+ const image = doc.imageElements(1)[0];
138
+ if (image) {
139
+ // Address the real image by page + unified element index (not a figure-local
140
+ // counter). The current structure alt is exposed as `image.alt`.
141
+ doc.setImageAlt(1, image.index, "Sales growth by region");
142
+ }
143
+ const accessible = doc.toTagged({ pdfUa: true }); // /Figure + /Alt + PDF/UA-1 XMP
144
+ doc.close();
145
+ ```
146
+
147
+ Use `setFigureAlt` only when you intentionally address the document-global figure
148
+ index. `setImageAlt` resolves the editor's unified image index for you.
149
+
133
150
  ### Split — extract a page range into a new PDF
134
151
 
135
152
  ```ts
package/dist/index.cjs CHANGED
@@ -2643,6 +2643,13 @@ var GigaPdfDoc = class {
2643
2643
  setFigureAlt(index, alt) {
2644
2644
  return this.g._withStr(alt, (p, l) => this.ex().gp_set_figure_alt(this.h, index, p, l)) === 0;
2645
2645
  }
2646
+ /** Set alternative text on an image by page and unified element index. */
2647
+ setImageAlt(page, index, alt) {
2648
+ return this.g._withStr(
2649
+ alt,
2650
+ (p, l) => this.ex().gp_set_image_alt(this.h, page, index, p, l)
2651
+ ) === 0;
2652
+ }
2646
2653
  // security
2647
2654
  /**
2648
2655
  * Serialize the document encrypted with the PDF Standard Security Handler.