pulpweaver4 0.0.91 → 0.0.185
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/dist/ast/djot.js +23 -0
- package/dist/ast/djot.js.map +1 -1
- package/dist/ast/index.d.ts +1 -0
- package/dist/ast/index.js +1 -0
- package/dist/ast/index.js.map +1 -1
- package/dist/ast/nodes.d.ts +59 -5
- package/dist/ast/nodes.js.map +1 -1
- package/dist/ast/table.d.ts +27 -0
- package/dist/ast/table.js +32 -0
- package/dist/ast/table.js.map +1 -0
- package/dist/browser.js +2420 -0
- package/dist/citations/index.d.ts +1 -1
- package/dist/citations/index.js +1 -1
- package/dist/citations/index.js.map +1 -1
- package/dist/citations/project.d.ts +12 -2
- package/dist/citations/project.js +21 -7
- package/dist/citations/project.js.map +1 -1
- package/dist/colour/images.d.ts +11 -2
- package/dist/colour/images.js +53 -3
- package/dist/colour/images.js.map +1 -1
- package/dist/colour/ink-limit.d.ts +2 -2
- package/dist/colour/ink-limit.js +6 -0
- package/dist/colour/ink-limit.js.map +1 -1
- package/dist/colour/previews.d.ts +8 -4
- package/dist/colour/previews.js +11 -8
- package/dist/colour/previews.js.map +1 -1
- package/dist/config/config.d.ts +91 -3
- package/dist/config/config.js +200 -3
- package/dist/config/config.js.map +1 -1
- package/dist/config/project-schema.d.ts +0 -8
- package/dist/config/project-schema.js +207 -12
- package/dist/config/project-schema.js.map +1 -1
- package/dist/config/schema.js +10 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/config/secrets.d.ts +11 -0
- package/dist/config/secrets.js +19 -0
- package/dist/config/secrets.js.map +1 -0
- package/dist/csl/project.d.ts +19 -4
- package/dist/csl/project.js +23 -10
- package/dist/csl/project.js.map +1 -1
- package/dist/fonts/index.d.ts +1 -1
- package/dist/fonts/index.js +1 -1
- package/dist/fonts/index.js.map +1 -1
- package/dist/fonts/lint.d.ts +51 -0
- package/dist/fonts/lint.js +101 -16
- package/dist/fonts/lint.js.map +1 -1
- package/dist/fonts/walk.d.ts +13 -0
- package/dist/fonts/walk.js +50 -33
- package/dist/fonts/walk.js.map +1 -1
- package/dist/html/css.d.ts +4 -0
- package/dist/html/css.js +11 -3
- package/dist/html/css.js.map +1 -1
- package/dist/html/dom.d.ts +6 -1
- package/dist/html/dom.js +28 -6
- package/dist/html/dom.js.map +1 -1
- package/dist/html/generated.d.ts +17 -0
- package/dist/html/generated.js +21 -0
- package/dist/html/generated.js.map +1 -0
- package/dist/html/images.d.ts +18 -0
- package/dist/html/images.js +49 -2
- package/dist/html/images.js.map +1 -1
- package/dist/html/index.d.ts +1 -0
- package/dist/html/index.js +1 -0
- package/dist/html/index.js.map +1 -1
- package/dist/html/render.d.ts +5 -4
- package/dist/html/render.js +24 -6
- package/dist/html/render.js.map +1 -1
- package/dist/hyphenation/exceptions.d.ts +5 -0
- package/dist/hyphenation/exceptions.js +11 -0
- package/dist/hyphenation/exceptions.js.map +1 -1
- package/dist/hyphenation/index.d.ts +1 -1
- package/dist/hyphenation/index.js +1 -1
- package/dist/hyphenation/index.js.map +1 -1
- package/dist/import/convert.d.ts +21 -0
- package/dist/import/convert.js +65 -0
- package/dist/import/convert.js.map +1 -0
- package/dist/incremental/cache.d.ts +59 -0
- package/dist/incremental/cache.js +64 -0
- package/dist/incremental/cache.js.map +1 -0
- package/dist/incremental/index.d.ts +3 -0
- package/dist/incremental/index.js +4 -0
- package/dist/incremental/index.js.map +1 -0
- package/dist/incremental/keys.d.ts +27 -0
- package/dist/incremental/keys.js +89 -0
- package/dist/incremental/keys.js.map +1 -0
- package/dist/incremental/session.d.ts +180 -0
- package/dist/incremental/session.js +401 -0
- package/dist/incremental/session.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/indexes/layout.d.ts +8 -2
- package/dist/indexes/layout.js +6 -4
- package/dist/indexes/layout.js.map +1 -1
- package/dist/layout/cache.d.ts +174 -0
- package/dist/layout/cache.js +150 -0
- package/dist/layout/cache.js.map +1 -0
- package/dist/layout/converge.d.ts +28 -0
- package/dist/layout/converge.js +102 -9
- package/dist/layout/converge.js.map +1 -1
- package/dist/layout/counters.d.ts +4 -0
- package/dist/layout/counters.js +15 -0
- package/dist/layout/counters.js.map +1 -1
- package/dist/layout/index.d.ts +5 -2
- package/dist/layout/index.js +3 -0
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/lists.d.ts +52 -3
- package/dist/layout/lists.js +513 -46
- package/dist/layout/lists.js.map +1 -1
- package/dist/layout/lookahead.d.ts +151 -0
- package/dist/layout/lookahead.js +581 -0
- package/dist/layout/lookahead.js.map +1 -0
- package/dist/layout/margin-boxes.d.ts +11 -1
- package/dist/layout/margin-boxes.js +24 -1
- package/dist/layout/margin-boxes.js.map +1 -1
- package/dist/layout/page-rules.d.ts +6 -1
- package/dist/layout/page-rules.js +42 -1
- package/dist/layout/page-rules.js.map +1 -1
- package/dist/layout/page.js +4 -2
- package/dist/layout/page.js.map +1 -1
- package/dist/layout/pagebuilder.d.ts +248 -3
- package/dist/layout/pagebuilder.js +512 -19
- package/dist/layout/pagebuilder.js.map +1 -1
- package/dist/layout/pages.d.ts +108 -1
- package/dist/layout/pages.js +1362 -159
- package/dist/layout/pages.js.map +1 -1
- package/dist/layout/paragraph.d.ts +14 -0
- package/dist/layout/paragraph.js +304 -31
- package/dist/layout/paragraph.js.map +1 -1
- package/dist/layout/pre.js +4 -0
- package/dist/layout/pre.js.map +1 -1
- package/dist/layout/protrusion.d.ts +26 -0
- package/dist/layout/protrusion.js +39 -0
- package/dist/layout/protrusion.js.map +1 -0
- package/dist/layout/ranges.d.ts +2 -0
- package/dist/layout/ranges.js +22 -0
- package/dist/layout/ranges.js.map +1 -0
- package/dist/layout/region.d.ts +2 -1
- package/dist/layout/region.js +9 -5
- package/dist/layout/region.js.map +1 -1
- package/dist/layout/templates.d.ts +71 -0
- package/dist/layout/templates.js +290 -0
- package/dist/layout/templates.js.map +1 -0
- package/dist/layout/vlist.d.ts +3 -3
- package/dist/linebreak/items.d.ts +27 -2
- package/dist/linebreak/items.js +10 -3
- package/dist/linebreak/items.js.map +1 -1
- package/dist/linebreak/knuth-plass.d.ts +20 -0
- package/dist/linebreak/knuth-plass.js +68 -16
- package/dist/linebreak/knuth-plass.js.map +1 -1
- package/dist/lint/book.d.ts +13 -0
- package/dist/lint/book.js +52 -0
- package/dist/lint/book.js.map +1 -0
- package/dist/lint/config.d.ts +9 -0
- package/dist/lint/config.js +40 -6
- package/dist/lint/config.js.map +1 -1
- package/dist/lint/linter.js +1 -0
- package/dist/lint/linter.js.map +1 -1
- package/dist/lint/project.js +1 -1
- package/dist/lint/project.js.map +1 -1
- package/dist/lint/rules/layout.d.ts +3 -1
- package/dist/lint/rules/layout.js +8 -6
- package/dist/lint/rules/layout.js.map +1 -1
- package/dist/lint/rules/source.js +1 -1
- package/dist/lint/rules/source.js.map +1 -1
- package/dist/lint/testing.js +1 -0
- package/dist/lint/testing.js.map +1 -1
- package/dist/measure/bidi-data.d.ts +14 -0
- package/dist/measure/bidi-data.js +69 -0
- package/dist/measure/bidi-data.js.map +1 -0
- package/dist/measure/bidi.d.ts +70 -0
- package/dist/measure/bidi.js +225 -0
- package/dist/measure/bidi.js.map +1 -0
- package/dist/measure/css.d.ts +5 -0
- package/dist/measure/css.js +2 -0
- package/dist/measure/css.js.map +1 -1
- package/dist/measure/measurer.d.ts +36 -2
- package/dist/measure/measurer.js +220 -22
- package/dist/measure/measurer.js.map +1 -1
- package/dist/measure/model.d.ts +20 -2
- package/dist/measure/model.js +13 -6
- package/dist/measure/model.js.map +1 -1
- package/dist/measure/script-data.d.ts +6 -0
- package/dist/measure/script-data.js +34 -0
- package/dist/measure/script-data.js.map +1 -0
- package/dist/measure/scripts.d.ts +36 -0
- package/dist/measure/scripts.js +293 -0
- package/dist/measure/scripts.js.map +1 -0
- package/dist/output/output.d.ts +35 -3
- package/dist/output/output.js +26 -4
- package/dist/output/output.js.map +1 -1
- package/dist/paint/backgrounds.js +7 -20
- package/dist/paint/backgrounds.js.map +1 -1
- package/dist/paint/blend.d.ts +33 -13
- package/dist/paint/blend.js +73 -21
- package/dist/paint/blend.js.map +1 -1
- package/dist/paint/cache.d.ts +80 -0
- package/dist/paint/cache.js +537 -0
- package/dist/paint/cache.js.map +1 -0
- package/dist/paint/canvas.d.ts +4 -13
- package/dist/paint/canvas.js +45 -5
- package/dist/paint/canvas.js.map +1 -1
- package/dist/paint/context.d.ts +2 -0
- package/dist/paint/emphasis.js +1 -1
- package/dist/paint/emphasis.js.map +1 -1
- package/dist/paint/flatten.d.ts +24 -2
- package/dist/paint/flatten.js +55 -12
- package/dist/paint/flatten.js.map +1 -1
- package/dist/paint/forms.d.ts +64 -0
- package/dist/paint/forms.js +319 -0
- package/dist/paint/forms.js.map +1 -0
- package/dist/paint/images.d.ts +4 -1
- package/dist/paint/images.js +13 -2
- package/dist/paint/images.js.map +1 -1
- package/dist/paint/layers.d.ts +64 -0
- package/dist/paint/layers.js +137 -0
- package/dist/paint/layers.js.map +1 -0
- package/dist/paint/painter.d.ts +19 -6
- package/dist/paint/painter.js +15 -135
- package/dist/paint/painter.js.map +1 -1
- package/dist/paint/stacking.d.ts +1 -1
- package/dist/paint/stacking.js +9 -2
- package/dist/paint/stacking.js.map +1 -1
- package/dist/paint/text.d.ts +14 -3
- package/dist/paint/text.js +25 -4
- package/dist/paint/text.js.map +1 -1
- package/dist/paint/vertical.js +2 -2
- package/dist/paint/vertical.js.map +1 -1
- package/dist/pdf/encoded.d.ts +16 -0
- package/dist/pdf/encoded.js +35 -0
- package/dist/pdf/encoded.js.map +1 -0
- package/dist/pdf/include/colour.d.ts +105 -0
- package/dist/pdf/include/colour.js +349 -0
- package/dist/pdf/include/colour.js.map +1 -0
- package/dist/pdf/include/functions.d.ts +17 -0
- package/dist/pdf/include/functions.js +389 -0
- package/dist/pdf/include/functions.js.map +1 -0
- package/dist/pdf/include/pages.d.ts +14 -0
- package/dist/pdf/include/pages.js +27 -0
- package/dist/pdf/include/pages.js.map +1 -0
- package/dist/pdf/include/pdfjs/LICENSE +177 -0
- package/dist/pdf/include/pdfjs/pdf.min.mjs +27 -0
- package/dist/pdf/include/pdfjs/pdf.worker.min.mjs +27 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
- package/dist/pdf/include/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
- package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
- package/dist/pdf/include/pdfjs/wasm/LICENSE_JBIG2 +196 -0
- package/dist/pdf/include/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
- package/dist/pdf/include/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
- package/dist/pdf/include/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
- package/dist/pdf/include/pdfjs/wasm/LICENSE_PDFJS_QCMS +19 -0
- package/dist/pdf/include/pdfjs/wasm/LICENSE_QCMS +21 -0
- package/dist/pdf/include/pdfjs/wasm/jbig2.wasm +0 -0
- package/dist/pdf/include/pdfjs/wasm/openjpeg.wasm +0 -0
- package/dist/pdf/include/pdfjs/wasm/qcms_bg.wasm +0 -0
- package/dist/pdf/include/pdfjs/wasm/quickjs-eval.wasm +0 -0
- package/dist/pdf/include/prepare.d.ts +58 -0
- package/dist/pdf/include/prepare.js +266 -0
- package/dist/pdf/include/prepare.js.map +1 -0
- package/dist/pdf/include/preview.d.ts +38 -0
- package/dist/pdf/include/preview.js +101 -0
- package/dist/pdf/include/preview.js.map +1 -0
- package/dist/pdf/include/rewrite.d.ts +57 -0
- package/dist/pdf/include/rewrite.js +803 -0
- package/dist/pdf/include/rewrite.js.map +1 -0
- package/dist/pdf/include/serialize.d.ts +32 -0
- package/dist/pdf/include/serialize.js +158 -0
- package/dist/pdf/include/serialize.js.map +1 -0
- package/dist/pdf/include/testing.d.ts +26 -0
- package/dist/pdf/include/testing.js +50 -0
- package/dist/pdf/include/testing.js.map +1 -0
- package/dist/pdf/index.d.ts +1 -0
- package/dist/pdf/index.js +1 -0
- package/dist/pdf/index.js.map +1 -1
- package/dist/pdf/structure/annotations.d.ts +33 -0
- package/dist/pdf/structure/annotations.js +112 -0
- package/dist/pdf/structure/annotations.js.map +1 -0
- package/dist/pdf/structure/forms.d.ts +10 -0
- package/dist/pdf/structure/forms.js +46 -0
- package/dist/pdf/structure/forms.js.map +1 -0
- package/dist/pdf/structure/index.d.ts +41 -5
- package/dist/pdf/structure/index.js +40 -5
- package/dist/pdf/structure/index.js.map +1 -1
- package/dist/pdf/structure/links.d.ts +2 -0
- package/dist/pdf/structure/links.js +1 -1
- package/dist/pdf/structure/links.js.map +1 -1
- package/dist/pdf/structure/presentation.d.ts +28 -0
- package/dist/pdf/structure/presentation.js +79 -0
- package/dist/pdf/structure/presentation.js.map +1 -0
- package/dist/pdf/structure/tags.d.ts +34 -2
- package/dist/pdf/structure/tags.js +117 -14
- package/dist/pdf/structure/tags.js.map +1 -1
- package/dist/pdf/types.d.ts +357 -11
- package/dist/pdf/wasm/pulpweaver4_pdf.d.ts +44 -2
- package/dist/pdf/wasm/pulpweaver4_pdf.js +191 -2
- package/dist/pdf/wasm/pulpweaver4_pdf_bg.wasm +0 -0
- package/dist/pdf/writer.d.ts +13 -1
- package/dist/pdf/writer.js +26 -1
- package/dist/pdf/writer.js.map +1 -1
- package/dist/plugin/define.d.ts +200 -15
- package/dist/plugin/define.js +124 -15
- package/dist/plugin/define.js.map +1 -1
- package/dist/plugin/failure.d.ts +1 -1
- package/dist/plugin/index.d.ts +5 -4
- package/dist/plugin/index.js +5 -4
- package/dist/plugin/index.js.map +1 -1
- package/dist/plugin/reference.d.ts +38 -0
- package/dist/plugin/reference.js +287 -0
- package/dist/plugin/reference.js.map +1 -0
- package/dist/plugin/register.d.ts +39 -7
- package/dist/plugin/register.js +83 -2
- package/dist/plugin/register.js.map +1 -1
- package/dist/preflight/index.d.ts +1 -1
- package/dist/preflight/index.js +1 -1
- package/dist/preflight/index.js.map +1 -1
- package/dist/preflight/pdfx.d.ts +35 -0
- package/dist/preflight/pdfx.js +33 -2
- package/dist/preflight/pdfx.js.map +1 -1
- package/dist/preflight/reader.d.ts +10 -3
- package/dist/preflight/reader.js +86 -5
- package/dist/preflight/reader.js.map +1 -1
- package/dist/print/impose.d.ts +66 -0
- package/dist/print/impose.js +331 -0
- package/dist/print/impose.js.map +1 -0
- package/dist/print/output.js +400 -50
- package/dist/print/output.js.map +1 -1
- package/dist/problem.js +4 -3
- package/dist/problem.js.map +1 -1
- package/dist/profile/index.d.ts +1 -0
- package/dist/profile/index.js +1 -0
- package/dist/profile/index.js.map +1 -1
- package/dist/profile/lint.d.ts +1 -1
- package/dist/profile/lint.js +29 -1
- package/dist/profile/lint.js.map +1 -1
- package/dist/profile/list-table.d.ts +51 -0
- package/dist/profile/list-table.js +137 -0
- package/dist/profile/list-table.js.map +1 -0
- package/dist/profile/metadata.js +3 -0
- package/dist/profile/metadata.js.map +1 -1
- package/dist/profile/profile.d.ts +3 -0
- package/dist/profile/profile.js +9 -1
- package/dist/profile/profile.js.map +1 -1
- package/dist/project.js +3 -0
- package/dist/project.js.map +1 -1
- package/dist/qpdf/index.d.ts +2 -0
- package/dist/qpdf/index.js +3 -0
- package/dist/qpdf/index.js.map +1 -0
- package/dist/qpdf/qpdf.d.ts +125 -0
- package/dist/qpdf/qpdf.js +205 -0
- package/dist/qpdf/qpdf.js.map +1 -0
- package/dist/qpdf/testing.d.ts +12 -0
- package/dist/qpdf/testing.js +9 -0
- package/dist/qpdf/testing.js.map +1 -0
- package/dist/qpdf/wasm/LICENSE-qpdf +202 -0
- package/dist/qpdf/wasm/LICENSE-zlib +22 -0
- package/dist/qpdf/wasm/NOTICE-qpdf.md +42 -0
- package/dist/qpdf/wasm/qpdf.wasm +0 -0
- package/dist/render/index.d.ts +3 -0
- package/dist/render/index.js +2 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/render.d.ts +98 -0
- package/dist/render/render.js +243 -0
- package/dist/render/render.js.map +1 -0
- package/dist/reproducible/clock.d.ts +4 -5
- package/dist/reproducible/clock.js +4 -5
- package/dist/reproducible/clock.js.map +1 -1
- package/dist/spike/spike-page.chromium.json +4 -4
- package/dist/style/colours.d.ts +7 -2
- package/dist/style/colours.js +24 -2
- package/dist/style/colours.js.map +1 -1
- package/dist/style/compile.js +1 -1
- package/dist/style/compile.js.map +1 -1
- package/dist/style/defaults.d.ts +9 -3
- package/dist/style/defaults.js +14 -2
- package/dist/style/defaults.js.map +1 -1
- package/dist/style/gcpm.d.ts +1 -1
- package/dist/style/gcpm.js +17 -5
- package/dist/style/gcpm.js.map +1 -1
- package/dist/style/properties.js +84 -0
- package/dist/style/properties.js.map +1 -1
- package/dist/test/book.d.ts +22 -2
- package/dist/test/book.js +35 -2
- package/dist/test/book.js.map +1 -1
- package/dist/test/build.d.ts +23 -0
- package/dist/test/build.js +86 -33
- package/dist/test/build.js.map +1 -1
- package/dist/test/layout.js +128 -19
- package/dist/test/layout.js.map +1 -1
- package/dist/test/limits.d.ts +8 -0
- package/dist/test/limits.js +9 -0
- package/dist/test/limits.js.map +1 -0
- package/dist/test/pipeline.d.ts +23 -0
- package/dist/test/pipeline.js.map +1 -1
- package/dist/test/render.d.ts +26 -3
- package/dist/test/render.js +151 -23
- package/dist/test/render.js.map +1 -1
- package/dist/test/runner.d.ts +6 -3
- package/dist/test/runner.js +172 -105
- package/dist/test/runner.js.map +1 -1
- package/dist/test/text.js +2 -2
- package/dist/test/text.js.map +1 -1
- package/dist/text/output.js +2 -2
- package/dist/text/output.js.map +1 -1
- package/dist/text/render.d.ts +4 -3
- package/dist/text/render.js +126 -4
- package/dist/text/render.js.map +1 -1
- package/dist/transform/index.d.ts +1 -1
- package/dist/transform/index.js +1 -1
- package/dist/transform/index.js.map +1 -1
- package/dist/transform/run.d.ts +2 -0
- package/dist/transform/run.js +32 -16
- package/dist/transform/run.js.map +1 -1
- package/dist/web/output.js +116 -10
- package/dist/web/output.js.map +1 -1
- package/dist/web/runtime/justify.js.txt +2 -2
- package/dist/web/site.d.ts +2 -0
- package/dist/web/site.js +8 -1
- package/dist/web/site.js.map +1 -1
- package/docs/README.md +6 -1
- package/docs/manual/chapters/front.dj +34 -0
- package/docs/manual/chapters/guides/citations.dj +426 -0
- package/docs/manual/chapters/guides/colour-and-prepress.dj +261 -0
- package/docs/manual/chapters/guides/editions.dj +329 -0
- package/docs/manual/chapters/guides/in-a-web-page.dj +143 -0
- package/docs/manual/chapters/guides/lines-and-pages.dj +681 -0
- package/docs/manual/chapters/guides/lint-rules.dj +355 -0
- package/docs/manual/chapters/guides/pdfs.dj +501 -0
- package/docs/manual/chapters/guides/plugins.dj +425 -0
- package/docs/manual/chapters/guides/testing.dj +264 -0
- package/docs/manual/chapters/guides/writing-in-djot.dj +537 -0
- package/docs/manual/chapters/start/for-latex-users.dj +256 -0
- package/docs/manual/chapters/start/getting-started.dj +167 -0
- package/docs/manual/chapters/start/your-first-book.dj +426 -0
- package/docs/manual/fonts/CrimsonPro-Italic-VF.ttf +0 -0
- package/docs/manual/fonts/CrimsonPro-VF.ttf +0 -0
- package/docs/manual/fonts/JetBrainsMono-Regular.otf +0 -0
- package/docs/manual/fonts/NotoSansSymbols2-Boxes.ttf +0 -0
- package/docs/manual/fonts/OFL.txt +95 -0
- package/docs/manual/pulpweaver4.toml +39 -0
- package/docs/manual/styles/manual.css +137 -0
- package/docs/reference/css-properties/index.md +9 -0
- package/docs/reference/css-properties/pw-expansion.md +31 -0
- package/docs/reference/css-properties/pw-flow-into.md +31 -0
- package/docs/reference/css-properties/pw-knockout.md +26 -0
- package/docs/reference/css-properties/pw-layer.md +24 -0
- package/docs/reference/css-properties/pw-page-breaking.md +30 -0
- package/docs/reference/css-properties/pw-page-duration.md +28 -0
- package/docs/reference/css-properties/pw-page-rotate.md +29 -0
- package/docs/reference/css-properties/pw-page-transition.md +29 -0
- package/docs/reference/css-properties/pw-protrusion.md +31 -0
- package/docs/reference/lint-rules/ibid-across-page.md +2 -2
- package/docs/reference/plugin-api/capabilities.md +2 -2
- package/docs/reference/plugin-api/claim-kind.md +1 -1
- package/docs/reference/plugin-api/combine-exceptions.md +19 -0
- package/docs/reference/plugin-api/element-break-context.md +34 -0
- package/docs/reference/plugin-api/element-break-item.md +24 -0
- package/docs/reference/plugin-api/element-breaker.md +24 -0
- package/docs/reference/plugin-api/flow-definition.md +30 -0
- package/docs/reference/plugin-api/generated-reference.md +32 -0
- package/docs/reference/plugin-api/index-definition.md +32 -0
- package/docs/reference/plugin-api/index-titles.md +18 -0
- package/docs/reference/plugin-api/index.md +27 -3
- package/docs/reference/plugin-api/insert-class-definition.md +46 -0
- package/docs/reference/plugin-api/insert-placement.md +22 -0
- package/docs/reference/plugin-api/insert-placements.md +18 -0
- package/docs/reference/plugin-api/layout-definition.md +9 -5
- package/docs/reference/plugin-api/layout-slot.md +6 -16
- package/docs/reference/plugin-api/lint-context.md +3 -1
- package/docs/reference/plugin-api/lint-definition.md +1 -1
- package/docs/reference/plugin-api/lint-edition.md +2 -0
- package/docs/reference/plugin-api/page-builder-event.md +22 -0
- package/docs/reference/plugin-api/page-builder-hook.md +7 -3
- package/docs/reference/plugin-api/page-builder-page-event.md +30 -0
- package/docs/reference/plugin-api/page-template-definition.md +34 -0
- package/docs/reference/plugin-api/page-template-region-definition.md +46 -0
- package/docs/reference/plugin-api/plugin-definition.md +5 -1
- package/docs/reference/plugin-api/plugin-reference-options.md +32 -0
- package/docs/reference/plugin-api/plugin-reference.md +22 -0
- package/docs/reference/plugin-api/plugin-registry.md +15 -5
- package/docs/reference/plugin-api/plugin-stage.md +1 -1
- package/docs/reference/plugin-api/plugin.md +9 -2
- package/docs/reference/plugin-api/reference-page.md +34 -0
- package/docs/reference/plugin-api/render-reference-page.md +18 -0
- package/docs/reference/plugin-api/renderers.md +1 -1
- package/docs/reference/pulpweaver4-toml/editions.md +239 -2
- package/docs/reference/pulpweaver4-toml/index.md +44 -1
- package/docs/reference/pulpweaver4-toml/inks.md +15 -4
- package/docs/reference/pulpweaver4-toml/lint.md +1 -1
- package/package.json +5 -1
package/dist/project.js
CHANGED
|
@@ -83,6 +83,9 @@ function checkFiles(config, files, document) {
|
|
|
83
83
|
if (config.citationStyle?.endsWith('.csl') && !files.includes(config.citationStyle))
|
|
84
84
|
missing(['citation-style'], config.citationStyle, 'the citation style');
|
|
85
85
|
for (const edition of Object.values(config.editions)) {
|
|
86
|
+
const { style, at } = edition.citations;
|
|
87
|
+
if (style?.endsWith('.csl') && at.style?.[0] === 'editions' && !files.includes(style))
|
|
88
|
+
missing(at.style, style, 'the citation style');
|
|
86
89
|
const intent = edition.outputIntent;
|
|
87
90
|
if (intent !== undefined && /\.(icc|icm)$/i.test(intent) && !files.includes(intent)) {
|
|
88
91
|
missing(['editions', edition.name, 'output-intent'], intent, 'the output intent');
|
package/dist/project.js.map
CHANGED
|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pdf in WebAssembly: encryption, linearization and object streams; and reading one back. */
|
|
2
|
+
export { initQpdf, inspectPdf, MAX_PASSWORD_BYTES, PDF_PERMISSIONS, pdfPassword, QPDF_WASM_URL, rewritePdf, withheldPermissions, type PdfEncryption, type PdfInspection, type PdfPermission, type QpdfWasmSource, type RewriteOptions, } from './qpdf.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** What is done to a PDF after it is written, with qpdf in WebAssembly: encryption, linearization and object streams; and reading one back. */
|
|
2
|
+
export { initQpdf, inspectPdf, MAX_PASSWORD_BYTES, PDF_PERMISSIONS, pdfPassword, QPDF_WASM_URL, rewritePdf, withheldPermissions, } from './qpdf.js';
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/qpdf/index.ts"],"names":[],"mappings":"AAAA,+IAA+I;AAC/I,OAAO,EACL,QAAQ,EACR,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,aAAa,EACb,UAAU,EACV,mBAAmB,GAMpB,MAAM,WAAW,CAAA"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* qpdf (https://qpdf.sourceforge.io, Apache-2.0), compiled to WebAssembly
|
|
3
|
+
* from `third_party/qpdf`: what is done to a PDF after it is written
|
|
4
|
+
* (https://plans.inkylabs.com/pulpweaver#every-kind-of-pdf), encryption
|
|
5
|
+
* and permissions, linearization and object streams, and reading a PDF back
|
|
6
|
+
* as a reader does, to check it. The module is qpdf's C++ over wasi-libc
|
|
7
|
+
* with no JavaScript runtime of its own, so the same bytes run in every
|
|
8
|
+
* browser and in Node; the few WASI calls the C++ library links are
|
|
9
|
+
* answered here, and none does anything, but the clock, which says 1970.
|
|
10
|
+
*
|
|
11
|
+
* A rewritten PDF is reproducible: the random bytes encryption needs (the
|
|
12
|
+
* file's key, its salts, every string's and stream's IV) come from a
|
|
13
|
+
* generator seeded by the passwords, the options and the PDF
|
|
14
|
+
* (`third_party/qpdf/binding.cc`), so the same PDF and settings give the
|
|
15
|
+
* same file, and nobody without a password can tell what the seed was.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Where the module sits beside this one. Vite and esbuild leave
|
|
19
|
+
* `new URL(…, import.meta.url)` pointing at it; a Node host reads the file at
|
|
20
|
+
* this URL and passes the bytes to {@link initQpdf}.
|
|
21
|
+
*/
|
|
22
|
+
export declare const QPDF_WASM_URL: URL;
|
|
23
|
+
/** The source of the module: bytes, a compiled module, a `Response` or a URL. */
|
|
24
|
+
export type QpdfWasmSource = BufferSource | WebAssembly.Module | Response | URL | string;
|
|
25
|
+
/**
|
|
26
|
+
* Loads qpdf. By default it is fetched from {@link QPDF_WASM_URL}, which
|
|
27
|
+
* works in browsers (Node’s `fetch` reads no `file:` URLs, so a Node host
|
|
28
|
+
* passes the bytes). Later calls return the first load.
|
|
29
|
+
*/
|
|
30
|
+
export declare function initQpdf(source?: QpdfWasmSource | Promise<QpdfWasmSource>): Promise<void>;
|
|
31
|
+
/** What an encrypted PDF lets a reader without its owner password do, each allowed only if listed. */
|
|
32
|
+
export declare const PDF_PERMISSIONS: readonly ['print', 'print-low', 'copy', 'annotate', 'fill-forms', 'assemble', 'modify'];
|
|
33
|
+
/**
|
|
34
|
+
* `print` (at full quality, which allows `print-low` too), `print-low`
|
|
35
|
+
* (degraded, as a reader may), `copy` (text and images, beyond what
|
|
36
|
+
* assistive technology reads, which an encrypted PDF always allows),
|
|
37
|
+
* `annotate` (comments, and filling forms), `fill-forms` (alone),
|
|
38
|
+
* `assemble` (inserting, rotating and removing pages, and bookmarks) and
|
|
39
|
+
* `modify` (anything else).
|
|
40
|
+
*/
|
|
41
|
+
export type PdfPermission = (typeof PDF_PERMISSIONS)[number];
|
|
42
|
+
/** How a PDF is encrypted: with AES-256, as PDF 2.0 and PDF 1.7’s extension level 8 define it, and always open to assistive technology. */
|
|
43
|
+
export interface PdfEncryption {
|
|
44
|
+
/** What a reader types to open the PDF. Without it, the PDF opens with no password, and its permissions still hold. */
|
|
45
|
+
readonly userPassword?: string;
|
|
46
|
+
/**
|
|
47
|
+
* What lifts the permissions. Needed when the permissions withhold
|
|
48
|
+
* anything (else anyone could lift them); otherwise it defaults to the
|
|
49
|
+
* user password.
|
|
50
|
+
*/
|
|
51
|
+
readonly ownerPassword?: string;
|
|
52
|
+
/** What a reader without the owner password may do: every {@link PDF_PERMISSIONS} by default. */
|
|
53
|
+
readonly permissions?: readonly PdfPermission[];
|
|
54
|
+
}
|
|
55
|
+
/** What is done to a written PDF. */
|
|
56
|
+
export interface RewriteOptions {
|
|
57
|
+
/** Encrypted, with a password to open it, permissions, or both. */
|
|
58
|
+
readonly encryption?: PdfEncryption;
|
|
59
|
+
/** Linearized (“fast web view”): its first page, and what that needs, first in the file, with hints to find each page’s objects. */
|
|
60
|
+
readonly linearize?: boolean;
|
|
61
|
+
/** Its objects packed into compressed object streams, with a cross-reference stream: a smaller file, from PDF 1.5. */
|
|
62
|
+
readonly objectStreams?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/** A password’s greatest length, in bytes of UTF-8: AES-256 encryption reads no more of it. */
|
|
65
|
+
export declare const MAX_PASSWORD_BYTES = 127;
|
|
66
|
+
/**
|
|
67
|
+
* A password as the PDF holds it: in Unicode normalization form KC, as the
|
|
68
|
+
* SASLprep a reader applies to what is typed makes it, and so the same
|
|
69
|
+
* whichever way its characters were entered. Throws if it is longer than
|
|
70
|
+
* {@link MAX_PASSWORD_BYTES} or holds a NUL, saying so but never what it is.
|
|
71
|
+
*/
|
|
72
|
+
export declare function pdfPassword(password: string, which?: string): string;
|
|
73
|
+
/** What {@link PdfEncryption} withholds from its permissions: those not listed. */
|
|
74
|
+
export declare function withheldPermissions(encryption: PdfEncryption): PdfPermission[];
|
|
75
|
+
/**
|
|
76
|
+
* Rewrites a PDF, after {@link initQpdf} has resolved: encrypted,
|
|
77
|
+
* linearized and with object streams as `options` say. Its streams are
|
|
78
|
+
* copied as they are, neither decoded nor recompressed, and each
|
|
79
|
+
* `endstream` follows a newline, as PDF/A asks. An unencrypted file’s /ID
|
|
80
|
+
* comes from its contents; an encrypted one keeps the first half of the
|
|
81
|
+
* writer’s. Throws an `Error` saying what is wrong, never with a password in
|
|
82
|
+
* it.
|
|
83
|
+
*/
|
|
84
|
+
export declare function rewritePdf(pdf: Uint8Array, options: RewriteOptions): Uint8Array;
|
|
85
|
+
/** A PDF read back by {@link inspectPdf}. Absent fields are those a PDF that didn’t open lacks. */
|
|
86
|
+
export interface PdfInspection {
|
|
87
|
+
/** Whether it opened: false for an encrypted PDF the password doesn’t open, or one qpdf can’t read. */
|
|
88
|
+
readonly opened: boolean;
|
|
89
|
+
/** Whether it is encrypted, whether or not the password opened it. */
|
|
90
|
+
readonly encrypted: boolean;
|
|
91
|
+
/** Which password opened an encrypted PDF: a PDF with no user password opens with the empty one, as `user`. */
|
|
92
|
+
readonly password?: 'user' | 'owner';
|
|
93
|
+
/** Encrypted with AES-256 (revision 6), strings and streams alike. */
|
|
94
|
+
readonly aes256?: boolean;
|
|
95
|
+
/** The security handler’s revision: 6 for AES-256. */
|
|
96
|
+
readonly revision?: number;
|
|
97
|
+
/** The header’s version, such as `1.7`, and its extension level, such as 8 for AES-256 in PDF 1.7. */
|
|
98
|
+
readonly version?: string;
|
|
99
|
+
/** The extension level of Adobe’s it declares, 0 for none. */
|
|
100
|
+
readonly extensionLevel?: number;
|
|
101
|
+
/** What the PDF allows a reader without the owner password, and `accessibility` if it allows assistive technology. */
|
|
102
|
+
readonly permissions?: readonly (PdfPermission | 'accessibility')[];
|
|
103
|
+
/** Whether it is linearized (“fast web view”). */
|
|
104
|
+
readonly linearized?: boolean;
|
|
105
|
+
/** Whether any object is in an object stream. */
|
|
106
|
+
readonly objectStreams?: boolean;
|
|
107
|
+
/** How many pages it has. */
|
|
108
|
+
readonly pages?: number;
|
|
109
|
+
/**
|
|
110
|
+
* Whether qpdf finds nothing wrong, as `qpdf --check` (and, for a
|
|
111
|
+
* linearized PDF, `qpdf --check-linearization`) does: its linearization,
|
|
112
|
+
* its structure, every stream it can decode (all but JPEG) and every
|
|
113
|
+
* page’s content.
|
|
114
|
+
*/
|
|
115
|
+
readonly ok: boolean;
|
|
116
|
+
/** What qpdf found wrong, or why it didn’t open. */
|
|
117
|
+
readonly problems: readonly string[];
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Opens a PDF as a reader does, after {@link initQpdf} has resolved, with a
|
|
121
|
+
* password if it needs one, and checks it as `qpdf --check` does.
|
|
122
|
+
*/
|
|
123
|
+
export declare function inspectPdf(pdf: Uint8Array, options?: {
|
|
124
|
+
readonly password?: string;
|
|
125
|
+
}): PdfInspection;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* qpdf (https://qpdf.sourceforge.io, Apache-2.0), compiled to WebAssembly
|
|
3
|
+
* from `third_party/qpdf`: what is done to a PDF after it is written
|
|
4
|
+
* (https://plans.inkylabs.com/pulpweaver#every-kind-of-pdf), encryption
|
|
5
|
+
* and permissions, linearization and object streams, and reading a PDF back
|
|
6
|
+
* as a reader does, to check it. The module is qpdf's C++ over wasi-libc
|
|
7
|
+
* with no JavaScript runtime of its own, so the same bytes run in every
|
|
8
|
+
* browser and in Node; the few WASI calls the C++ library links are
|
|
9
|
+
* answered here, and none does anything, but the clock, which says 1970.
|
|
10
|
+
*
|
|
11
|
+
* A rewritten PDF is reproducible: the random bytes encryption needs (the
|
|
12
|
+
* file's key, its salts, every string's and stream's IV) come from a
|
|
13
|
+
* generator seeded by the passwords, the options and the PDF
|
|
14
|
+
* (`third_party/qpdf/binding.cc`), so the same PDF and settings give the
|
|
15
|
+
* same file, and nobody without a password can tell what the seed was.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Where the module sits beside this one. Vite and esbuild leave
|
|
19
|
+
* `new URL(…, import.meta.url)` pointing at it; a Node host reads the file at
|
|
20
|
+
* this URL and passes the bytes to {@link initQpdf}.
|
|
21
|
+
*/
|
|
22
|
+
export const QPDF_WASM_URL = new URL('./wasm/qpdf.wasm', import.meta.url);
|
|
23
|
+
let ready;
|
|
24
|
+
let qpdf;
|
|
25
|
+
/**
|
|
26
|
+
* Loads qpdf. By default it is fetched from {@link QPDF_WASM_URL}, which
|
|
27
|
+
* works in browsers (Node’s `fetch` reads no `file:` URLs, so a Node host
|
|
28
|
+
* passes the bytes). Later calls return the first load.
|
|
29
|
+
*/
|
|
30
|
+
export function initQpdf(source = QPDF_WASM_URL) {
|
|
31
|
+
ready ??= load(source).then((e) => {
|
|
32
|
+
qpdf = e;
|
|
33
|
+
}, (e) => {
|
|
34
|
+
ready = undefined;
|
|
35
|
+
throw e;
|
|
36
|
+
});
|
|
37
|
+
return ready;
|
|
38
|
+
}
|
|
39
|
+
async function load(from) {
|
|
40
|
+
let source = await from;
|
|
41
|
+
if (source instanceof URL || typeof source === 'string')
|
|
42
|
+
source = await fetch(source);
|
|
43
|
+
if (source instanceof Response) {
|
|
44
|
+
if (!source.ok)
|
|
45
|
+
throw new Error(`initQpdf: ${source.url}: ${source.status}`);
|
|
46
|
+
source = await source.arrayBuffer();
|
|
47
|
+
}
|
|
48
|
+
const module = source instanceof WebAssembly.Module ? source : await WebAssembly.compile(source);
|
|
49
|
+
let memory;
|
|
50
|
+
const view = () => new DataView(memory.buffer);
|
|
51
|
+
// wasi-libc links its stdio, environment and clock, which qpdf reaches
|
|
52
|
+
// only for files (it reads and writes memory here) and the clock the
|
|
53
|
+
// second half of a file's /ID is made from: the environment is empty,
|
|
54
|
+
// there are no files to open (no preopened directories: EBADF ends
|
|
55
|
+
// wasi-libc's search for them), every other call fails as unsupported,
|
|
56
|
+
// and the clock says 1970, so the /ID is the same everywhere.
|
|
57
|
+
const wasi = {};
|
|
58
|
+
for (const i of WebAssembly.Module.imports(module)) {
|
|
59
|
+
if (i.module !== 'wasi_snapshot_preview1' || i.kind !== 'function')
|
|
60
|
+
continue;
|
|
61
|
+
wasi[i.name] = () => 52; // ENOSYS
|
|
62
|
+
}
|
|
63
|
+
const zero = (...at) => {
|
|
64
|
+
for (const a of at)
|
|
65
|
+
view().setUint32(a, 0, true);
|
|
66
|
+
return 0;
|
|
67
|
+
};
|
|
68
|
+
Object.assign(wasi, {
|
|
69
|
+
environ_sizes_get: (count, size) => zero(count, size),
|
|
70
|
+
environ_get: () => 0,
|
|
71
|
+
fd_prestat_get: () => 8, // EBADF
|
|
72
|
+
clock_time_get: (_id, _precision, at) => {
|
|
73
|
+
view().setBigUint64(at, 0n, true);
|
|
74
|
+
return 0;
|
|
75
|
+
},
|
|
76
|
+
proc_exit: () => {
|
|
77
|
+
throw new Error('qpdf exited');
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
const instance = await WebAssembly.instantiate(module, { wasi_snapshot_preview1: wasi });
|
|
81
|
+
const e = instance.exports;
|
|
82
|
+
memory = e.memory;
|
|
83
|
+
e._initialize?.();
|
|
84
|
+
return e;
|
|
85
|
+
}
|
|
86
|
+
function api() {
|
|
87
|
+
if (!qpdf)
|
|
88
|
+
throw new Error('qpdf: await initQpdf() first');
|
|
89
|
+
return qpdf;
|
|
90
|
+
}
|
|
91
|
+
/** What an encrypted PDF lets a reader without its owner password do, each allowed only if listed. */
|
|
92
|
+
export const PDF_PERMISSIONS = ['print', 'print-low', 'copy', 'annotate', 'fill-forms', 'assemble', 'modify'];
|
|
93
|
+
/** Each permission's bit in the binding's `permissions`. */
|
|
94
|
+
const PERMISSIONS = { print: 1, 'print-low': 2, copy: 4, annotate: 8, 'fill-forms': 16, assemble: 32, modify: 64 };
|
|
95
|
+
/** A password’s greatest length, in bytes of UTF-8: AES-256 encryption reads no more of it. */
|
|
96
|
+
export const MAX_PASSWORD_BYTES = 127;
|
|
97
|
+
/**
|
|
98
|
+
* A password as the PDF holds it: in Unicode normalization form KC, as the
|
|
99
|
+
* SASLprep a reader applies to what is typed makes it, and so the same
|
|
100
|
+
* whichever way its characters were entered. Throws if it is longer than
|
|
101
|
+
* {@link MAX_PASSWORD_BYTES} or holds a NUL, saying so but never what it is.
|
|
102
|
+
*/
|
|
103
|
+
export function pdfPassword(password, which = 'password') {
|
|
104
|
+
const p = password.normalize('NFKC');
|
|
105
|
+
if (p.includes('\0'))
|
|
106
|
+
throw new Error(`the ${which} has a NUL character, which a PDF’s password can’t`);
|
|
107
|
+
if (new TextEncoder().encode(p).length > MAX_PASSWORD_BYTES)
|
|
108
|
+
throw new Error(`the ${which} is longer than a PDF’s ${MAX_PASSWORD_BYTES} bytes of UTF-8`);
|
|
109
|
+
return p;
|
|
110
|
+
}
|
|
111
|
+
/** What {@link PdfEncryption} withholds from its permissions: those not listed. */
|
|
112
|
+
export function withheldPermissions(encryption) {
|
|
113
|
+
const allowed = new Set(encryption.permissions ?? PDF_PERMISSIONS);
|
|
114
|
+
// Printing at full quality allows it degraded too.
|
|
115
|
+
if (allowed.has('print'))
|
|
116
|
+
allowed.add('print-low');
|
|
117
|
+
return PDF_PERMISSIONS.filter((p) => !allowed.has(p));
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Rewrites a PDF, after {@link initQpdf} has resolved: encrypted,
|
|
121
|
+
* linearized and with object streams as `options` say. Its streams are
|
|
122
|
+
* copied as they are, neither decoded nor recompressed, and each
|
|
123
|
+
* `endstream` follows a newline, as PDF/A asks. An unencrypted file’s /ID
|
|
124
|
+
* comes from its contents; an encrypted one keeps the first half of the
|
|
125
|
+
* writer’s. Throws an `Error` saying what is wrong, never with a password in
|
|
126
|
+
* it.
|
|
127
|
+
*/
|
|
128
|
+
export function rewritePdf(pdf, options) {
|
|
129
|
+
const e = api();
|
|
130
|
+
const { encryption } = options;
|
|
131
|
+
let user = '';
|
|
132
|
+
let owner = '';
|
|
133
|
+
let permissions = 0;
|
|
134
|
+
if (encryption) {
|
|
135
|
+
user = pdfPassword(encryption.userPassword ?? '', 'user password');
|
|
136
|
+
owner = pdfPassword(encryption.ownerPassword ?? '', 'owner password');
|
|
137
|
+
if (!user && !owner)
|
|
138
|
+
throw new Error('qpdf: encryption needs a user password, an owner password, or both');
|
|
139
|
+
if (!owner) {
|
|
140
|
+
// With no owner password, the empty one would lift the permissions for anyone.
|
|
141
|
+
if (withheldPermissions(encryption).length)
|
|
142
|
+
throw new Error('qpdf: permissions that withhold anything need an owner password, else anyone could lift them');
|
|
143
|
+
owner = user;
|
|
144
|
+
}
|
|
145
|
+
for (const p of encryption.permissions ?? PDF_PERMISSIONS)
|
|
146
|
+
permissions |= PERMISSIONS[p];
|
|
147
|
+
}
|
|
148
|
+
const flags = (options.linearize ? 1 : 0) | (options.objectStreams ? 2 : 0) | (encryption ? 4 : 0);
|
|
149
|
+
const at = put(e, pdf);
|
|
150
|
+
const u = putString(e, user);
|
|
151
|
+
const o = putString(e, owner);
|
|
152
|
+
let ok;
|
|
153
|
+
try {
|
|
154
|
+
ok = e.pw_rewrite(at, pdf.length, flags, permissions, u, o);
|
|
155
|
+
}
|
|
156
|
+
finally {
|
|
157
|
+
e.pw_free(at);
|
|
158
|
+
e.pw_free(u);
|
|
159
|
+
e.pw_free(o);
|
|
160
|
+
}
|
|
161
|
+
const out = result(e);
|
|
162
|
+
if (!ok)
|
|
163
|
+
throw new Error(`qpdf: ${new TextDecoder().decode(out)}`);
|
|
164
|
+
return out;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Opens a PDF as a reader does, after {@link initQpdf} has resolved, with a
|
|
168
|
+
* password if it needs one, and checks it as `qpdf --check` does.
|
|
169
|
+
*/
|
|
170
|
+
export function inspectPdf(pdf, options = {}) {
|
|
171
|
+
const e = api();
|
|
172
|
+
const password = (options.password ?? '').normalize('NFKC');
|
|
173
|
+
const at = put(e, pdf);
|
|
174
|
+
const p = putString(e, password);
|
|
175
|
+
try {
|
|
176
|
+
e.pw_inspect(at, pdf.length, p);
|
|
177
|
+
}
|
|
178
|
+
finally {
|
|
179
|
+
e.pw_free(at);
|
|
180
|
+
e.pw_free(p);
|
|
181
|
+
}
|
|
182
|
+
const { ownerPassword, userPassword, ...read } = JSON.parse(new TextDecoder().decode(result(e)));
|
|
183
|
+
const opened = ownerPassword ? 'owner' : userPassword ? 'user' : undefined;
|
|
184
|
+
return { ...read, ok: read.ok ?? false, ...(opened ? { password: opened } : {}) };
|
|
185
|
+
}
|
|
186
|
+
function put(e, bytes) {
|
|
187
|
+
const p = e.pw_malloc(bytes.length);
|
|
188
|
+
if (!p && bytes.length)
|
|
189
|
+
throw new Error('qpdf: out of memory');
|
|
190
|
+
new Uint8Array(e.memory.buffer, p, bytes.length).set(bytes);
|
|
191
|
+
return p;
|
|
192
|
+
}
|
|
193
|
+
/** A NUL-terminated copy of `s` in UTF-8. */
|
|
194
|
+
function putString(e, s) {
|
|
195
|
+
const bytes = new TextEncoder().encode(s);
|
|
196
|
+
const p = e.pw_malloc(bytes.length + 1);
|
|
197
|
+
const mem = new Uint8Array(e.memory.buffer, p, bytes.length + 1);
|
|
198
|
+
mem.set(bytes);
|
|
199
|
+
mem[bytes.length] = 0;
|
|
200
|
+
return p;
|
|
201
|
+
}
|
|
202
|
+
function result(e) {
|
|
203
|
+
return new Uint8Array(e.memory.buffer, e.pw_result_data(), e.pw_result_size()).slice();
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=qpdf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qpdf.js","sourceRoot":"","sources":["../../src/qpdf/qpdf.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAQ,IAAI,GAAG,CAAC,kBAAkB,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;AAc9E,IAAI,KAAgC,CAAA;AACpC,IAAI,IAAyB,CAAA;AAK7B;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAM,GAA6C,aAAa;IACvF,KAAK,KAAK,IAAI,CAAC,MAAM,CAAC,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AI,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IAChE,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACd,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACrB,OAAO,CAAC,CAAA;AACV,CAAC;AAED,SAAS,MAAM,CAAC,CAAU;IACxB,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,KAAK,EAAE,CAAA;AACxF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Everything at once: encrypted, with permissions withheld, linearized and with object streams. */
|
|
2
|
+
export declare const QPDF_SAMPLE: {
|
|
3
|
+
readonly encryption: {
|
|
4
|
+
readonly userPassword: 'reader';
|
|
5
|
+
readonly ownerPassword: 'publisher';
|
|
6
|
+
readonly permissions: readonly ["print", "copy"];
|
|
7
|
+
};
|
|
8
|
+
readonly linearize: true;
|
|
9
|
+
readonly objectStreams: true;
|
|
10
|
+
};
|
|
11
|
+
/** The SHA-256 of the sample rewritten so: the same everywhere. */
|
|
12
|
+
export declare const QPDF_SAMPLE_SHA256 = "72e1cccc7b4cc52d2c16394325300240f0ab1e67bc260c0196de85f1541b4e16";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Everything at once: encrypted, with permissions withheld, linearized and with object streams. */
|
|
2
|
+
export const QPDF_SAMPLE = {
|
|
3
|
+
encryption: { userPassword: 'reader', ownerPassword: 'publisher', permissions: ['print', 'copy'] },
|
|
4
|
+
linearize: true,
|
|
5
|
+
objectStreams: true,
|
|
6
|
+
};
|
|
7
|
+
/** The SHA-256 of the sample rewritten so: the same everywhere. */
|
|
8
|
+
export const QPDF_SAMPLE_SHA256 = '72e1cccc7b4cc52d2c16394325300240f0ab1e67bc260c0196de85f1541b4e16';
|
|
9
|
+
//# sourceMappingURL=testing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../../src/qpdf/testing.ts"],"names":[],"mappings":"AAGA,oGAAoG;AACpG,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,UAAU,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE;IAClG,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,IAAI;CACc,CAAA;AAEnC,mEAAmE;AACnE,MAAM,CAAC,MAAM,kBAAkB,GAAG,kEAAkE,CAAA"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright notice:
|
|
2
|
+
|
|
3
|
+
(C) 1995-2026 Jean-loup Gailly and Mark Adler
|
|
4
|
+
|
|
5
|
+
This software is provided 'as-is', without any express or implied
|
|
6
|
+
warranty. In no event will the authors be held liable for any damages
|
|
7
|
+
arising from the use of this software.
|
|
8
|
+
|
|
9
|
+
Permission is granted to anyone to use this software for any purpose,
|
|
10
|
+
including commercial applications, and to alter it and redistribute it
|
|
11
|
+
freely, subject to the following restrictions:
|
|
12
|
+
|
|
13
|
+
1. The origin of this software must not be misrepresented; you must not
|
|
14
|
+
claim that you wrote the original software. If you use this software
|
|
15
|
+
in a product, an acknowledgment in the product documentation would be
|
|
16
|
+
appreciated but is not required.
|
|
17
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
|
18
|
+
misrepresented as being the original software.
|
|
19
|
+
3. This notice may not be removed or altered from any source distribution.
|
|
20
|
+
|
|
21
|
+
Jean-loup Gailly Mark Adler
|
|
22
|
+
jloup@gzip.org madler@alumni.caltech.edu
|