@qrcommunication/gigapdf-lib 0.52.1 → 0.52.3

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
@@ -4,6 +4,30 @@ All notable changes to `@qrcommunication/gigapdf-lib` are documented here.
4
4
  The format follows [Keep a Changelog](https://keepachangelog.com/) and the
5
5
  project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [0.52.3] - 2026-06-19
8
+
9
+ ### Added
10
+
11
+ - **Bake underline & strikethrough into drawn text.** `addText` /
12
+ `addStandardText` now accept a trailing `opts: { underline?, strikethrough? }`
13
+ (backed by new `add_text_styled` / `gp_add_text_styled`); the rule is painted
14
+ as a filled rectangle that follows the text rotation, its length taken from the
15
+ run's real glyph advances. Existing calls stay byte-identical (flags off).
16
+ - **AVIF (AV1 intra) decode — loop restoration (§7.17 Wiener + SGR) and
17
+ directional intra-edge filtering/upsampling.** Higher-fidelity AVIF decoding;
18
+ the post-deblock / pre-CDEF stripe halo is used for restoration so stripe and
19
+ frame edges are reconstructed correctly.
20
+
21
+ ## [0.52.2] - 2026-06-19
22
+
23
+ ### Added
24
+
25
+ - **Read baked running headers/footers.** `GigaPdfDoc.headerFooter()` returns
26
+ `{ header, footer }` recovered from the `/GPHF` marked-content spans that
27
+ `setHeader`/`setFooter` write, so a host can detect whether a PDF already
28
+ carries a running header/footer (and recover its text) and reflect that in its
29
+ UI — the read complement to the existing writer.
30
+
7
31
  ## [0.52.1] - 2026-06-18
8
32
 
9
33
  ### Fixed
package/dist/index.cjs CHANGED
@@ -1181,6 +1181,21 @@ var GigaPdfDoc = class {
1181
1181
  removeFooters() {
1182
1182
  return this.ex().gp_remove_footers(this.h) === 0;
1183
1183
  }
1184
+ /**
1185
+ * Detect the running header/footer already baked into this PDF — the reader
1186
+ * counterpart of {@link GigaPdfDoc.setHeader} / {@link GigaPdfDoc.setFooter}.
1187
+ * Each side is a {@link HeaderFooterSpec} (with its recovered `text`) when a
1188
+ * baked `/GPHF` span is present, or `null` when absent. The `text` is faithful
1189
+ * (the per-page-substituted text of the first matching page); `align`,
1190
+ * `fontSize`, `color`, etc. are best-effort defaults, since the bake records
1191
+ * only the drawn text. Use it to reflect existing document state (e.g. a
1192
+ * Word-like editor toggle).
1193
+ */
1194
+ headerFooter() {
1195
+ return this.g._json(
1196
+ (o) => this.ex().gp_header_footer(this.h, o)
1197
+ );
1198
+ }
1184
1199
  // render
1185
1200
  renderPage(page, scale = 1) {
1186
1201
  return this.g._buffer((o) => this.ex().gp_render_page(this.h, page, scale, o));
@@ -1211,11 +1226,18 @@ var GigaPdfDoc = class {
1211
1226
  * font's char→glyph map (Identity-H, 2-byte glyph ids). `rgb` is packed
1212
1227
  * `0xRRGGBB`; `rotationDeg` rotates CCW about `(x, y)`. For a built-in base-14
1213
1228
  * family with no embedding, use {@link addStandardText}.
1229
+ *
1230
+ * Pass `opts` to bake **text decorations** into the run: `{ underline: true }`
1231
+ * draws a rule just below the baseline, `{ strikethrough: true }` a rule near
1232
+ * the x-height — both span the run's advance and are filled in the text colour.
1233
+ * Omitting `opts` is fully backward-compatible (no decoration).
1214
1234
  */
1215
- addText(page, x, y, size, text, fontObj, rgb = 0, opacity = 1, rotationDeg = 0) {
1235
+ addText(page, x, y, size, text, fontObj, rgb = 0, opacity = 1, rotationDeg = 0, opts) {
1236
+ const underline = opts?.underline ? 1 : 0;
1237
+ const strikethrough = opts?.strikethrough ? 1 : 0;
1216
1238
  return this.g._withStr(
1217
1239
  text,
1218
- (p, l) => this.ex().gp_add_text(
1240
+ (p, l) => this.ex().gp_add_text_styled(
1219
1241
  this.h,
1220
1242
  page,
1221
1243
  x,
@@ -1226,7 +1248,9 @@ var GigaPdfDoc = class {
1226
1248
  fontObj,
1227
1249
  RGB(rgb),
1228
1250
  opacity,
1229
- rotationDeg
1251
+ rotationDeg,
1252
+ underline,
1253
+ strikethrough
1230
1254
  )
1231
1255
  ) === 0;
1232
1256
  }
@@ -1237,13 +1261,19 @@ var GigaPdfDoc = class {
1237
1261
  * {@link embedFont} (a Google Font fetched by the host, or one pulled out of
1238
1262
  * the document with {@link extractFont}) and use {@link addText}. Returns
1239
1263
  * `false` on an unknown font name or bad page.
1264
+ *
1265
+ * Pass `opts` to bake **text decorations** into the run: `{ underline: true }`
1266
+ * and/or `{ strikethrough: true }` draw filled rules in the text colour.
1267
+ * Omitting `opts` is fully backward-compatible (no decoration).
1240
1268
  */
1241
- addStandardText(page, x, y, size, text, fontName, rgb = 0, opacity = 1, rotationDeg = 0) {
1269
+ addStandardText(page, x, y, size, text, fontName, rgb = 0, opacity = 1, rotationDeg = 0, opts) {
1270
+ const underline = opts?.underline ? 1 : 0;
1271
+ const strikethrough = opts?.strikethrough ? 1 : 0;
1242
1272
  return this.g._withStr(
1243
1273
  text,
1244
1274
  (tp, tl) => this.g._withStr(
1245
1275
  fontName,
1246
- (fp, fl) => this.ex().gp_add_text_standard(
1276
+ (fp, fl) => this.ex().gp_add_text_standard_styled(
1247
1277
  this.h,
1248
1278
  page,
1249
1279
  x,
@@ -1255,7 +1285,9 @@ var GigaPdfDoc = class {
1255
1285
  fl,
1256
1286
  RGB(rgb),
1257
1287
  opacity,
1258
- rotationDeg
1288
+ rotationDeg,
1289
+ underline,
1290
+ strikethrough
1259
1291
  )
1260
1292
  )
1261
1293
  ) === 0;