postext-pdf 1.46.0 → 1.46.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/README.md
CHANGED
|
@@ -49,6 +49,8 @@ In the browser, load the web fonts (`document.fonts.load(...)`) before calling `
|
|
|
49
49
|
- `renderToPdf(doc | doc[], options)` — renders one document or a whole book (an array of chapters) to PDF bytes. Options: `fontProvider` (required; asked only for the faces the pages paint), `resourceBytes` (images, SVGs and single-page PDF masters by file id; an SVG figure's `svg.pdfFileId` master is asked for first), `outlines`, `accessible`, `colorSpace` (each one, when left out, from the first document's `config.pdfGeneration`, `colorSpace` only while its `forceColorSpace` is on; else bookmarks on, tagged, RGB), `pageNegative`, `characterGrid` (draws the character grid of `cjk.grid.show`, off by default), `onProgress`, `onWarning` (a face the provider rejects is set in another cut of its family — the nearest standard weight in CSS font-matching order, same style first, then the other style — and reported here, `console.warn` by default; the render fails only when the provider has no cut of the family at all), `rasterizeSvg`, `harfbuzzWasm` (where to load `harfbuzz.wasm` from, a URL or its bytes; see below), `print` (PDF/X standard, output profile, black handling; else the first document's `config.print`), `outputProfile` (the ICC output profile's bytes), `profileBaseUrl` (where catalogue profiles are fetched from when no bytes are given), `date` (the file's creation and modification date, and a PDF/X file's XMP dates and document id; the same document and date give the same bytes, and without it the file carries the time of the call).
|
|
50
50
|
- `decompressWoff2(bytes)` — WOFF2 → TTF/OTF, for font providers that fetch web fonts.
|
|
51
51
|
- `postext-pdf/worker` — `createPdfWorker()` renders off the main thread; fonts and SVG rasters are still resolved on the caller's thread when the worker asks for them. `postext-pdf/worker/entry` is the worker script for bundlers that want to control the worker URL. From a CDN such as esm.sh, start the worker yourself from a same-origin blob that imports the entry — `createPdfWorker({ worker: new Worker(URL.createObjectURL(new Blob(["import 'https://esm.sh/postext-pdf/worker/entry';"], { type: 'text/javascript' })), { type: 'module' }) })` — because a page cannot start a worker script from another origin.
|
|
52
|
+
- `declaredFontFile(bytes, { unicodeRange, order })` — marks a font file the provider returns with the `unicode-range` and order of the `@font-face` rule it came from, for a family split into several files.
|
|
53
|
+
- `inspectPrintMaster(bytes)` — reports what the first page of a PDF print master brings into a print file: fonts it does not embed, RGB colour, transparency (which PDF/X-1a forbids). The Sandbox's preflight reads it.
|
|
52
54
|
- Helpers: `svgToVectorDrawing`, `sniffBytes`, `rasterizeSvgWithDom`.
|
|
53
55
|
|
|
54
56
|
## WOFF2 decoding and bundlers
|
|
@@ -15,7 +15,7 @@ describe('the documented renderToPdf options', () => {
|
|
|
15
15
|
});
|
|
16
16
|
for (const doc of ['configuration-pdf-output-en.mdx', 'configuration-pdf-output-es.mdx']) {
|
|
17
17
|
it(`are all listed in the RenderToPdfOptions summary of ${doc}`, () => {
|
|
18
|
-
const summary = /\*\*`RenderToPdfOptions`\*\*
|
|
18
|
+
const summary = /\*\*`RenderToPdfOptions`\*\*(?: —|:) `\{([^}]*)\}`/.exec(read(`../../../../docs/${doc}`))?.[1] ?? '';
|
|
19
19
|
const listed = summary.split(',').map((f) => f.trim().replace(/\?$/, '')).filter(Boolean).sort();
|
|
20
20
|
expect(listed).toEqual(FIELDS);
|
|
21
21
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderOptionsDocs.test.js","sourceRoot":"","sources":["../../src/__tests__/renderOptionsDocs.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,oEAAoE;AACpE,0EAA0E;AAC1E,yDAAyD;AAEzD,MAAM,IAAI,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;AAE/F,MAAM,MAAM,GAAG,IAAI,CAAC,yBAAyB,CAAC,CAAC;AAC/C,M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AED,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC,IAAI,IAAI,GAAG,8DAA8D,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACnH,2DAA2D;QAC3D,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;YAAE,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;QACvE,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACvE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postext-pdf",
|
|
3
|
-
"version": "1.46.
|
|
3
|
+
"version": "1.46.2",
|
|
4
4
|
"description": "Browser-native PDF renderer for Postext documents. Consumes the same VDT as the canvas/HTML backends and produces a physical PDF with faithful glyph positioning, justification, crop marks, and baseline grid.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"./package.json": "./package.json"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"postext": "^1.46.
|
|
43
|
+
"postext": "^1.46.2"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@pdf-lib/fontkit": "^1.1.1",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@types/node": "^26.5.0",
|
|
55
55
|
"eslint": "^9.39.4",
|
|
56
56
|
"harfbuzzjs": "1.6.2",
|
|
57
|
-
"postext": "1.46.
|
|
57
|
+
"postext": "1.46.2",
|
|
58
58
|
"typescript": "^6.0.3",
|
|
59
59
|
"typescript-eslint": "^8.70.0",
|
|
60
60
|
"vitest": "^5.0.0"
|