@laminapdf/sdk 0.2.0-alpha.2 → 0.2.0-alpha.4
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 +63 -8
- package/dist/api.d.ts +8 -3
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +4 -2
- package/dist/api.js.map +1 -1
- package/dist/builder.d.ts +43 -22
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +122 -83
- package/dist/builder.js.map +1 -1
- package/dist/document.d.ts +89 -22
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +177 -67
- package/dist/document.js.map +1 -1
- package/dist/errors.d.ts +5 -5
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +10 -16
- package/dist/errors.js.map +1 -1
- package/dist/extract-job.d.ts +100 -0
- package/dist/extract-job.d.ts.map +1 -0
- package/dist/extract-job.js +177 -0
- package/dist/extract-job.js.map +1 -0
- package/dist/extract.d.ts +57 -0
- package/dist/extract.d.ts.map +1 -0
- package/dist/extract.js +5 -0
- package/dist/extract.js.map +1 -0
- package/dist/font.d.ts +13 -6
- package/dist/font.d.ts.map +1 -1
- package/dist/font.js +50 -20
- package/dist/font.js.map +1 -1
- package/dist/generated/builder-enums.d.ts +3 -3
- package/dist/generated/builder-enums.d.ts.map +1 -1
- package/dist/generated/builder-enums.js +10 -0
- package/dist/generated/builder-enums.js.map +1 -1
- package/dist/generated/codes.d.ts +18 -6
- package/dist/generated/codes.d.ts.map +1 -1
- package/dist/generated/codes.js +114 -5
- package/dist/generated/codes.js.map +1 -1
- package/dist/generated/explain.d.ts.map +1 -1
- package/dist/generated/explain.js +45 -11
- package/dist/generated/explain.js.map +1 -1
- package/dist/generated/extract.d.ts +282 -0
- package/dist/generated/extract.d.ts.map +1 -0
- package/dist/generated/extract.js +4 -0
- package/dist/generated/extract.js.map +1 -0
- package/dist/init.d.ts +13 -5
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +23 -11
- package/dist/init.js.map +1 -1
- package/dist/internal/handle.d.ts +58 -0
- package/dist/internal/handle.d.ts.map +1 -0
- package/dist/internal/handle.js +113 -0
- package/dist/internal/handle.js.map +1 -0
- package/dist/internal/instance.d.ts +56 -0
- package/dist/internal/instance.d.ts.map +1 -0
- package/dist/internal/instance.js +125 -0
- package/dist/internal/instance.js.map +1 -0
- package/dist/source/http.d.ts +1 -1
- package/dist/source/http.js +2 -2
- package/dist/source/http.js.map +1 -1
- package/dist/source/range.d.ts +6 -1
- package/dist/source/range.d.ts.map +1 -1
- package/dist/source/range.js +10 -6
- package/dist/source/range.js.map +1 -1
- package/dist/text.d.ts +3 -3
- package/dist/text.d.ts.map +1 -1
- package/dist/text.js +3 -3
- package/dist/text.js.map +1 -1
- package/dist/types.d.ts +19 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +2 -2
- package/dist/version.js.map +1 -1
- package/dist/worker/client.d.ts +3 -2
- package/dist/worker/client.d.ts.map +1 -1
- package/dist/worker/client.js +6 -4
- package/dist/worker/client.js.map +1 -1
- package/dist/worker/entry.js +1 -1
- package/dist/worker/entry.js.map +1 -1
- package/dist/worker/server.d.ts.map +1 -1
- package/dist/worker/server.js +42 -9
- package/dist/worker/server.js.map +1 -1
- package/dist/worker/support.d.ts +13 -3
- package/dist/worker/support.d.ts.map +1 -1
- package/dist/worker/support.js +5 -0
- package/dist/worker/support.js.map +1 -1
- package/dist/worker/types.d.ts +8 -1
- package/dist/worker/types.d.ts.map +1 -1
- package/docs/AGENTS.md +14 -0
- package/docs/api/README.md +166 -0
- package/docs/api/classes/Builder.md +467 -0
- package/docs/api/classes/Document.md +854 -0
- package/docs/api/classes/ExtractJob.md +236 -0
- package/docs/api/classes/Font.md +74 -0
- package/docs/api/classes/Image.md +140 -0
- package/docs/api/classes/LaminaPdfError.md +189 -0
- package/docs/api/classes/Page.md +178 -0
- package/docs/api/classes/PageRef.md +253 -0
- package/docs/api/classes/PageText.md +129 -0
- package/docs/api/classes/PageTextRun.md +167 -0
- package/docs/api/classes/PendingPath.md +97 -0
- package/docs/api/classes/SaveJob.md +205 -0
- package/docs/api/classes/Surface.md +331 -0
- package/docs/api/classes/Transaction.md +111 -0
- package/docs/api/functions/callbackSource.md +33 -0
- package/docs/api/functions/extractWithModels.md +70 -0
- package/docs/api/functions/httpRangeSource.md +48 -0
- package/docs/api/functions/init.md +36 -0
- package/docs/api/functions/isExtractLoaded.md +21 -0
- package/docs/api/functions/isInitialized.md +19 -0
- package/docs/api/functions/isLaminaPdfError.md +41 -0
- package/docs/api/functions/isTextLoaded.md +19 -0
- package/docs/api/functions/loadExtract.md +28 -0
- package/docs/api/functions/loadText.md +28 -0
- package/docs/api/functions/onLeak.md +29 -0
- package/docs/api/functions/reset.md +22 -0
- package/docs/api/functions/wasmMemory.md +22 -0
- package/docs/api/interfaces/BuilderOptions.md +108 -0
- package/docs/api/interfaces/ByteRange.md +29 -0
- package/docs/api/interfaces/ChunkOptions.md +37 -0
- package/docs/api/interfaces/Diagnostic.md +67 -0
- package/docs/api/interfaces/ExtractOptions.md +92 -0
- package/docs/api/interfaces/ExtractResult.md +37 -0
- package/docs/api/interfaces/FontInfo.md +37 -0
- package/docs/api/interfaces/HostModels.md +57 -0
- package/docs/api/interfaces/HttpRangeOptions.md +78 -0
- package/docs/api/interfaces/InitOptions.md +40 -0
- package/docs/api/interfaces/LayoutRegion.md +38 -0
- package/docs/api/interfaces/Leak.md +21 -0
- package/docs/api/interfaces/Location.md +53 -0
- package/docs/api/interfaces/ModelInfo.md +45 -0
- package/docs/api/interfaces/ModelRequest.md +45 -0
- package/docs/api/interfaces/Models.md +45 -0
- package/docs/api/interfaces/OcrWord.md +37 -0
- package/docs/api/interfaces/OpLog.md +25 -0
- package/docs/api/interfaces/OpenOptions.md +37 -0
- package/docs/api/interfaces/PageTextOptions.md +21 -0
- package/docs/api/interfaces/PathBuilder.md +195 -0
- package/docs/api/interfaces/QuadPoint.md +25 -0
- package/docs/api/interfaces/RangeOptions.md +54 -0
- package/docs/api/interfaces/RangeSource.md +59 -0
- package/docs/api/interfaces/StrokeStyle.md +61 -0
- package/docs/api/interfaces/TagSpec.md +69 -0
- package/docs/api/interfaces/TextBoxOptions.md +93 -0
- package/docs/api/interfaces/TextGlyph.md +29 -0
- package/docs/api/interfaces/TextOptions.md +101 -0
- package/docs/api/interfaces/WasmMemory.md +37 -0
- package/docs/api/type-aliases/AfRelationship.md +15 -0
- package/docs/api/type-aliases/Align.md +15 -0
- package/docs/api/type-aliases/ArtifactKind.md +15 -0
- package/docs/api/type-aliases/AttachmentOptions.md +15 -0
- package/docs/api/type-aliases/BlendMode.md +15 -0
- package/docs/api/type-aliases/BoxRect.md +15 -0
- package/docs/api/type-aliases/BuildOptions.md +15 -0
- package/docs/api/type-aliases/Cell.md +71 -0
- package/docs/api/type-aliases/Chunk.md +79 -0
- package/docs/api/type-aliases/Color.md +16 -0
- package/docs/api/type-aliases/Coordinates.md +55 -0
- package/docs/api/type-aliases/Direction.md +15 -0
- package/docs/api/type-aliases/DocumentInfo.md +15 -0
- package/docs/api/type-aliases/DropReason.md +15 -0
- package/docs/api/type-aliases/Dropped.md +59 -0
- package/docs/api/type-aliases/Edited.md +15 -0
- package/docs/api/type-aliases/ErrorCode.md +15 -0
- package/docs/api/type-aliases/ErrorKind.md +15 -0
- package/docs/api/type-aliases/ExtractFormat.md +15 -0
- package/docs/api/type-aliases/ExtractJobOptions.md +31 -0
- package/docs/api/type-aliases/ExtractStep.md +61 -0
- package/docs/api/type-aliases/ExtractedBlock.md +94 -0
- package/docs/api/type-aliases/ExtractedPage.md +73 -0
- package/docs/api/type-aliases/ExtractedSource.md +48 -0
- package/docs/api/type-aliases/Extraction.md +22 -0
- package/docs/api/type-aliases/FillRule.md +15 -0
- package/docs/api/type-aliases/Fit.md +15 -0
- package/docs/api/type-aliases/Flags.md +15 -0
- package/docs/api/type-aliases/Generator.md +43 -0
- package/docs/api/type-aliases/GlyphQuad.md +15 -0
- package/docs/api/type-aliases/InfoPatch.md +15 -0
- package/docs/api/type-aliases/LaminaPdfWarning.md +16 -0
- package/docs/api/type-aliases/LimitName.md +15 -0
- package/docs/api/type-aliases/Limits.md +15 -0
- package/docs/api/type-aliases/LineBox.md +15 -0
- package/docs/api/type-aliases/LineCap.md +15 -0
- package/docs/api/type-aliases/LineJoin.md +15 -0
- package/docs/api/type-aliases/LinkTarget.md +15 -0
- package/docs/api/type-aliases/Metadata.md +15 -0
- package/docs/api/type-aliases/ModelResult.md +15 -0
- package/docs/api/type-aliases/Op.md +15 -0
- package/docs/api/type-aliases/OutlineEntry.md +15 -0
- package/docs/api/type-aliases/OutlineNode.md +15 -0
- package/docs/api/type-aliases/Overflow.md +15 -0
- package/docs/api/type-aliases/PageInfo.md +15 -0
- package/docs/api/type-aliases/PageLabel.md +15 -0
- package/docs/api/type-aliases/PageSizeName.md +15 -0
- package/docs/api/type-aliases/Point.md +15 -0
- package/docs/api/type-aliases/Profile.md +15 -0
- package/docs/api/type-aliases/Progress.md +15 -0
- package/docs/api/type-aliases/ReadingOrder.md +15 -0
- package/docs/api/type-aliases/Rect.md +15 -0
- package/docs/api/type-aliases/Region.md +31 -0
- package/docs/api/type-aliases/RegionLabel.md +15 -0
- package/docs/api/type-aliases/RenderMode.md +15 -0
- package/docs/api/type-aliases/Rotation.md +15 -0
- package/docs/api/type-aliases/SaveOptions.md +15 -0
- package/docs/api/type-aliases/SaveReport.md +15 -0
- package/docs/api/type-aliases/Span.md +74 -0
- package/docs/api/type-aliases/SplitOn.md +15 -0
- package/docs/api/type-aliases/Standard14.md +15 -0
- package/docs/api/type-aliases/StructRef.md +41 -0
- package/docs/api/type-aliases/StructSource.md +17 -0
- package/docs/api/type-aliases/StructureKid.md +15 -0
- package/docs/api/type-aliases/StructureNode.md +16 -0
- package/docs/api/type-aliases/TableDetector.md +15 -0
- package/docs/api/type-aliases/TableMode.md +15 -0
- package/docs/api/type-aliases/TableScope.md +15 -0
- package/docs/api/type-aliases/Tag.md +15 -0
- package/docs/api/type-aliases/TagName.md +15 -0
- package/docs/api/type-aliases/Target.md +15 -0
- package/docs/api/type-aliases/TargetView.md +18 -0
- package/docs/api/type-aliases/TextLayer.md +72 -0
- package/docs/api/type-aliases/TextLayerStatus.md +15 -0
- package/docs/api/type-aliases/TextLayout.md +15 -0
- package/docs/api/type-aliases/TextRange.md +33 -0
- package/docs/api/type-aliases/TextRunInfo.md +15 -0
- package/docs/api/type-aliases/Transform.md +15 -0
- package/docs/api/type-aliases/UndoOutcome.md +15 -0
- package/docs/api/type-aliases/ViewerPreferences.md +15 -0
- package/docs/api/type-aliases/WarningCode.md +15 -0
- package/docs/api/type-aliases/WasmSource.md +16 -0
- package/docs/api/variables/Matrix.md +99 -0
- package/docs/api/variables/PAGE_SIZES.md +15 -0
- package/docs/api/variables/TAG_NAMES.md +15 -0
- package/docs/errors/README.md +173 -0
- package/docs/errors/aes-padding-invalid.md +34 -0
- package/docs/errors/already-initialized.md +34 -0
- package/docs/errors/binary-output-to-terminal.md +35 -0
- package/docs/errors/builder-finished.md +35 -0
- package/docs/errors/cancelled.md +35 -0
- package/docs/errors/cmap-invalid.md +42 -0
- package/docs/errors/collection-index.md +33 -0
- package/docs/errors/color-components.md +33 -0
- package/docs/errors/content-bad-operands.md +36 -0
- package/docs/errors/content-path-unpainted.md +36 -0
- package/docs/errors/content-resource-missing.md +37 -0
- package/docs/errors/content-syntax.md +36 -0
- package/docs/errors/content-unbalanced-bt.md +36 -0
- package/docs/errors/content-unbalanced-marked.md +36 -0
- package/docs/errors/content-unbalanced-q.md +36 -0
- package/docs/errors/content-unknown-operator.md +37 -0
- package/docs/errors/covered-text.md +33 -0
- package/docs/errors/data-pending.md +34 -0
- package/docs/errors/decompress.md +34 -0
- package/docs/errors/device-color-without-output-intent.md +33 -0
- package/docs/errors/direct-page.md +34 -0
- package/docs/errors/disposed.md +34 -0
- package/docs/errors/document-changed.md +34 -0
- package/docs/errors/embedded-file-forbidden.md +35 -0
- package/docs/errors/embedded-file-without-mime-type.md +36 -0
- package/docs/errors/encoding-full.md +34 -0
- package/docs/errors/encrypted-base.md +33 -0
- package/docs/errors/extract-column-order-uncertain.md +38 -0
- package/docs/errors/extract-limit-blocks.md +35 -0
- package/docs/errors/extract-module-not-loaded.md +37 -0
- package/docs/errors/extract-needs-ocr.md +37 -0
- package/docs/errors/extract-reading-order-ambiguous.md +32 -0
- package/docs/errors/extract-struct-tree-ignored.md +32 -0
- package/docs/errors/extract-table-ambiguous.md +32 -0
- package/docs/errors/extract-table-limit.md +35 -0
- package/docs/errors/extract-untagged-content.md +32 -0
- package/docs/errors/fetch-failed.md +34 -0
- package/docs/errors/flate-truncated.md +34 -0
- package/docs/errors/flow-content-too-large.md +34 -0
- package/docs/errors/flow-keep-broken.md +34 -0
- package/docs/errors/flow-layout-unstable.md +38 -0
- package/docs/errors/font-invalid.md +36 -0
- package/docs/errors/font-mismatch.md +34 -0
- package/docs/errors/font-not-embeddable.md +34 -0
- package/docs/errors/font-not-embedded.md +35 -0
- package/docs/errors/font-not-shapable.md +33 -0
- package/docs/errors/glyph-out-of-range.md +34 -0
- package/docs/errors/glyph-without-unicode.md +37 -0
- package/docs/errors/heading-level-skipped.md +36 -0
- package/docs/errors/image-data-length.md +33 -0
- package/docs/errors/image-too-large.md +32 -0
- package/docs/errors/inline-image-unterminated.md +36 -0
- package/docs/errors/input-unreadable.md +37 -0
- package/docs/errors/instance-reset.md +34 -0
- package/docs/errors/invalid-argument.md +33 -0
- package/docs/errors/invalid-axis-value.md +32 -0
- package/docs/errors/invalid-box.md +34 -0
- package/docs/errors/invalid-color.md +32 -0
- package/docs/errors/invalid-command-line.md +44 -0
- package/docs/errors/invalid-date.md +34 -0
- package/docs/errors/invalid-entry.md +34 -0
- package/docs/errors/invalid-feature.md +32 -0
- package/docs/errors/invalid-font.md +32 -0
- package/docs/errors/invalid-geometry.md +32 -0
- package/docs/errors/invalid-icc-profile.md +32 -0
- package/docs/errors/invalid-image.md +33 -0
- package/docs/errors/invalid-op-log.md +33 -0
- package/docs/errors/invalid-page-label.md +34 -0
- package/docs/errors/invalid-page-labels.md +32 -0
- package/docs/errors/invalid-page-range.md +37 -0
- package/docs/errors/invalid-rotate.md +34 -0
- package/docs/errors/invalid-spans.md +39 -0
- package/docs/errors/invalid-structure-nesting.md +38 -0
- package/docs/errors/invalid-structure.md +34 -0
- package/docs/errors/invalid-text-range.md +33 -0
- package/docs/errors/job-finished.md +34 -0
- package/docs/errors/limit-exceeded.md +38 -0
- package/docs/errors/link-without-contents.md +33 -0
- package/docs/errors/link-without-structure.md +37 -0
- package/docs/errors/markdown-html-ignored.md +33 -0
- package/docs/errors/markdown-image-missing.md +34 -0
- package/docs/errors/missing-alt-text.md +33 -0
- package/docs/errors/missing-glyph.md +33 -0
- package/docs/errors/missing-header.md +37 -0
- package/docs/errors/missing-lang.md +32 -0
- package/docs/errors/missing-root.md +34 -0
- package/docs/errors/missing-title.md +32 -0
- package/docs/errors/model-failed.md +33 -0
- package/docs/errors/model-needs-host.md +40 -0
- package/docs/errors/model-result-unexpected.md +36 -0
- package/docs/errors/name-tree-node-skipped.md +34 -0
- package/docs/errors/nested-transaction.md +34 -0
- package/docs/errors/no-pending-save.md +32 -0
- package/docs/errors/no-transaction.md +33 -0
- package/docs/errors/not-initialized.md +35 -0
- package/docs/errors/not-pdf.md +33 -0
- package/docs/errors/not-rebased.md +35 -0
- package/docs/errors/object-number-out-of-range.md +38 -0
- package/docs/errors/objstm-index-mismatch.md +36 -0
- package/docs/errors/out-of-memory.md +38 -0
- package/docs/errors/outline-cycle.md +34 -0
- package/docs/errors/outline-item-skipped.md +34 -0
- package/docs/errors/output-unwritable.md +37 -0
- package/docs/errors/overwrite-refused.md +36 -0
- package/docs/errors/page-count-mismatch.md +34 -0
- package/docs/errors/page-index-out-of-range.md +34 -0
- package/docs/errors/page-tree-node-skipped.md +35 -0
- package/docs/errors/password-required.md +36 -0
- package/docs/errors/path-outside-roots.md +32 -0
- package/docs/errors/perms-mismatch.md +34 -0
- package/docs/errors/profile-version-conflict.md +35 -0
- package/docs/errors/redaction-not-applied.md +32 -0
- package/docs/errors/reference-cycle.md +35 -0
- package/docs/errors/render-backend-unavailable.md +32 -0
- package/docs/errors/render-failed.md +33 -0
- package/docs/errors/render-too-large.md +36 -0
- package/docs/errors/repaired-base.md +34 -0
- package/docs/errors/requires-rewrite.md +38 -0
- package/docs/errors/revision-index-out-of-range.md +34 -0
- package/docs/errors/saved-not-rebased.md +34 -0
- package/docs/errors/sink-not-empty.md +33 -0
- package/docs/errors/sink.md +31 -0
- package/docs/errors/source-budget-exceeded.md +34 -0
- package/docs/errors/source-changed.md +33 -0
- package/docs/errors/source.md +30 -0
- package/docs/errors/stale-generation.md +34 -0
- package/docs/errors/stream-length-recovered.md +37 -0
- package/docs/errors/strict.md +34 -0
- package/docs/errors/subset-failed.md +31 -0
- package/docs/errors/syntax.md +34 -0
- package/docs/errors/tag-element-not-open.md +41 -0
- package/docs/errors/tag-element-unclosed.md +34 -0
- package/docs/errors/text-in-earlier-revision.md +36 -0
- package/docs/errors/text-module-not-loaded.md +36 -0
- package/docs/errors/text-overflow.md +34 -0
- package/docs/errors/tounicode-conflict.md +32 -0
- package/docs/errors/type.md +34 -0
- package/docs/errors/unexpected-eof.md +34 -0
- package/docs/errors/unknown-axis.md +33 -0
- package/docs/errors/unknown-code.md +36 -0
- package/docs/errors/unknown-destination.md +33 -0
- package/docs/errors/unknown-font.md +33 -0
- package/docs/errors/unknown-option.md +33 -0
- package/docs/errors/unknown-page.md +34 -0
- package/docs/errors/unmapped-glyph.md +36 -0
- package/docs/errors/unnumbered-heading-misused.md +34 -0
- package/docs/errors/unset-object.md +30 -0
- package/docs/errors/unsupported-filter.md +34 -0
- package/docs/errors/unsupported-image.md +33 -0
- package/docs/errors/unsupported-layout-option.md +33 -0
- package/docs/errors/unsupported-security-handler.md +34 -0
- package/docs/errors/unsupported-version.md +32 -0
- package/docs/errors/untagged-content.md +35 -0
- package/docs/errors/warnings-truncated.md +35 -0
- package/docs/errors/wasm-trap.md +37 -0
- package/docs/errors/whole-font-rebuilt.md +30 -0
- package/docs/errors/worker-crashed.md +33 -0
- package/docs/errors/worker-failed.md +32 -0
- package/docs/errors/worker-version-mismatch.md +34 -0
- package/docs/errors/would-invalidate-signatures.md +38 -0
- package/docs/errors/wrong-document.md +33 -0
- package/docs/errors/wrong-password.md +34 -0
- package/docs/errors/xobject-cycle.md +36 -0
- package/docs/errors/xref-repaired.md +36 -0
- package/docs/errors/xrefstm-ignored.md +34 -0
- package/docs/llms.txt +94 -0
- package/docs/pages/concepts/dependencies.md +44 -0
- package/docs/pages/concepts/drawing-pages.md +76 -0
- package/docs/pages/concepts/errors-and-warnings.md +68 -0
- package/docs/pages/concepts/how-lamina-thinks.md +98 -0
- package/docs/pages/concepts/pages-and-coordinates.md +75 -0
- package/docs/pages/guides/accessible-pdfs.md +262 -0
- package/docs/pages/guides/archival-pdfs.md +433 -0
- package/docs/pages/guides/edit-a-pdf.md +143 -0
- package/docs/pages/guides/flowing-pages.md +379 -0
- package/docs/pages/guides/fonts-and-text.md +204 -0
- package/docs/pages/guides/images-and-vectors.md +221 -0
- package/docs/pages/guides/keep-the-page-responsive.md +85 -0
- package/docs/pages/guides/links-outlines-and-metadata.md +224 -0
- package/docs/pages/guides/open-large-files.md +69 -0
- package/docs/pages/guides/password-protected-files.md +70 -0
- package/docs/pages/guides/save-a-pdf.md +154 -0
- package/docs/pages/guides/test-generated-pdfs.md +324 -0
- package/docs/pages/guides/untrusted-files.md +82 -0
- package/docs/pages/index.md +33 -0
- package/docs/pages/install.md +79 -0
- package/docs/pages/quick-start/browser.md +71 -0
- package/docs/pages/quick-start/bun.md +64 -0
- package/docs/pages/quick-start/deno.md +62 -0
- package/docs/pages/quick-start/node.md +65 -0
- package/docs/pages/quick-start/rust.md +62 -0
- package/docs/pages/quick-start/workers.md +139 -0
- package/docs/pages/recipes/cloudflare-worker.md +115 -0
- package/docs/pages/recipes/element-flow.md +248 -0
- package/docs/pages/recipes/extract-markdown.md +152 -0
- package/docs/pages/recipes/generate-then-edit.md +142 -0
- package/docs/pages/recipes/hello.md +101 -0
- package/docs/pages/recipes/images-and-vectors.md +216 -0
- package/docs/pages/recipes/invoice.md +233 -0
- package/docs/pages/recipes/links-and-outlines.md +222 -0
- package/docs/pages/recipes/multilingual.md +196 -0
- package/docs/pages/recipes/open-untrusted.md +65 -0
- package/docs/pages/recipes/pdf-a-archive.md +212 -0
- package/docs/pages/recipes/pdf-a3-invoice-with-xml.md +229 -0
- package/docs/pages/recipes/pdf-ua-report.md +244 -0
- package/docs/pages/recipes/report.md +125 -0
- package/docs/pages/recipes/web-worker-client.md +64 -0
- package/docs/pages/recipes.md +48 -0
- package/docs/pages/reference/benchmarks.md +93 -0
- package/docs/pages/reference/changelog.md +134 -0
- package/docs/pages/reference/codes.md +14 -0
- package/docs/pages/reference/glossary.md +108 -0
- package/docs/pages/reference/rust.md +36 -0
- package/docs/pages/reference/stability.md +59 -0
- package/docs/pages/start/coding-agents.md +45 -0
- package/docs/pages/start/first-pdf.md +81 -0
- package/docs/pages/troubleshooting.md +74 -0
- package/docs/renames.json +86 -0
- package/docs/schemas/error.schema.json +322 -0
- package/docs/schemas/renames.schema.json +29 -0
- package/package.json +7 -3
- package/schemas/error.schema.json +37 -3
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Your first PDF"
|
|
3
|
+
description: "Write hello.pdf from Node in five minutes."
|
|
4
|
+
version: "0.2.0-alpha.4"
|
|
5
|
+
url: "https://docs.laminapdf.com/start/first-pdf/"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Your first PDF
|
|
9
|
+
|
|
10
|
+
Write hello.pdf from Node in five minutes.
|
|
11
|
+
|
|
12
|
+
You'll write `hello.pdf`, one A4 page that says "Hello, world!", from a short Node script. It takes about five minutes.
|
|
13
|
+
|
|
14
|
+
## Make a project
|
|
15
|
+
|
|
16
|
+
You need Node 24.2 or newer, which runs `.ts` files directly. Create a folder and install `@laminapdf/sdk` from npm:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
mkdir hello-pdf && cd hello-pdf
|
|
20
|
+
npm init -y && npm pkg set type=module
|
|
21
|
+
npm install @laminapdf/sdk@0.2.0-alpha.4
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Lamina PDF is in alpha, so the install names the version these docs describe. `@laminapdf/sdk` brings its WebAssembly modules, `@laminapdf/wasm`, with it. [Install](../../pages/install.md) covers other package managers and Rust.
|
|
25
|
+
|
|
26
|
+
## Write the page
|
|
27
|
+
|
|
28
|
+
Save this app as `hello.ts`. It loads Lamina PDF, builds the page and writes it to `hello.pdf`:
|
|
29
|
+
|
|
30
|
+
**TypeScript**
|
|
31
|
+
|
|
32
|
+
`packages/sdk/examples/quick-start/node.ts`:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
// Builds a one-page PDF that says "Hello, world!" and writes it to hello.pdf, in Node.
|
|
36
|
+
import { writeFile } from "node:fs/promises";
|
|
37
|
+
import { Builder, type BuilderOptions, Font, init } from "@laminapdf/sdk";
|
|
38
|
+
|
|
39
|
+
/** The space between the page's edge and the text, in points (72 points = 1 inch). */
|
|
40
|
+
const MARGIN = 72;
|
|
41
|
+
/** The text's size in points; its baseline sits this far below the margin. */
|
|
42
|
+
const FONT_SIZE = 24;
|
|
43
|
+
|
|
44
|
+
/** Builds the page and hands its bytes to `save`, which writes hello.pdf unless you pass another `save` function. */
|
|
45
|
+
export async function hello(
|
|
46
|
+
save: (pdf: Uint8Array) => void | Promise<void> = (pdf) => writeFile("hello.pdf", pdf),
|
|
47
|
+
options: BuilderOptions = {},
|
|
48
|
+
): Promise<void> {
|
|
49
|
+
await init({ text: true });
|
|
50
|
+
using builder = new Builder(options);
|
|
51
|
+
const page = builder.page("A4");
|
|
52
|
+
// Points from the page's top-left corner, y down; the text's baseline sits FONT_SIZE points below the margin.
|
|
53
|
+
page.surface().text("Hello, world!", {
|
|
54
|
+
font: Font.standard("Helvetica"),
|
|
55
|
+
size: FONT_SIZE,
|
|
56
|
+
at: [MARGIN, MARGIN + FONT_SIZE],
|
|
57
|
+
});
|
|
58
|
+
page.finish();
|
|
59
|
+
using doc = builder.finish();
|
|
60
|
+
await save(doc.save());
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// `node hello.ts` runs it (Node 24.2 or newer); imported, it only exports `hello`.
|
|
64
|
+
if (import.meta.main) await hello();
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Result:** [hello.pdf](https://docs.laminapdf.com/examples/pdf/hello.pdf)
|
|
68
|
+
|
|
69
|
+
## Run it
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
node hello.ts
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Node runs the TypeScript file as it is. Open `hello.pdf` in any PDF viewer: one page, with "Hello, world!" near its top-left corner.
|
|
76
|
+
|
|
77
|
+
## What happened
|
|
78
|
+
|
|
79
|
+
`init({ text: true })` loaded Lamina PDF's text module, the one that draws fonts; after it, every call is synchronous. The builder made an A4 page, drew the text on it and finished into a document, `doc.save()` turned that document into bytes, and `save` wrote them to `hello.pdf`. `using` freed the builder and the document as soon as the function ended.
|
|
80
|
+
|
|
81
|
+
Next, see [how Lamina PDF thinks about a PDF](../../pages/concepts/how-lamina-thinks.md) and [where things go on a page](../../pages/concepts/pages-and-coordinates.md). To use laminapdf somewhere other than Node, pick [your runtime](../../pages/quick-start/browser.md).
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Troubleshooting"
|
|
3
|
+
description: "The problems people hit with Lamina PDF, from a missing init() to a signed file that won't save, with the cause and the fix of each."
|
|
4
|
+
version: "0.2.0-alpha.4"
|
|
5
|
+
url: "https://docs.laminapdf.com/troubleshooting/"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Troubleshooting
|
|
9
|
+
|
|
10
|
+
The problems people hit with Lamina PDF, from a missing init() to a signed file that won't save, with the cause and the fix of each.
|
|
11
|
+
|
|
12
|
+
Each entry starts from what you see, then gives the cause and the fix. Errors carry a `code`, and every code has a page that says what to do: search the [error and warning codes](../errors/README.md) for one that isn't here.
|
|
13
|
+
|
|
14
|
+
## Every call throws `not-initialized`
|
|
15
|
+
|
|
16
|
+
**Cause:** a function of `@laminapdf/sdk` ran before `init()` finished loading the WebAssembly.
|
|
17
|
+
|
|
18
|
+
**Fix:** `await init()` once, before anything else. After it, every call is synchronous. See [`not-initialized`](../errors/not-initialized.md).
|
|
19
|
+
|
|
20
|
+
## Drawing text throws `text-module-not-loaded`
|
|
21
|
+
|
|
22
|
+
**Cause:** the builder lives in the base module, which has no fonts or text. Lamina PDF loads only the modules you ask for, so a page downloads only what it uses.
|
|
23
|
+
|
|
24
|
+
**Fix:** load the text module before you create the builder: `init({ text: true })`, or `loadText()` after `init()`. See [`text-module-not-loaded`](../errors/text-module-not-loaded.md) and [Text and fonts](../pages/guides/fonts-and-text.md).
|
|
25
|
+
|
|
26
|
+
## Reading text throws `extract-module-not-loaded`
|
|
27
|
+
|
|
28
|
+
**Cause:** the document was opened in the base module, which can't extract text.
|
|
29
|
+
|
|
30
|
+
**Fix:** load the extract module, with `init({ extract: true })` or `loadExtract()`, or the text module, before you open the document. A Cloudflare Worker can't fetch it, so import it and pass it: `import extract from "@laminapdf/wasm/lamina_pdf_extract.wasm"`, then `await loadExtract(extract)`. See [`extract-module-not-loaded`](../errors/extract-module-not-loaded.md).
|
|
31
|
+
|
|
32
|
+
## The browser blocks the WebAssembly
|
|
33
|
+
|
|
34
|
+
**Cause:** the page's Content Security Policy doesn't allow compiling WebAssembly.
|
|
35
|
+
|
|
36
|
+
**Fix:** add `'wasm-unsafe-eval'` to its `script-src`. Lamina PDF needs nothing else from the policy. See [Browser and bundlers](../pages/quick-start/browser.md).
|
|
37
|
+
|
|
38
|
+
## `init()` fails in a Vite app
|
|
39
|
+
|
|
40
|
+
**Cause:** Vite pre-bundles dependencies into its own cache, and the `.wasm` files don't move with the JavaScript that loads them.
|
|
41
|
+
|
|
42
|
+
**Fix:** exclude the package from pre-bundling: `optimizeDeps: { exclude: ["@laminapdf/sdk"] }` in `vite.config.ts`. A Web Worker that uses `@laminapdf/sdk/worker` needs the same setting. See [Browser and bundlers](../pages/quick-start/browser.md).
|
|
43
|
+
|
|
44
|
+
## `init()` fails in a Cloudflare Worker
|
|
45
|
+
|
|
46
|
+
**Cause:** Cloudflare Workers can't compile WebAssembly at run time, so `init()` can't build the modules from bytes or a URL.
|
|
47
|
+
|
|
48
|
+
**Fix:** let Wrangler bundle the package, and call `init()` without a URL or bytes. Wrangler picks the package's entry for Cloudflare Workers, which imports the `.wasm` files as compiled modules. See [Cloudflare Workers](../pages/quick-start/workers.md).
|
|
49
|
+
|
|
50
|
+
## Opening a file fails with `password-required` or `wrong-password`
|
|
51
|
+
|
|
52
|
+
**Cause:** the file is encrypted. `password-required` means you passed no password, and `wrong-password` means the one you passed matches neither of the file's passwords.
|
|
53
|
+
|
|
54
|
+
**Fix:** ask your user for the password and open the file again with it. Nothing else has changed. See [Open password-protected files](../pages/guides/password-protected-files.md).
|
|
55
|
+
|
|
56
|
+
## A signed file won't save
|
|
57
|
+
|
|
58
|
+
**Cause:** saving would break a signature, so the save fails with `would-invalidate-signatures`. A signed file saves only incrementally, and only with the edits its signatures allow.
|
|
59
|
+
|
|
60
|
+
**Fix:** keep the default save mode and make only edits the signatures allow. To save anyway, ask your user first, then pass `invalidateSignatures: true`. See [Save a PDF](../pages/guides/save-a-pdf.md) and [`would-invalidate-signatures`](../errors/would-invalidate-signatures.md).
|
|
61
|
+
|
|
62
|
+
## Memory keeps growing
|
|
63
|
+
|
|
64
|
+
**Cause:** documents and builders live in WebAssembly memory, and the garbage collector frees them late: too late for a long-running page or server. WebAssembly memory also never shrinks, so one large file leaves it large.
|
|
65
|
+
|
|
66
|
+
**Fix:** free each one when you're done: `using doc = …` frees it at the end of the block, and `doc.free()` at once. A call on a freed one throws `disposed`. To give grown memory back, call `reset()` while no document is in use: every module starts afresh, and handles from before throw `instance-reset`. See [You free what you create](../pages/concepts/how-lamina-thinks.md#you-free-what-you-create).
|
|
67
|
+
|
|
68
|
+
## A call throws `out-of-memory` or `wasm-trap`
|
|
69
|
+
|
|
70
|
+
**Cause:** the WebAssembly module ran out of memory (it may grow to 2 GiB), or it trapped on a bug in Lamina PDF. Either leaves the module's memory half-written, so Lamina PDF replaces the module's instance before the next call.
|
|
71
|
+
|
|
72
|
+
**Fix:** open the document again from its bytes: documents, pages and builders from the old instance throw `instance-reset`. For `out-of-memory`, keep fewer documents open at once and lower the open limits for files you don't trust. Report a `wasm-trap` with the file that causes it. See [`out-of-memory`](../errors/out-of-memory.md) and [`wasm-trap`](../errors/wasm-trap.md).
|
|
73
|
+
|
|
74
|
+
Next: the [error and warning codes](../errors/README.md), with what each one means and what to do.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./renames.schema.json",
|
|
3
|
+
"schema": "laminapdf.renames/1",
|
|
4
|
+
"renames": [
|
|
5
|
+
{
|
|
6
|
+
"from": "laminapdf::extract::TextRun",
|
|
7
|
+
"to": "laminapdf::extract::PageTextRun",
|
|
8
|
+
"surface": "rust",
|
|
9
|
+
"kind": "type",
|
|
10
|
+
"since": "0.2.0",
|
|
11
|
+
"note": "An extracted run; TextRun now means only drawn text."
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"from": "laminapdf_text::extract::TextRun",
|
|
15
|
+
"to": "laminapdf_text::PageTextRun",
|
|
16
|
+
"surface": "rust",
|
|
17
|
+
"kind": "type",
|
|
18
|
+
"since": "0.2.0",
|
|
19
|
+
"note": "laminapdf-text's extract module is private; its items are at the crate root."
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"from": "laminapdf_text::agl::to_unicode",
|
|
23
|
+
"to": "laminapdf_text::glyph_name_to_unicode",
|
|
24
|
+
"surface": "rust",
|
|
25
|
+
"kind": "function",
|
|
26
|
+
"since": "0.2.0",
|
|
27
|
+
"note": "laminapdf-text's agl module is private."
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"from": "laminapdf_text::Tag",
|
|
31
|
+
"to": "laminapdf_text::OpenTypeTag",
|
|
32
|
+
"surface": "rust",
|
|
33
|
+
"kind": "type",
|
|
34
|
+
"since": "0.2.0",
|
|
35
|
+
"note": "The façade exports it as laminapdf::OpenTypeTag, for Font::instance."
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"from": "laminapdf_build::Font",
|
|
39
|
+
"to": "laminapdf_build::FontHandle",
|
|
40
|
+
"surface": "rust",
|
|
41
|
+
"kind": "type",
|
|
42
|
+
"since": "0.2.0",
|
|
43
|
+
"note": "A font registered with a builder; laminapdf::Font is the font program."
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"from": "laminapdf_content::Color",
|
|
47
|
+
"to": "laminapdf_content::CurrentColor",
|
|
48
|
+
"surface": "rust",
|
|
49
|
+
"kind": "type",
|
|
50
|
+
"since": "0.2.0",
|
|
51
|
+
"note": "The content reader's current colour: a colour space, its components and a pattern."
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"from": "laminapdf_content::Matrix::multiply",
|
|
55
|
+
"to": "laminapdf_model::Matrix::then",
|
|
56
|
+
"surface": "rust",
|
|
57
|
+
"kind": "method",
|
|
58
|
+
"since": "0.2.0",
|
|
59
|
+
"note": "One Matrix for building and reading; then applies the receiver first."
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"from": "laminapdf_content::Matrix::transform_point",
|
|
63
|
+
"to": "laminapdf_model::Matrix::apply",
|
|
64
|
+
"surface": "rust",
|
|
65
|
+
"kind": "method",
|
|
66
|
+
"since": "0.2.0",
|
|
67
|
+
"note": ""
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"from": "laminapdf::CosError",
|
|
71
|
+
"to": "laminapdf::Error::error_code",
|
|
72
|
+
"surface": "rust",
|
|
73
|
+
"kind": "type",
|
|
74
|
+
"since": "0.2.0",
|
|
75
|
+
"note": "The crates' errors are opaque behind Error::Core: match on error_code() instead."
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"from": "laminapdf_source::pending_ranges",
|
|
79
|
+
"to": "laminapdf::Error::pending_ranges",
|
|
80
|
+
"surface": "rust",
|
|
81
|
+
"kind": "function",
|
|
82
|
+
"since": "0.2.0",
|
|
83
|
+
"note": ""
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$defs": {
|
|
3
|
+
"error": {
|
|
4
|
+
"properties": {
|
|
5
|
+
"code": {
|
|
6
|
+
"description": "The stable kebab-case code (fixtures/codes.json).",
|
|
7
|
+
"enum": [
|
|
8
|
+
"not-pdf",
|
|
9
|
+
"missing-root",
|
|
10
|
+
"reference-cycle",
|
|
11
|
+
"limit-exceeded",
|
|
12
|
+
"strict",
|
|
13
|
+
"data-pending",
|
|
14
|
+
"source",
|
|
15
|
+
"type",
|
|
16
|
+
"invalid-structure",
|
|
17
|
+
"unset-object",
|
|
18
|
+
"repaired-base",
|
|
19
|
+
"encrypted-base",
|
|
20
|
+
"password-required",
|
|
21
|
+
"wrong-password",
|
|
22
|
+
"unsupported-security-handler",
|
|
23
|
+
"unexpected-eof",
|
|
24
|
+
"syntax",
|
|
25
|
+
"unsupported-filter",
|
|
26
|
+
"decompress",
|
|
27
|
+
"nested-transaction",
|
|
28
|
+
"no-transaction",
|
|
29
|
+
"unknown-page",
|
|
30
|
+
"direct-page",
|
|
31
|
+
"unsupported-version",
|
|
32
|
+
"invalid-op-log",
|
|
33
|
+
"saved-not-rebased",
|
|
34
|
+
"no-pending-save",
|
|
35
|
+
"sink",
|
|
36
|
+
"not-rebased",
|
|
37
|
+
"sink-not-empty",
|
|
38
|
+
"would-invalidate-signatures",
|
|
39
|
+
"requires-rewrite",
|
|
40
|
+
"invalid-font",
|
|
41
|
+
"collection-index",
|
|
42
|
+
"unknown-axis",
|
|
43
|
+
"font-not-embeddable",
|
|
44
|
+
"missing-glyph",
|
|
45
|
+
"glyph-out-of-range",
|
|
46
|
+
"unknown-font",
|
|
47
|
+
"subset-failed",
|
|
48
|
+
"invalid-axis-value",
|
|
49
|
+
"wrong-document",
|
|
50
|
+
"invalid-feature",
|
|
51
|
+
"invalid-text-range",
|
|
52
|
+
"invalid-spans",
|
|
53
|
+
"unsupported-layout-option",
|
|
54
|
+
"font-mismatch",
|
|
55
|
+
"encoding-full",
|
|
56
|
+
"font-not-shapable",
|
|
57
|
+
"invalid-image",
|
|
58
|
+
"unsupported-image",
|
|
59
|
+
"image-too-large",
|
|
60
|
+
"image-data-length",
|
|
61
|
+
"invalid-icc-profile",
|
|
62
|
+
"color-components",
|
|
63
|
+
"invalid-color",
|
|
64
|
+
"invalid-geometry",
|
|
65
|
+
"text-overflow",
|
|
66
|
+
"page-index-out-of-range",
|
|
67
|
+
"unknown-destination",
|
|
68
|
+
"invalid-page-labels",
|
|
69
|
+
"tag-element-not-open",
|
|
70
|
+
"tag-element-unclosed",
|
|
71
|
+
"profile-version-conflict",
|
|
72
|
+
"missing-title",
|
|
73
|
+
"missing-lang",
|
|
74
|
+
"missing-alt-text",
|
|
75
|
+
"untagged-content",
|
|
76
|
+
"heading-level-skipped",
|
|
77
|
+
"unnumbered-heading-misused",
|
|
78
|
+
"invalid-structure-nesting",
|
|
79
|
+
"link-without-structure",
|
|
80
|
+
"link-without-contents",
|
|
81
|
+
"font-not-embedded",
|
|
82
|
+
"glyph-without-unicode",
|
|
83
|
+
"device-color-without-output-intent",
|
|
84
|
+
"embedded-file-forbidden",
|
|
85
|
+
"embedded-file-without-mime-type",
|
|
86
|
+
"flow-content-too-large",
|
|
87
|
+
"flow-layout-unstable",
|
|
88
|
+
"render-too-large",
|
|
89
|
+
"render-failed",
|
|
90
|
+
"render-backend-unavailable",
|
|
91
|
+
"model-failed",
|
|
92
|
+
"model-result-unexpected",
|
|
93
|
+
"model-needs-host",
|
|
94
|
+
"cancelled",
|
|
95
|
+
"job-finished",
|
|
96
|
+
"document-changed",
|
|
97
|
+
"revision-index-out-of-range",
|
|
98
|
+
"builder-finished",
|
|
99
|
+
"disposed",
|
|
100
|
+
"invalid-argument",
|
|
101
|
+
"source-budget-exceeded",
|
|
102
|
+
"unknown-option",
|
|
103
|
+
"already-initialized",
|
|
104
|
+
"extract-module-not-loaded",
|
|
105
|
+
"fetch-failed",
|
|
106
|
+
"not-initialized",
|
|
107
|
+
"source-changed",
|
|
108
|
+
"text-module-not-loaded",
|
|
109
|
+
"worker-version-mismatch",
|
|
110
|
+
"worker-crashed",
|
|
111
|
+
"worker-failed",
|
|
112
|
+
"wasm-trap",
|
|
113
|
+
"out-of-memory",
|
|
114
|
+
"instance-reset",
|
|
115
|
+
"invalid-command-line",
|
|
116
|
+
"invalid-page-range",
|
|
117
|
+
"binary-output-to-terminal",
|
|
118
|
+
"unknown-code",
|
|
119
|
+
"overwrite-refused",
|
|
120
|
+
"input-unreadable",
|
|
121
|
+
"output-unwritable",
|
|
122
|
+
"path-outside-roots"
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
"data": {
|
|
126
|
+
"description": "Code-specific fields, listed on the code's page; the only place document-derived strings appear (untrusted).",
|
|
127
|
+
"type": "object"
|
|
128
|
+
},
|
|
129
|
+
"didYouMean": {
|
|
130
|
+
"description": "For usage errors: the closest names from lamina's own vocabulary.",
|
|
131
|
+
"items": {
|
|
132
|
+
"type": "string"
|
|
133
|
+
},
|
|
134
|
+
"minItems": 1,
|
|
135
|
+
"type": "array"
|
|
136
|
+
},
|
|
137
|
+
"docsUrl": {
|
|
138
|
+
"description": "The code's explain page: base + code + suffix (ADR 0026 §6).",
|
|
139
|
+
"pattern": "^https:\\/\\/github\\.com\\/laudebugs\\/laminapdf\\/blob\\/main\\/docs\\/errors\\/[a-z0-9-]+\\.md$",
|
|
140
|
+
"type": "string"
|
|
141
|
+
},
|
|
142
|
+
"hint": {
|
|
143
|
+
"description": "One actionable sentence for this code. Never document text.",
|
|
144
|
+
"minLength": 1,
|
|
145
|
+
"type": "string"
|
|
146
|
+
},
|
|
147
|
+
"kind": {
|
|
148
|
+
"$ref": "#/$defs/kind"
|
|
149
|
+
},
|
|
150
|
+
"location": {
|
|
151
|
+
"$ref": "#/$defs/location"
|
|
152
|
+
},
|
|
153
|
+
"message": {
|
|
154
|
+
"description": "One lowercase sentence. Never document text (ADR 0026 §4).",
|
|
155
|
+
"minLength": 1,
|
|
156
|
+
"type": "string"
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"required": [
|
|
160
|
+
"code",
|
|
161
|
+
"kind",
|
|
162
|
+
"message",
|
|
163
|
+
"docsUrl"
|
|
164
|
+
],
|
|
165
|
+
"type": "object"
|
|
166
|
+
},
|
|
167
|
+
"kind": {
|
|
168
|
+
"description": "The nine kinds of ADR 0026 §2.",
|
|
169
|
+
"enum": [
|
|
170
|
+
"input",
|
|
171
|
+
"io",
|
|
172
|
+
"unsupported",
|
|
173
|
+
"limit",
|
|
174
|
+
"security",
|
|
175
|
+
"usage",
|
|
176
|
+
"state",
|
|
177
|
+
"cancelled",
|
|
178
|
+
"internal"
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
"location": {
|
|
182
|
+
"additionalProperties": false,
|
|
183
|
+
"dependentRequired": {
|
|
184
|
+
"streamOffset": [
|
|
185
|
+
"object"
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
"description": "Where the problem is (ADR 0026 §1.1); every value is lamina-made.",
|
|
189
|
+
"properties": {
|
|
190
|
+
"id": {
|
|
191
|
+
"description": "A LaminaPdfId (p12.0).",
|
|
192
|
+
"type": "string"
|
|
193
|
+
},
|
|
194
|
+
"object": {
|
|
195
|
+
"description": "Object number of the indirect object the problem is in or at.",
|
|
196
|
+
"minimum": 0,
|
|
197
|
+
"type": "integer"
|
|
198
|
+
},
|
|
199
|
+
"offset": {
|
|
200
|
+
"description": "Byte offset in the input file.",
|
|
201
|
+
"minimum": 0,
|
|
202
|
+
"type": "integer"
|
|
203
|
+
},
|
|
204
|
+
"pageIndex": {
|
|
205
|
+
"description": "0-based page index (ADR 0027 §6).",
|
|
206
|
+
"minimum": 0,
|
|
207
|
+
"type": "integer"
|
|
208
|
+
},
|
|
209
|
+
"streamOffset": {
|
|
210
|
+
"description": "Byte offset in the decoded data of `object`.",
|
|
211
|
+
"minimum": 0,
|
|
212
|
+
"type": "integer"
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
"type": "object"
|
|
216
|
+
},
|
|
217
|
+
"warning": {
|
|
218
|
+
"properties": {
|
|
219
|
+
"code": {
|
|
220
|
+
"description": "The stable kebab-case code (fixtures/codes.json).",
|
|
221
|
+
"enum": [
|
|
222
|
+
"missing-header",
|
|
223
|
+
"xref-repaired",
|
|
224
|
+
"xrefstm-ignored",
|
|
225
|
+
"stream-length-recovered",
|
|
226
|
+
"stale-generation",
|
|
227
|
+
"page-tree-node-skipped",
|
|
228
|
+
"page-count-mismatch",
|
|
229
|
+
"flate-truncated",
|
|
230
|
+
"objstm-index-mismatch",
|
|
231
|
+
"object-number-out-of-range",
|
|
232
|
+
"aes-padding-invalid",
|
|
233
|
+
"perms-mismatch",
|
|
234
|
+
"warnings-truncated",
|
|
235
|
+
"invalid-box",
|
|
236
|
+
"invalid-rotate",
|
|
237
|
+
"name-tree-node-skipped",
|
|
238
|
+
"outline-cycle",
|
|
239
|
+
"outline-item-skipped",
|
|
240
|
+
"invalid-date",
|
|
241
|
+
"invalid-page-label",
|
|
242
|
+
"invalid-entry",
|
|
243
|
+
"content-unknown-operator",
|
|
244
|
+
"content-bad-operands",
|
|
245
|
+
"content-unbalanced-q",
|
|
246
|
+
"content-unbalanced-bt",
|
|
247
|
+
"content-unbalanced-marked",
|
|
248
|
+
"content-syntax",
|
|
249
|
+
"content-resource-missing",
|
|
250
|
+
"inline-image-unterminated",
|
|
251
|
+
"xobject-cycle",
|
|
252
|
+
"content-path-unpainted",
|
|
253
|
+
"font-invalid",
|
|
254
|
+
"cmap-invalid",
|
|
255
|
+
"unmapped-glyph",
|
|
256
|
+
"extract-limit-blocks",
|
|
257
|
+
"extract-reading-order-ambiguous",
|
|
258
|
+
"extract-table-ambiguous",
|
|
259
|
+
"extract-table-limit",
|
|
260
|
+
"extract-struct-tree-ignored",
|
|
261
|
+
"extract-untagged-content",
|
|
262
|
+
"extract-needs-ocr",
|
|
263
|
+
"extract-column-order-uncertain",
|
|
264
|
+
"tounicode-conflict",
|
|
265
|
+
"whole-font-rebuilt",
|
|
266
|
+
"flow-keep-broken",
|
|
267
|
+
"markdown-html-ignored",
|
|
268
|
+
"markdown-image-missing",
|
|
269
|
+
"covered-text",
|
|
270
|
+
"redaction-not-applied",
|
|
271
|
+
"text-in-earlier-revision"
|
|
272
|
+
]
|
|
273
|
+
},
|
|
274
|
+
"data": {
|
|
275
|
+
"description": "Code-specific fields, listed on the code's page; the only place document-derived strings appear (untrusted).",
|
|
276
|
+
"type": "object"
|
|
277
|
+
},
|
|
278
|
+
"didYouMean": false,
|
|
279
|
+
"docsUrl": {
|
|
280
|
+
"description": "The code's explain page: base + code + suffix (ADR 0026 §6).",
|
|
281
|
+
"pattern": "^https:\\/\\/github\\.com\\/laudebugs\\/laminapdf\\/blob\\/main\\/docs\\/errors\\/[a-z0-9-]+\\.md$",
|
|
282
|
+
"type": "string"
|
|
283
|
+
},
|
|
284
|
+
"hint": {
|
|
285
|
+
"description": "One actionable sentence for this code. Never document text.",
|
|
286
|
+
"minLength": 1,
|
|
287
|
+
"type": "string"
|
|
288
|
+
},
|
|
289
|
+
"kind": {
|
|
290
|
+
"$ref": "#/$defs/kind"
|
|
291
|
+
},
|
|
292
|
+
"location": {
|
|
293
|
+
"$ref": "#/$defs/location"
|
|
294
|
+
},
|
|
295
|
+
"message": {
|
|
296
|
+
"description": "One lowercase sentence. Never document text (ADR 0026 §4).",
|
|
297
|
+
"minLength": 1,
|
|
298
|
+
"type": "string"
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
"required": [
|
|
302
|
+
"code",
|
|
303
|
+
"kind",
|
|
304
|
+
"message",
|
|
305
|
+
"docsUrl"
|
|
306
|
+
],
|
|
307
|
+
"type": "object"
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
"$id": "https://github.com/laudebugs/laminapdf/blob/main/packages/sdk/schemas/error.schema.json",
|
|
311
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
312
|
+
"description": "An error or warning of every lamina surface (ADR 0026 §1): camelCase keys, optional keys omitted (never null). Generated from fixtures/codes.json by `cargo xtask gen codes`; do not edit. New optional keys may appear within version 1; consumers ignore unknown keys.",
|
|
313
|
+
"oneOf": [
|
|
314
|
+
{
|
|
315
|
+
"$ref": "#/$defs/error"
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"$ref": "#/$defs/warning"
|
|
319
|
+
}
|
|
320
|
+
],
|
|
321
|
+
"title": "laminapdf.error/1"
|
|
322
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://docs.laminapdf.com/schemas/renames-1.json",
|
|
4
|
+
"title": "laminapdf.renames/1",
|
|
5
|
+
"description": "What old names in Lamina PDF's APIs became: one entry per renamed, moved or deprecated item, so a coding agent can map old code to the current names.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["schema", "renames"],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"$schema": { "type": "string" },
|
|
11
|
+
"schema": { "const": "laminapdf.renames/1" },
|
|
12
|
+
"renames": {
|
|
13
|
+
"type": "array",
|
|
14
|
+
"items": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"required": ["from", "to", "surface", "kind", "since", "note"],
|
|
17
|
+
"additionalProperties": false,
|
|
18
|
+
"properties": {
|
|
19
|
+
"from": { "type": "string", "minLength": 1, "description": "The old name, as a path (laminapdf::extract::TextRun) or a TypeScript export (Document.save)." },
|
|
20
|
+
"to": { "type": "string", "minLength": 1, "description": "The name to use now." },
|
|
21
|
+
"surface": { "enum": ["rust", "ts", "cli"] },
|
|
22
|
+
"kind": { "enum": ["type", "function", "method", "field", "module", "option", "command", "flag", "code"] },
|
|
23
|
+
"since": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(-[0-9A-Za-z.-]+)?$", "description": "The first version with the new name." },
|
|
24
|
+
"note": { "type": "string" }
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@laminapdf/sdk",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.4",
|
|
4
4
|
"description": "Create, read, edit and save PDFs from TypeScript: Lamina PDF's Rust core as WebAssembly, synchronous after init(), in browsers, Node, Deno, Bun and Cloudflare Workers.",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"homepage": "https://laminapdf.com",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"dist",
|
|
26
|
+
"docs",
|
|
26
27
|
"schemas"
|
|
27
28
|
],
|
|
28
29
|
"exports": {
|
|
@@ -64,10 +65,11 @@
|
|
|
64
65
|
"./package.json": "./package.json"
|
|
65
66
|
},
|
|
66
67
|
"dependencies": {
|
|
67
|
-
"@laminapdf/wasm": "0.2.0-alpha.
|
|
68
|
+
"@laminapdf/wasm": "0.2.0-alpha.4"
|
|
68
69
|
},
|
|
69
70
|
"devDependencies": {
|
|
70
71
|
"@arethetypeswrong/cli": "0.18.5",
|
|
72
|
+
"@microsoft/api-extractor": "7.59.4",
|
|
71
73
|
"@types/node": "26.6.5",
|
|
72
74
|
"@vitest/browser-playwright": "5.0.5",
|
|
73
75
|
"ajv": "8.20.0",
|
|
@@ -80,6 +82,8 @@
|
|
|
80
82
|
"vite": "8.3.5",
|
|
81
83
|
"vitest": "5.0.5",
|
|
82
84
|
"wrangler": "4.152.0",
|
|
85
|
+
"@laminapdf/render-hayro": "0.2.0-alpha.4",
|
|
86
|
+
"@laminapdf/render": "0.2.0-alpha.4",
|
|
83
87
|
"@laminapdf/test-utils": "0.0.0"
|
|
84
88
|
},
|
|
85
89
|
"publishConfig": {
|
|
@@ -88,7 +92,7 @@
|
|
|
88
92
|
"scripts": {
|
|
89
93
|
"build:wasm": "tsc -p tsconfig.build.json",
|
|
90
94
|
"typecheck:wasm": "tsc --noEmit -p tsconfig.json",
|
|
91
|
-
"test:wasm": "pnpm run build:wasm && tsc --noEmit -p tsconfig.json && vitest run -c vitest.node.config.ts --project node",
|
|
95
|
+
"test:wasm": "pnpm run build:wasm && tsc --noEmit -p tsconfig.json && vitest run -c vitest.node.config.ts --project node --project small-memory",
|
|
92
96
|
"lint:package": "publint --strict && attw --pack . --profile esm-only"
|
|
93
97
|
}
|
|
94
98
|
}
|