@qrcommunication/gigapdf-lib 0.52.0 → 0.52.2

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,28 @@ 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.2] - 2026-06-19
8
+
9
+ ### Added
10
+
11
+ - **Read baked running headers/footers.** `GigaPdfDoc.headerFooter()` returns
12
+ `{ header, footer }` recovered from the `/GPHF` marked-content spans that
13
+ `setHeader`/`setFooter` write, so a host can detect whether a PDF already
14
+ carries a running header/footer (and recover its text) and reflect that in its
15
+ UI — the read complement to the existing writer.
16
+
17
+ ## [0.52.1] - 2026-06-18
18
+
19
+ ### Fixed
20
+
21
+ - **JPEG encoder — final-byte padding no longer corrupts the last code.** The
22
+ entropy writer's `flush` padded the trailing partial byte with a fixed 7-bit
23
+ `0x7F`; for any partial byte holding more than one written bit, the extra
24
+ 1-bits bled into the already-written Huffman code (ITU-T T.81 §F.1.2.3
25
+ requires padding *only* the free low bits with 1s). The lib's own decoder
26
+ tolerated it, but strict third-party decoders could misread the last code or
27
+ reject the non-conformant padding. `flush` now pads exactly the free bits.
28
+
7
29
  ## [0.52.0] - 2026-06-18
8
30
 
9
31
  ### Added
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));