@qrcommunication/gigapdf-lib 0.71.0 → 0.71.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 +15 -0
- package/README.md +57 -17
- package/gigapdf.wasm +0 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ 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.71.1] - 2026-06-23
|
|
8
|
+
|
|
9
|
+
Documentation-only patch. No code changes — the WASM blob is byte-for-byte
|
|
10
|
+
identical to 0.71.0.
|
|
11
|
+
|
|
12
|
+
### Documentation
|
|
13
|
+
|
|
14
|
+
- Complete overhaul of the SDK documentation for 0.71: API reference (signature
|
|
15
|
+
matrix for B / B-T / LTV signing, full ~263-method surface, removal of the
|
|
16
|
+
phantom OCR methods `doc.ocr` / `ocrText` / `extractText`), USAGE guide (the
|
|
17
|
+
four signing-signature levels + the host-fetch two-phase model + an SSRF note),
|
|
18
|
+
COOKBOOK (added `signTimestamped` / `signLtv` recipes and an image-watermark
|
|
19
|
+
recipe), plus the README and `sdk/README` (npm). No behavioural change — the
|
|
20
|
+
WASM is identical to 0.71.0.
|
|
21
|
+
|
|
7
22
|
## [0.71.0] - 2026-06-23
|
|
8
23
|
|
|
9
24
|
Long-term validation release: PAdES-LTV builds on the B-T timestamped signatures
|
package/README.md
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
# @qrcommunication/gigapdf-lib
|
|
2
2
|
|
|
3
3
|
TypeScript SDK for **gigapdf-lib** — a zero-dependency Rust→WASM PDF engine.
|
|
4
|
-
Read, edit, render,
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
Read, edit, render, search, **sign** (self-signed · PKCS#12 · PAdES-B-T timestamped
|
|
5
|
+
· PAdES-LTV), encrypt, fill & build forms, annotate, redact, and convert PDFs ↔
|
|
6
|
+
Office/HTML/RTF/Markdown/CSV — plus a native HTML/CSS→PDF renderer with a built-in
|
|
7
|
+
JavaScript engine, and a unified editable model that lowers/raises every format.
|
|
8
|
+
The engine `.wasm` is self-contained: **no third-party runtime dependencies**.
|
|
9
|
+
(OCR is a separate host-side native crate, `gigapdf-ocr-rten`.)
|
|
7
10
|
|
|
8
11
|
## Install
|
|
9
12
|
|
|
@@ -28,7 +31,7 @@ const doc = giga.open(pdfBytes); // Uint8Array
|
|
|
28
31
|
// Read
|
|
29
32
|
const lines = doc.structuredText(1); // [{ text, x, y, w, h }]
|
|
30
33
|
const hits = doc.search("invoice"); // [{ page, text, x, y, w, h }]
|
|
31
|
-
const
|
|
34
|
+
const text = doc.toText(); // whole-document plain text (exact, no OCR)
|
|
32
35
|
|
|
33
36
|
// Edit (operates on the real content stream — no cosmetic overlay)
|
|
34
37
|
doc.replaceText(1, 0, "New value");
|
|
@@ -171,9 +174,30 @@ const signed2 = doc.signP12(p12Bytes, "p12-password", {
|
|
|
171
174
|
date: "D:20260618120000Z",
|
|
172
175
|
location: "Paris",
|
|
173
176
|
});
|
|
177
|
+
|
|
178
|
+
// (c) PAdES-B-T — add an RFC 3161 trusted timestamp (async: one TSA round trip).
|
|
179
|
+
// Identity is the p12 above, or a self-signed id (random + notBefore/notAfter).
|
|
180
|
+
const timestamped = await doc.signTimestamped({
|
|
181
|
+
p12: p12Bytes, password: "p12-password", name: "Jane Doe",
|
|
182
|
+
tsaUrl: "https://freetsa.org/tsr",
|
|
183
|
+
// tsaFetch: custom fetch (auth / proxy / SSRF allow-list — recommended in prod)
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
// (d) PAdES-LTV — B-T plus a /DSS (chain + OCSP/CRL the host fetches), so the
|
|
187
|
+
// signature validates long-term. archiveTimestamp adds a B-LTA doc timestamp.
|
|
188
|
+
const ltv = await doc.signLtv({
|
|
189
|
+
p12: p12Bytes, password: "p12-password",
|
|
190
|
+
tsaUrl: "https://freetsa.org/tsr", archiveTimestamp: true,
|
|
191
|
+
// revocationFetch / crlFetch: override the OCSP/CRL HTTP (SSRF allow-list)
|
|
192
|
+
});
|
|
174
193
|
doc.close();
|
|
175
194
|
```
|
|
176
195
|
|
|
196
|
+
> Timestamping and LTV need network the WASM core can't perform, so the engine
|
|
197
|
+
> emits the request bytes and the SDK does the HTTP. The OCSP/CRL/TSA URLs are
|
|
198
|
+
> **host-supplied** (LTV URLs come from the certificates) — in production pass
|
|
199
|
+
> `tsaFetch` / `revocationFetch` / `crlFetch` to apply your own SSRF allow-list.
|
|
200
|
+
|
|
177
201
|
### Annotate, then flatten
|
|
178
202
|
|
|
179
203
|
```ts
|
|
@@ -210,14 +234,23 @@ const pdf = giga.htmlRender(html, fonts, 595, 842, 36); // A4 in points, 36pt m
|
|
|
210
234
|
// giga.htmlRenderWith(html, fonts, { pageSize: "A4", header, footer });
|
|
211
235
|
```
|
|
212
236
|
|
|
213
|
-
### Make a scanned PDF searchable (OCR → invisible text layer)
|
|
237
|
+
### Make a scanned PDF searchable (host OCR → invisible text layer)
|
|
238
|
+
|
|
239
|
+
OCR itself runs **host-side** — it lives in the separate native crate
|
|
240
|
+
`gigapdf-ocr-rten` (PaddleOCR PP-OCR on a pure-Rust runtime), whose model weights
|
|
241
|
+
are far heavier than the lean WASM core. This SDK provides the **text-layer**
|
|
242
|
+
side: `addTextLayer` stamps recognized words back onto the page so the scan
|
|
243
|
+
becomes selectable & searchable. (For PDFs that already carry text, use
|
|
244
|
+
`toText`/`structuredText`/`search` — exact, no OCR needed.)
|
|
214
245
|
|
|
215
246
|
```ts
|
|
216
247
|
const doc = giga.open(scannedPdf);
|
|
217
248
|
const scale = 2; // rasterise at 2× = 144 dpi for OCR
|
|
218
249
|
for (let page = 1; page <= doc.pageCount(); page++) {
|
|
219
250
|
const { height } = doc.pageInfo(page);
|
|
220
|
-
const
|
|
251
|
+
const png = doc.renderPage(page, scale); // raster the page for your OCR service…
|
|
252
|
+
const words = await ocrService(png); // … your host OCR → [{ x, y, w, h, text }]
|
|
253
|
+
// boxes in raster pixels (top-left)
|
|
221
254
|
// Map each word box back to PDF user space (bottom-left, Y up) and stamp an
|
|
222
255
|
// invisible (render-mode 3) text layer — selectable & searchable, pixel-aligned.
|
|
223
256
|
doc.addTextLayer(page, words.map((w) => ({
|
|
@@ -269,15 +302,18 @@ Or call `GigaPdfEngine.load(bytes)` with bytes you read yourself.
|
|
|
269
302
|
- **`GigaPdfEngine`** — `load`/`loadDefault`, `open`/`openEncrypted`,
|
|
270
303
|
`txtToPdf`/`htmlToPdf`/`rtfToPdf`/`officeToPdf`/`imageToPdf` (PNG/JPEG/GIF/WebP/AVIF → A4 page),
|
|
271
304
|
`mergePdfs` (concatenate many PDFs), `fontCatalog`/`fontRequestUrl`/`parseCssFontUrl`.
|
|
272
|
-
- **`GigaPdfDoc`** — text intelligence (`textRuns`, `structuredText`,
|
|
273
|
-
`
|
|
305
|
+
- **`GigaPdfDoc`** — text intelligence (`textRuns`, `structuredText`,
|
|
306
|
+
`pageBlocks`, `search`, `toText`, `elements`, `elementAt`, `documentLanguage`),
|
|
307
|
+
editing (`replaceText`, `setTextRunStyle` (per-character restyle),
|
|
274
308
|
`removeElement`, `moveElement`, `transformElement` (full affine — move + resize
|
|
275
309
|
+ rotate in place), `reorderElement` (native z-order — bring to front / send to
|
|
276
310
|
back), `setPathStyle` (in-place vector restyle: fill/stroke/width/dash + **real
|
|
277
311
|
opacity**), `setElementOpacity` (constant opacity on any element — text/image/shape),
|
|
278
|
-
`duplicateElement`, `redact`),
|
|
312
|
+
`duplicateElement`, `redact`, `redactPii` (irreversible — erases image pixels)),
|
|
313
|
+
vector drawing
|
|
279
314
|
(`addRectangle`, `drawLine`, `addEllipse`, `addPolygon`, `addPath` (SVG path),
|
|
280
|
-
`addImage` (PNG/JPEG, alpha + opacity)
|
|
315
|
+
`addImage` (PNG/JPEG, alpha + opacity), `addImageWatermark` (stamp an image
|
|
316
|
+
across pages), `addSvg` (native vector)), pages (`rotatePage`, `deletePage`,
|
|
281
317
|
`movePage`, `appendPages`, `extractPages`, `resizePage`, `addPage`, `copyPage`,
|
|
282
318
|
`pageInfo`),
|
|
283
319
|
`renderPage` (and `renderPageNoText` — a text-free background for editors that
|
|
@@ -287,12 +323,14 @@ Or call `GigaPdfEngine.load(bytes)` with bytes you read yourself.
|
|
|
287
323
|
fonts (base-14 `addStandardText`, embed **any** TrueType/OpenType
|
|
288
324
|
via `embedFont`/`addText`, font-aware editing `replaceText`,
|
|
289
325
|
the document's own faces `embeddedFonts`/`extractFont`, `neededFonts`),
|
|
290
|
-
conversions (`toText/Html/Docx/Pptx/Odp/Odt/Xlsx/Ods/Rtf/PdfA`,
|
|
291
|
-
engine-level `gridsToXlsx`/`gridsToOds` to
|
|
292
|
-
host-built table grid), security
|
|
293
|
-
(`saveEncrypted
|
|
294
|
-
|
|
295
|
-
|
|
326
|
+
conversions (`toText/Html/Docx/Pptx/Odp/Odt/Xlsx/Ods/Rtf/PdfA`, `toModel` for
|
|
327
|
+
the unified editable model, plus engine-level `gridsToXlsx`/`gridsToOds` to
|
|
328
|
+
emit Office output from a host-built table grid), security
|
|
329
|
+
(`saveEncrypted` (AES-256 R6) + `permissionsToP`/`getPermissions`; **digital
|
|
330
|
+
signatures**: self-signed `sign`, **PKCS#12** `signP12`, **PAdES-B-T** timestamped
|
|
331
|
+
`signTimestamped` (RFC 3161 TSA), **PAdES-LTV** `signLtv` (DSS + OCSP/CRL, B-LT/B-LTA)),
|
|
332
|
+
metadata (`getMetadata`, `setMetadata`), embedded files (`attachments` — extract
|
|
333
|
+
every `/EmbeddedFiles` entry with its decoded bytes), annotations (`addSquare`,
|
|
296
334
|
`addHighlight`, `addLineAnnotation`, `addFreeText`, `addUnderline`,
|
|
297
335
|
`addStrikeOut`, `addInk`, `addStamp`, `annotations`, `removeAnnotation`,
|
|
298
336
|
`flattenAnnotations`), links (`links`, `addUriLink`, `addGotoLink`, named
|
|
@@ -300,7 +338,9 @@ Or call `GigaPdfEngine.load(bytes)` with bytes you read yourself.
|
|
|
300
338
|
(`outline`, `setOutline`), forms — read/fill (`fields`, `setTextField`,
|
|
301
339
|
`setCheckbox`, `setRadio`, `setChoice`) **and create**
|
|
302
340
|
(`addTextField`, `addCheckbox`, `addRadioGroup`, `addComboBox`, `addListBox`,
|
|
303
|
-
each with an optional `FieldStyle`)
|
|
341
|
+
each with an optional `FieldStyle`) plus `flattenForm` / `flattenFormXObjects`,
|
|
342
|
+
margins & running header/footer (`pageMargins`/`setPageMargins`,
|
|
343
|
+
`setHeader`/`setFooter`/`headerFooter`), and optional-content layers (`layers`,
|
|
304
344
|
`addLayer`, `setLayerVisibility`, `setLayerLocked`, `removeLayer`).
|
|
305
345
|
- **HTML rendering engine** (on `GigaPdfEngine`) — `htmlNeededFonts(html)`
|
|
306
346
|
returns the Google fonts to download (phase 1); `htmlRender(html, fonts,
|
package/gigapdf.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qrcommunication/gigapdf-lib",
|
|
3
|
-
"version": "0.71.
|
|
3
|
+
"version": "0.71.1",
|
|
4
4
|
"description": "TypeScript SDK for gigapdf-lib — a Rust→WASM document engine with no third-party PDF/Office/image library: read/edit/render, OCR, full-text search, AcroForm fields (read · fill · create), annotations, signing, encryption, PDF↔Office/HTML/RTF conversions, and a native HTML+CSS→PDF renderer with inline JavaScript (no headless browser). Cryptography uses audited RustCrypto; JavaScript uses the Boa engine; everything else is pure Rust. Single wasm-bindgen-free .wasm with one host import (entropy).",
|
|
5
5
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
6
6
|
"author": "Rony Licha / QR Communication",
|