@mecorelabs/free-pdf-sdk 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/NOTICE CHANGED
@@ -1,46 +1,46 @@
1
- Free PDF SDK
2
- Copyright (c) 2026 the Free PDF SDK contributors.
3
- Licensed under the MIT License or the Apache License, Version 2.0, at your option
4
- (LICENSE-MIT, LICENSE-APACHE).
5
-
6
- Based on pdfcraft
7
- -----------------
8
- Free PDF SDK is based on pdfcraft by the ArtCraft Team and the PdfCraft contributors
9
- (https://github.com/storytold/pdfcraft), used as a Cargo dependency pinned to commit
10
-
11
- 6fb6b7cf6fd8dc105fdd56a764d207cff6140694 (pdfcraft 0.10.0)
12
-
13
- with Free PDF SDK modifications to pdfcraft's interface crate (pdfcraft-ui-egui): opt-in hooks
14
- for white-label branding and for hiding features. The exact modified commit is in Cargo.lock
15
- and in version.json as "pdfcraftRev".
16
-
17
- pdfcraft is Copyright (c) 2026 ArtCraft Team and the PdfCraft contributors, licensed under
18
- the MIT License or the Apache License, Version 2.0. Its licence files, NOTICE and
19
- ATTRIBUTION.md are in third-party/pdfcraft/.
20
-
21
- Trademarks
22
- ----------
23
- "ArtCraft", "PdfCraft" and the ArtCraft logos are trademarks of the ArtCraft Team. Free PDF SDK
24
- does not use them as its name or logo, does not display them, and is not endorsed by the
25
- ArtCraft Team. The ArtCraft logos are not compiled into the viewer (pdfcraft-ui-egui is built
26
- without its `artcraft-marks` feature); the names remain only inside pdfcraft's unused message
27
- strings and translations. The placeholder logos in brand/ are original to this project.
28
-
29
- Third-party material
30
- --------------------
31
- The viewer embeds third-party material under its own licences: Lucide icons (ISC); the Inter,
32
- JetBrains Mono and Dancing Script typefaces (SIL OFL 1.1); egui's default fonts (Ubuntu Font
33
- Licence 1.0, MIT / Bitstream Vera, SIL OFL 1.1, MIT); the Foxit standard-14 substitute fonts and
34
- Adobe CMap resources (BSD-3-Clause); a CC0 ICC profile; and the Rust crates listed in
35
- third-party/crates.md. Licences and required notices are in third-party/ (see its README.md).
36
-
37
- Foxit standard-14 substitute fonts:
38
- Copyright 2014 PDFium Authors. All rights reserved. Original code copyright 2014 Foxit
39
- Software Inc. Redistributed under the BSD-3-Clause licence (third-party/foxit/LICENSE_FOXIT).
40
-
41
- CMap resources (character-mapping data bundled by hayro-cmap):
42
- Copyright 1990-2023 Adobe. All rights reserved. Redistributed under the BSD-3-Clause licence
43
- (third-party/adobe-cmaps/LICENSE.txt). Neither the name of Adobe nor the names of its
44
- contributors are used to endorse or promote this product.
45
-
46
- The brand/ placeholder wordmarks contain outlines of the Inter typeface (SIL OFL 1.1).
1
+ Free PDF SDK
2
+ Copyright (c) 2026 the Free PDF SDK contributors.
3
+ Licensed under the MIT License or the Apache License, Version 2.0, at your option
4
+ (LICENSE-MIT, LICENSE-APACHE).
5
+
6
+ Based on pdfcraft
7
+ -----------------
8
+ Free PDF SDK is based on pdfcraft by the ArtCraft Team and the PdfCraft contributors
9
+ (https://github.com/storytold/pdfcraft), used as a Cargo dependency pinned to commit
10
+
11
+ 88dad98dd478d255399b1405b33765f4da542704 (pdfcraft 0.11.0)
12
+
13
+ with Free PDF SDK modifications to pdfcraft's interface crate (pdfcraft-ui-egui): opt-in hooks
14
+ for white-label branding and for hiding features. The exact modified commit is in Cargo.lock
15
+ and in version.json as "pdfcraftRev".
16
+
17
+ pdfcraft is Copyright (c) 2026 ArtCraft Team and the PdfCraft contributors, licensed under
18
+ the MIT License or the Apache License, Version 2.0. Its licence files, NOTICE and
19
+ ATTRIBUTION.md are in third-party/pdfcraft/.
20
+
21
+ Trademarks
22
+ ----------
23
+ "ArtCraft", "PdfCraft" and the ArtCraft logos are trademarks of the ArtCraft Team. Free PDF SDK
24
+ does not use them as its name or logo, does not display them, and is not endorsed by the
25
+ ArtCraft Team. The ArtCraft logos are not compiled into the viewer (pdfcraft-ui-egui is built
26
+ without its `artcraft-marks` feature); the names remain only inside pdfcraft's unused message
27
+ strings and translations. The placeholder logos in brand/ are original to this project.
28
+
29
+ Third-party material
30
+ --------------------
31
+ The viewer embeds third-party material under its own licences: Lucide icons (ISC); the Inter,
32
+ JetBrains Mono and Dancing Script typefaces (SIL OFL 1.1); egui's default fonts (Ubuntu Font
33
+ Licence 1.0, MIT / Bitstream Vera, SIL OFL 1.1, MIT); the Foxit standard-14 substitute fonts and
34
+ Adobe CMap resources (BSD-3-Clause); a CC0 ICC profile; and the Rust crates listed in
35
+ third-party/crates.md. Licences and required notices are in third-party/ (see its README.md).
36
+
37
+ Foxit standard-14 substitute fonts:
38
+ Copyright 2014 PDFium Authors. All rights reserved. Original code copyright 2014 Foxit
39
+ Software Inc. Redistributed under the BSD-3-Clause licence (third-party/foxit/LICENSE_FOXIT).
40
+
41
+ CMap resources (character-mapping data bundled by hayro-cmap):
42
+ Copyright 1990-2023 Adobe. All rights reserved. Redistributed under the BSD-3-Clause licence
43
+ (third-party/adobe-cmaps/LICENSE.txt). Neither the name of Adobe nor the names of its
44
+ contributors are used to endorse or promote this product.
45
+
46
+ The brand/ placeholder wordmarks contain outlines of the Inter typeface (SIL OFL 1.1).
@@ -19,7 +19,7 @@
19
19
  * @packageDocumentation
20
20
  */
21
21
  /** The SDK version this wrapper belongs to. */
22
- export declare const SDK_VERSION = "0.2.0";
22
+ export declare const SDK_VERSION = "0.2.1";
23
23
  /** The postMessage protocol version this wrapper speaks. */
24
24
  export declare const PROTOCOL_VERSION = 1;
25
25
  /** Every mode, in documentation order. */
@@ -348,6 +348,6 @@ export declare const FreePdf: {
348
348
  /** See {@link init}. */
349
349
  readonly init: typeof init;
350
350
  /** The wrapper's version. */
351
- readonly version: "0.2.0";
351
+ readonly version: "0.2.1";
352
352
  };
353
353
  export default FreePdf;
@@ -19,7 +19,7 @@
19
19
  * @packageDocumentation
20
20
  */
21
21
  /** The SDK version this wrapper belongs to. */
22
- export const SDK_VERSION = "0.2.0";
22
+ export const SDK_VERSION = "0.2.1";
23
23
  /** The postMessage protocol version this wrapper speaks. */
24
24
  export const PROTOCOL_VERSION = 1;
25
25
  /** Every mode, in documentation order. */
@@ -1 +1 @@
1
- {"version":3,"file":"free-pdf-sdk.js","sourceRoot":"","sources":["../src/free-pdf-sdk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,+CAA+C;AAC/C,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC;AAEnC,4DAA4D;AAC5D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC,0CAA0C;AAC1C,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAWzG,6CAA6C;AAC7C,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,aAAa;IACb,UAAU;IACV,UAAU;IACV,YAAY;IACZ,mBAAmB;IACnB,gBAAgB;IAChB,OAAO;IACP,WAAW;IACX,aAAa;IACb,SAAS;IACT,WAAW;IACX,eAAe;IACf,WAAW;IACX,YAAY;IACZ,UAAU;IACV,SAAS;IACT,MAAM;IACN,UAAU;IACV,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;IACT,aAAa;CACL,CAAC;AAgRX,4DAA4D;AAC5D,MAAM,OAAO,YAAa,SAAQ,KAAK;IAIrC;;;OAGG;IACH,YAAY,IAAe,EAAE,OAAe;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAgFD,MAAM,gBAAgB,GAAG,KAAM,CAAC;AAChC,MAAM,kBAAkB,GAAG,KAAM,CAAC;AAUlC,SAAS,QAAQ,CAA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MAAM,CAAC;QACjE,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS;YAAE,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QACjE,MAAM,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC3B,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACrB,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QACnH,CAAC;QACD,MAAM,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QACvB,MAAM,CAAC,YAAY,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAChF,CAAC;AACH,CAAC;AAED,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,wBAAwB;IACxB,IAAI;IACJ,6BAA6B;IAC7B,OAAO,EAAE,WAAW;CACZ,CAAC;AAEX,eAAe,OAAO,CAAC","sourcesContent":["/**\r\n * Free PDF SDK: an embeddable PDF viewer and annotator for the web, based on pdfcraft.\r\n *\r\n * ```ts\r\n * import { FreePdf } from \"@mecorelabs/free-pdf-sdk\";\r\n * const viewer = await FreePdf.init(document.getElementById(\"viewer\")!, {\r\n * baseUrl: \"/free-pdf-sdk/\",\r\n * mode: \"annotate\",\r\n * theme: \"system\",\r\n * document: { url: \"/files/artwork.pdf\" },\r\n * });\r\n * viewer.on(\"annotationsChanged\", ({ count }) => console.log(count));\r\n * ```\r\n *\r\n * Each viewer is an iframe on the host's own origin (the SDK folder must be served from the same\r\n * origin as the page). The wrapper talks to it over a versioned postMessage protocol; see\r\n * docs/api.md and docs/architecture.md.\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\n/** The SDK version this wrapper belongs to. */\r\nexport const SDK_VERSION = \"0.2.0\";\r\n\r\n/** The postMessage protocol version this wrapper speaks. */\r\nexport const PROTOCOL_VERSION = 1;\r\n\r\n/** Every mode, in documentation order. */\r\nexport const MODES = [\"view\", \"review\", \"annotate\", \"fill\", \"sign\", \"organize\", \"edit\", \"full\"] as const;\r\n\r\n/**\r\n * Viewer mode: a preset of {@link Feature | features}. `view` is read-only; `review` adds notes\r\n * and text markup; `annotate` every kind of annotation and Fill & Sign; `fill` form filling and\r\n * Fill & Sign; `sign` adds digital signatures; `organize` pages and bookmarks; `edit` full\r\n * authoring without security, redaction, digital signatures or JavaScript; `full` everything\r\n * except JavaScript. Fine-tune any mode with {@link InitOptions.features}.\r\n */\r\nexport type Mode = (typeof MODES)[number];\r\n\r\n/** Every feature, in documentation order. */\r\nexport const FEATURES = [\r\n \"comments\",\r\n \"markup\",\r\n \"shapes\",\r\n \"ink\",\r\n \"stamps\",\r\n \"measurement\",\r\n \"fillSign\",\r\n \"formFill\",\r\n \"formDesign\",\r\n \"digitalSignatures\",\r\n \"signaturePanel\",\r\n \"pages\",\r\n \"bookmarks\",\r\n \"editContent\",\r\n \"flatten\",\r\n \"redaction\",\r\n \"accessibility\",\r\n \"standards\",\r\n \"javascript\",\r\n \"security\",\r\n \"history\",\r\n \"save\",\r\n \"download\",\r\n \"export\",\r\n \"print\",\r\n \"search\",\r\n \"copy\",\r\n \"documentInfo\",\r\n \"help\",\r\n \"palette\",\r\n \"preferences\",\r\n] as const;\r\n\r\n/**\r\n * Something the viewer can offer. A feature that is off is hidden everywhere in the viewer\r\n * (menus, toolbars, panels, context menus, shortcuts) and refused if reached anyway. The docs'\r\n * configuration page describes each one.\r\n */\r\nexport type Feature = (typeof FEATURES)[number];\r\n\r\n/** Feature switches, applied on top of the mode's features. */\r\nexport type FeatureFlags = Partial<Record<Feature, boolean>>;\r\n\r\n/** Right-hand panels {@link UiOptions.panels} accepts. */\r\nexport type PanelName = \"comments\" | \"bookmarks\" | \"pages\" | \"fields\" | \"layers\" | \"attachments\" | \"signatures\" | \"accessibility\" | \"tags\" | \"search\";\r\n\r\n/** Parts of the viewer's interface to show or hide (unset options keep their current value). */\r\nexport interface UiOptions {\r\n /** The Tools panel on the left, listing the tool groups of the enabled features (default true). */\r\n toolsPanel?: boolean;\r\n /** A slim rail that brings the Tools panel back once it is closed (default true). */\r\n toolsRail?: boolean;\r\n /** The floating tool bar beside the page (default true). */\r\n quickToolbar?: boolean;\r\n /** The right-hand rail: panel buttons, page navigation and zoom (default true). */\r\n rightRail?: boolean;\r\n /** Zoom and page display controls on the rail (default true). */\r\n zoomControls?: boolean;\r\n /** Page navigation on the rail (default true). */\r\n pageNavigation?: boolean;\r\n /** The main menu button (default true). */\r\n menu?: boolean;\r\n /** The \"Find tools and commands\" box (default true; needs the `palette` feature). */\r\n searchBox?: boolean;\r\n /** Show (true) or hide (false) right-hand panels; unlisted panels show when their feature is on. */\r\n panels?: Partial<Record<PanelName, boolean>>;\r\n /** Panels can't be moved, floated or closed from their tabs (default false). */\r\n lockLayout?: boolean;\r\n /** Also list tools that are planned but not available yet (default false). */\r\n showPlannedTools?: boolean;\r\n /** Links to web pages in documents may open, after a prompt (default true). */\r\n externalLinks?: boolean;\r\n}\r\n\r\n/** The viewer's configuration, as {@link FreePdfViewer.getConfig} reports it. */\r\nexport interface ViewerConfig {\r\n /** The mode. */\r\n mode: Mode;\r\n /** Every feature, on or off (the mode's preset with your overrides applied). */\r\n features: Record<Feature, boolean>;\r\n /** Interface options. */\r\n ui: Required<Omit<UiOptions, \"panels\">> & { panels: Partial<Record<PanelName, boolean>> };\r\n /** Hidden elements. */\r\n disabledElements: ElementId[];\r\n /** No feature that changes the document is on. */\r\n readOnly: boolean;\r\n}\r\n\r\n/** Colour theme; `system` follows the browser's preference. */\r\nexport type Theme = \"light\" | \"dark\" | \"system\";\r\n\r\n/** Zoom: a percentage (10–6400) or a fit. */\r\nexport type Zoom = number | \"fit-width\" | \"fit-page\";\r\n\r\n/**\r\n * Ids accepted by `disabledElements` and {@link FreePdfViewer.setDisabledElements}.\r\n * docs/api.md lists what each one hides.\r\n */\r\nexport type ElementId =\r\n | \"download\"\r\n | \"save\"\r\n | \"print\"\r\n | \"open\"\r\n | \"flatten\"\r\n | \"settings\"\r\n | \"import\"\r\n | \"tool:note\"\r\n | \"tool:freetext\"\r\n | \"tool:callout\"\r\n | \"tool:highlight\"\r\n | \"tool:underline\"\r\n | \"tool:strikeout\"\r\n | \"tool:squiggly\"\r\n | \"tool:caret\"\r\n | \"tool:replace\"\r\n | \"tool:ink\"\r\n | \"tool:line\"\r\n | \"tool:arrow\"\r\n | \"tool:square\"\r\n | \"tool:circle\"\r\n | \"tool:polygon\"\r\n | \"tool:polyline\"\r\n | \"tool:cloud\"\r\n | \"tool:attach\"\r\n | \"tool:stamp\"\r\n | \"tool:image\"\r\n | \"tool:link\"\r\n | \"tool:measure\"\r\n | \"tool:fillsign\"\r\n | \"tool:signature\";\r\n\r\n/** A PDF to open: fetched from a URL, or given as bytes. */\r\nexport type DocumentSource =\r\n | {\r\n /** URL of the PDF (same-origin, or CORS-enabled such as a Firebase Storage download URL). */\r\n url: string;\r\n /** File name shown in the viewer; defaults to the URL's last path segment. */\r\n name?: string;\r\n /** Options for `fetch` (headers, credentials). */\r\n fetchInit?: RequestInit;\r\n }\r\n | {\r\n /** The PDF's bytes. They are copied, never detached from the caller. */\r\n data: ArrayBuffer | Uint8Array | Blob;\r\n /** File name shown in the viewer; defaults to the Blob's name or `document.pdf`. */\r\n name?: string;\r\n };\r\n\r\n/**\r\n * The loading animation shown over the viewer while it starts and while a document opens.\r\n * Give one of `src` or `svg`; with neither, the built-in spinner is shown.\r\n */\r\nexport interface LoaderOptions {\r\n /** URL of an image: an SVG, GIF, animated WebP or PNG, or a `data:` URL. */\r\n src?: string;\r\n /** Inline SVG markup. It is shown as an image, so scripts in it never run. */\r\n svg?: string;\r\n /** Width of the image as a CSS length (default `48px`); the height follows its aspect ratio. */\r\n size?: string;\r\n /** Background behind it as a CSS colour (default: the viewer's background for the theme). */\r\n background?: string;\r\n /** What screen readers announce (default `Loading`). */\r\n label?: string;\r\n}\r\n\r\n/** A loader: a URL of an image (shorthand for `{ src }`), or {@link LoaderOptions}. */\r\nexport type Loader = string | LoaderOptions;\r\n\r\n/** Options for {@link FreePdf.init}. */\r\nexport interface InitOptions {\r\n /** URL of the SDK folder (the one holding `viewer/` and `version.json`), on the page's origin. */\r\n baseUrl: string;\r\n /** A document to open once the viewer is ready. */\r\n document?: DocumentSource;\r\n /** A preset of features (default `view`, read-only). */\r\n mode?: Mode;\r\n /** Turn individual features on or off, on top of the mode's preset. */\r\n features?: FeatureFlags;\r\n /** Show or hide parts of the interface. */\r\n ui?: UiOptions;\r\n /** Author of new comments; it wins over a name saved in the viewer's settings. */\r\n author?: string;\r\n /** Colour theme (default `system`). */\r\n theme?: Theme;\r\n /** Password: opens a document that needs one, and lifts owner restrictions (as {@link FreePdfViewer.unlock}). */\r\n password?: string;\r\n /** Parts of the interface to hide. */\r\n disabledElements?: ElementId[];\r\n /** Interface language, such as `en`, `de` or `zh-Hans` (closest available; English otherwise). */\r\n locale?: string;\r\n /**\r\n * Loading animation shown while the viewer starts and while a document opens (default: a\r\n * built-in spinner; `false`: none). Read once, when the viewer mounts.\r\n */\r\n loader?: Loader | false;\r\n /** Milliseconds to wait for a reply before rejecting with `TIMEOUT` (default 60000; loads get twice that). */\r\n timeoutMs?: number;\r\n /**\r\n * Listeners attached before the viewer starts, so they also hear events fired while `init`\r\n * is still running (`ready`, the first `documentLoaded`). `ready` also reaches listeners\r\n * added later with `on`.\r\n */\r\n listeners?: { [K in EventName]?: Listener<K> };\r\n}\r\n\r\n/** What the open document's security allows. */\r\nexport interface Permissions {\r\n /** Comments may be added, changed, deleted and imported. */\r\n canAnnotate: boolean;\r\n /** The document may be printed. */\r\n canPrint: boolean;\r\n /** Text and images may be copied. */\r\n canCopy: boolean;\r\n /** The document is encrypted. */\r\n isEncrypted: boolean;\r\n /** An owner password would lift restrictions ({@link FreePdfViewer.unlock}). */\r\n canUnlock: boolean;\r\n}\r\n\r\n/** A reply in a comment thread. */\r\nexport interface AnnotationReply {\r\n /** The reply's id (XFDF `name`). */\r\n id: string;\r\n /** Author (XFDF `title`). */\r\n author: string | null;\r\n /** Text. */\r\n contents: string | null;\r\n /** Last modified, ISO 8601. */\r\n date: string | null;\r\n}\r\n\r\n/** A comment, as {@link FreePdfViewer.getAnnotations} lists it. */\r\nexport interface Annotation {\r\n /** The annotation's id (XFDF `name`). */\r\n id: string;\r\n /** The PDF subtype in lowercase: `text` (note), `freetext`, `square`, `circle`, `line`, `ink`, `polygon`, `polyline`, `highlight`, `underline`, `squiggly`, `strikeout`, `stamp`, `caret`, `fileattachment`, `sound`, `redact`. */\r\n type: string;\r\n /** Author (XFDF `title`). */\r\n author: string | null;\r\n /** Subject. */\r\n subject: string | null;\r\n /** Text. */\r\n contents: string | null;\r\n /** Last modified (else created), ISO 8601. */\r\n date: string | null;\r\n /** 0-based page index. */\r\n pageIndex: number;\r\n /** Colour, `#RRGGBB`. */\r\n color: string | null;\r\n /** Replies, oldest first. */\r\n replies: AnnotationReply[];\r\n}\r\n\r\n/** A newly opened document. */\r\nexport interface DocumentInfo {\r\n /** Number of pages. */\r\n pageCount: number;\r\n /** What its security allows. */\r\n permissions: Permissions;\r\n}\r\n\r\n/** The result of {@link FreePdfViewer.load}. */\r\nexport interface LoadResult extends DocumentInfo {\r\n /** The `password` lifted owner restrictions. */\r\n unlocked: boolean;\r\n}\r\n\r\n/** Versions of the SDK and of pdfcraft. */\r\nexport interface VersionInfo {\r\n /** The SDK version (semver). */\r\n sdk: string;\r\n /** The pdfcraft commit the viewer was built from. */\r\n pdfcraftRev: string;\r\n}\r\n\r\n/** Error codes. `TIMEOUT`, `DESTROYED` and `FETCH_FAILED` come from the wrapper; the rest from the viewer. */\r\nexport type ErrorCode =\r\n | \"BAD_REQUEST\"\r\n | \"UNKNOWN_METHOD\"\r\n | \"UNSUPPORTED_PROTOCOL\"\r\n | \"NOT_READY\"\r\n | \"NO_DOCUMENT\"\r\n | \"LOAD_FAILED\"\r\n | \"NEEDS_PASSWORD\"\r\n | \"WRONG_PASSWORD\"\r\n | \"NOT_PERMITTED\"\r\n | \"READ_ONLY\"\r\n | \"XFDF_INVALID\"\r\n | \"TOO_LARGE\"\r\n | \"BUSY\"\r\n | \"INTERNAL\"\r\n | \"TIMEOUT\"\r\n | \"DESTROYED\"\r\n | \"FETCH_FAILED\";\r\n\r\n/** An error as data: what events carry. */\r\nexport interface ErrorInfo {\r\n /** Machine-readable code. */\r\n code: ErrorCode;\r\n /** Human-readable message (English). */\r\n message: string;\r\n}\r\n\r\n/** Every failure of the SDK: a typed code and a message. */\r\nexport class FreePdfError extends Error implements ErrorInfo {\r\n /** Machine-readable code. */\r\n readonly code: ErrorCode;\r\n\r\n /**\r\n * @param code - Machine-readable code.\r\n * @param message - Human-readable message.\r\n */\r\n constructor(code: ErrorCode, message: string) {\r\n super(message);\r\n this.name = \"FreePdfError\";\r\n this.code = code;\r\n }\r\n}\r\n\r\n/** Events and the data each one carries. */\r\nexport interface EventMap {\r\n /** The viewer is configured and ready for requests. */\r\n ready: VersionInfo;\r\n /** A document opened. */\r\n documentLoaded: DocumentInfo;\r\n /** A document could not be opened. */\r\n documentError: ErrorInfo;\r\n /** Comments were added, changed or removed (by the user or the API). */\r\n annotationsChanged: { count: number };\r\n /** The document gained or lost unsaved changes. */\r\n dirtyChanged: { dirty: boolean };\r\n /** Something failed outside a request (for example a wrong `password` at load). */\r\n error: ErrorInfo;\r\n /** The user pressed Save in the viewer: here is the saved PDF. The viewer treats it as saved. */\r\n saveRequested: { name: string; saveAs: boolean; data: Uint8Array };\r\n}\r\n\r\n/** An event name. */\r\nexport type EventName = keyof EventMap;\r\n\r\n/** A listener for event `K`. */\r\nexport type Listener<K extends EventName> = (data: EventMap[K]) => void;\r\n\r\n/** A mounted viewer. Every method is async and rejects with {@link FreePdfError}. */\r\nexport interface FreePdfViewer {\r\n /** Opens a document, replacing the one shown. */\r\n load(document: DocumentSource, options?: { password?: string }): Promise<LoadResult>;\r\n /** Lifts owner restrictions with the owner password; resolves to the new permissions. */\r\n unlock(password: string): Promise<Permissions>;\r\n /** What the open document's security allows. */\r\n getPermissions(): Promise<Permissions>;\r\n /** Imports comments from standard XFDF; `replace` deletes the existing ones first. Resolves to the number imported. */\r\n importXfdf(xfdf: string | Blob, options?: { replace?: boolean }): Promise<number>;\r\n /** The document's comments as XFDF (author in `title`). */\r\n exportXfdf(): Promise<string>;\r\n /** The document's comments with their replies; the length is the exact count. */\r\n getAnnotations(): Promise<Annotation[]>;\r\n /** Deletes every comment (one undo step per comment); resolves to how many there were. */\r\n deleteAllAnnotations(): Promise<number>;\r\n /** Sets the author of new comments. */\r\n setAuthor(author: string): Promise<void>;\r\n /** Sets the colour theme. */\r\n setTheme(theme: Theme): Promise<void>;\r\n /** Switches mode; your feature overrides still apply on top of it. */\r\n setMode(mode: Mode): Promise<void>;\r\n /** Replaces the feature overrides (relative to the mode). Pass `{}` to use the mode's features as they are. */\r\n setFeatures(features: FeatureFlags): Promise<void>;\r\n /** Changes interface options; options you leave out keep their value. */\r\n setUi(ui: UiOptions): Promise<void>;\r\n /** The resolved configuration: mode, every feature on or off, interface options. */\r\n getConfig(): Promise<ViewerConfig>;\r\n /** Hides parts of the interface (replaces the previous list). */\r\n setDisabledElements(ids: ElementId[]): Promise<void>;\r\n /** Sets the interface language; resolves to the language used. */\r\n setLocale(locale: string): Promise<string>;\r\n /** Number of pages. */\r\n getPageCount(): Promise<number>;\r\n /** Shows page `page` (1-based). */\r\n goToPage(page: number): Promise<void>;\r\n /** Sets the zoom: a percentage, `fit-width` or `fit-page`. */\r\n setZoom(zoom: Zoom): Promise<void>;\r\n /** Whether there are unsaved changes. */\r\n isDirty(): Promise<boolean>;\r\n /** The PDF with every change (comments included); the viewer then treats it as saved. */\r\n save(): Promise<Uint8Array>;\r\n /** Versions of the SDK and pdfcraft. */\r\n version(): Promise<VersionInfo>;\r\n /** Removes the viewer; pending requests reject with `DESTROYED`. Safe to call twice. */\r\n destroy(): Promise<void>;\r\n /** Adds a listener. */\r\n on<K extends EventName>(name: K, listener: Listener<K>): void;\r\n /** Removes a listener. */\r\n off<K extends EventName>(name: K, listener: Listener<K>): void;\r\n /** The iframe holding the viewer. */\r\n readonly iframe: HTMLIFrameElement;\r\n}\r\n\r\nconst HELLO_TIMEOUT_MS = 30_000;\r\nconst DEFAULT_TIMEOUT_MS = 60_000;\r\n\r\ninterface Pending {\r\n resolve: (value: unknown) => void;\r\n reject: (error: FreePdfError) => void;\r\n timer: ReturnType<typeof setTimeout>;\r\n}\r\n\r\ntype AnyListener = (data: never) => void;\r\n\r\nfunction isRecord(v: unknown): v is Record<string, unknown> {\r\n return typeof v === \"object\" && v !== null;\r\n}\r\n\r\nfunction asErrorInfo(v: unknown): ErrorInfo {\r\n if (isRecord(v) && typeof v.code === \"string\" && typeof v.message === \"string\") {\r\n return { code: v.code as ErrorCode, message: v.message };\r\n }\r\n return { code: \"INTERNAL\", message: \"malformed error from the viewer\" };\r\n}\r\n\r\n/** A plain copy of interface options (a reactive proxy can't be posted to the iframe). */\r\nfunction plainUi(ui: UiOptions): Record<string, unknown> {\r\n const out: Record<string, unknown> = { ...ui };\r\n if (ui.panels) out.panels = { ...ui.panels };\r\n return out;\r\n}\r\n\r\nfunction channelId(): string {\r\n const bytes = new Uint8Array(16);\r\n crypto.getRandomValues(bytes);\r\n return Array.from(bytes, (b) => b.toString(16).padStart(2, \"0\")).join(\"\");\r\n}\r\n\r\nfunction nameFromUrl(url: string): string {\r\n try {\r\n const last = new URL(url, location.href).pathname.split(\"/\").filter(Boolean).pop();\r\n return last ? decodeURIComponent(last) : \"document.pdf\";\r\n } catch {\r\n return \"document.pdf\";\r\n }\r\n}\r\n\r\n/** Copies the document's bytes into a fresh ArrayBuffer (safe to transfer). A URL is fetched within `timeoutMs`. */\r\nasync function readDocument(source: DocumentSource, timeoutMs: number): Promise<{ name: string; bytes: ArrayBuffer }> {\r\n if (\"url\" in source) {\r\n const controller = new AbortController();\r\n const timer = setTimeout(() => controller.abort(), timeoutMs);\r\n const callerSignal = source.fetchInit?.signal;\r\n const onAbort = (): void => controller.abort();\r\n callerSignal?.addEventListener(\"abort\", onAbort, { once: true });\r\n if (callerSignal?.aborted) controller.abort();\r\n try {\r\n const response = await fetch(source.url, { ...source.fetchInit, signal: controller.signal });\r\n if (!response.ok) throw new FreePdfError(\"FETCH_FAILED\", `could not fetch the document: HTTP ${response.status}`);\r\n return { name: source.name ?? nameFromUrl(source.url), bytes: await response.arrayBuffer() };\r\n } catch (e) {\r\n if (e instanceof FreePdfError) throw e;\r\n const why = controller.signal.aborted && !callerSignal?.aborted ? `no response in ${timeoutMs} ms` : String(e);\r\n throw new FreePdfError(\"FETCH_FAILED\", `could not fetch the document: ${why}`);\r\n } finally {\r\n clearTimeout(timer);\r\n callerSignal?.removeEventListener(\"abort\", onAbort);\r\n }\r\n }\r\n const data = source.data;\r\n if (data instanceof Blob) {\r\n const fileName = typeof File !== \"undefined\" && data instanceof File ? data.name : undefined;\r\n return { name: source.name ?? fileName ?? \"document.pdf\", bytes: await data.arrayBuffer() };\r\n }\r\n if (data instanceof ArrayBuffer) return { name: source.name ?? \"document.pdf\", bytes: data.slice(0) };\r\n if (data instanceof Uint8Array) {\r\n const copy = new Uint8Array(data.byteLength);\r\n copy.set(data);\r\n return { name: source.name ?? \"document.pdf\", bytes: copy.buffer };\r\n }\r\n throw new FreePdfError(\"BAD_REQUEST\", \"document needs a url or data (ArrayBuffer, Uint8Array or Blob)\");\r\n}\r\n\r\n/** The built-in loader: a ring that turns (slower when the user asks for reduced motion). */\r\nconst DEFAULT_LOADER_SVG =\r\n '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"48\" height=\"48\" viewBox=\"0 0 48 48\"><style>' +\r\n \"circle{fill:none;stroke-width:4;stroke-linecap:round}.t{stroke:rgba(128,128,136,.25)}\" +\r\n \".a{stroke:rgb(128,128,136);stroke-dasharray:30 200;transform-origin:24px 24px;animation:s .9s linear infinite}\" +\r\n \"@keyframes s{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.a{animation-duration:3s}}\" +\r\n '</style><circle class=\"t\" cx=\"24\" cy=\"24\" r=\"18\"/><circle class=\"a\" cx=\"24\" cy=\"24\" r=\"18\"/></svg>';\r\n\r\n/** Inline SVG markup is at most this long. */\r\nconst MAX_LOADER_SVG = 1024 * 1024;\r\n\r\n/** The loader as a plain, checked description (throws `BAD_REQUEST`), or `null` for none. */\r\nfunction loaderOptions(loader: Loader | false | undefined): LoaderOptions | null {\r\n if (loader === false) return null;\r\n if (loader === undefined) return { svg: DEFAULT_LOADER_SVG };\r\n if (typeof loader === \"string\") return { src: loader };\r\n if (!isRecord(loader)) throw new FreePdfError(\"BAD_REQUEST\", \"loader must be a URL, an object or false\");\r\n const out: LoaderOptions = {};\r\n for (const key of [\"src\", \"svg\", \"size\", \"background\", \"label\"] as const) {\r\n const v = loader[key];\r\n if (v === undefined) continue;\r\n if (typeof v !== \"string\") throw new FreePdfError(\"BAD_REQUEST\", `loader.${key} must be a string`);\r\n out[key] = v;\r\n }\r\n if (out.svg !== undefined && out.svg.length > MAX_LOADER_SVG) throw new FreePdfError(\"TOO_LARGE\", \"loader.svg is over 1 MiB\");\r\n if (out.src === undefined && out.svg === undefined) out.svg = DEFAULT_LOADER_SVG;\r\n return out;\r\n}\r\n\r\n/** The viewer's own background before it paints, so the loader matches it. */\r\nfunction themeBackground(theme: Theme): string {\r\n const dark = theme === \"dark\" || (theme === \"system\" && typeof matchMedia === \"function\" && matchMedia(\"(prefers-color-scheme: dark)\").matches);\r\n return dark ? \"#19191c\" : \"#f1f1f3\";\r\n}\r\n\r\n/** Builds the loader overlay (visible). */\r\nfunction loaderElement(options: LoaderOptions, theme: Theme): HTMLDivElement {\r\n const overlay = document.createElement(\"div\");\r\n overlay.setAttribute(\"role\", \"status\");\r\n overlay.dataset.fpsLoader = \"\";\r\n overlay.style.cssText = \"position:absolute;inset:0;display:flex;align-items:center;justify-content:center;transition:opacity .2s ease;\";\r\n overlay.style.background = options.background ?? themeBackground(theme);\r\n const img = document.createElement(\"img\");\r\n // An <img>: an SVG shown this way can't run scripts or load other resources.\r\n img.src = options.src ?? `data:image/svg+xml;charset=utf-8,${encodeURIComponent(options.svg ?? DEFAULT_LOADER_SVG)}`;\r\n img.alt = options.label ?? \"Loading\";\r\n img.decoding = \"async\";\r\n img.style.cssText = \"display:block;height:auto;max-width:80%;max-height:80%;\";\r\n img.style.width = options.size ?? \"48px\";\r\n overlay.appendChild(img);\r\n return overlay;\r\n}\r\n\r\nclass Viewer implements FreePdfViewer {\r\n readonly iframe: HTMLIFrameElement;\r\n /** Holds the iframe and the loader; what the viewer adds to the host's element. */\r\n private readonly root: HTMLDivElement;\r\n private readonly loader: HTMLDivElement | null;\r\n /** Work the loader is shown for (starting counts as one). */\r\n private busy = 1;\r\n private readonly origin: string;\r\n private readonly channel = channelId();\r\n private readonly pending = new Map<number, Pending>();\r\n private readonly listeners = new Map<EventName, Set<AnyListener>>();\r\n private readonly timeoutMs: number;\r\n private nextId = 1;\r\n private destroyed = false;\r\n private hello: { resolve: (info: VersionInfo) => void; reject: (e: FreePdfError) => void } | null = null;\r\n private readyInfo: VersionInfo | null = null;\r\n private readonly onMessage = (event: MessageEvent): void => this.receive(event);\r\n\r\n constructor(element: HTMLElement, baseUrl: URL, timeoutMs: number, loader: LoaderOptions | null, theme: Theme) {\r\n this.origin = baseUrl.origin;\r\n this.timeoutMs = timeoutMs;\r\n this.root = document.createElement(\"div\");\r\n this.root.style.cssText = \"position:relative;width:100%;height:100%;\";\r\n this.iframe = document.createElement(\"iframe\");\r\n this.iframe.src = new URL(`viewer/index.html#ch=${this.channel}`, baseUrl).href;\r\n this.iframe.title = \"PDF viewer\";\r\n this.iframe.setAttribute(\"allow\", \"clipboard-read; clipboard-write; fullscreen\");\r\n this.iframe.style.cssText = \"display:block;width:100%;height:100%;border:0;\";\r\n this.root.appendChild(this.iframe);\r\n this.loader = loader ? loaderElement(loader, theme) : null;\r\n if (this.loader) this.root.appendChild(this.loader);\r\n window.addEventListener(\"message\", this.onMessage);\r\n element.appendChild(this.root);\r\n }\r\n\r\n /** Shows the loader for a piece of work; pair with {@link idle}. */\r\n busyStart(): void {\r\n this.busy++;\r\n if (this.loader) {\r\n this.loader.hidden = false;\r\n this.loader.style.opacity = \"1\";\r\n this.loader.style.pointerEvents = \"\";\r\n }\r\n }\r\n\r\n /** Ends a piece of work; the loader fades out when none is left. */\r\n idle(): void {\r\n this.busy = Math.max(0, this.busy - 1);\r\n const loader = this.loader;\r\n if (!loader || this.busy > 0) return;\r\n // Clicks reach the viewer at once, not only when the fade is over.\r\n loader.style.opacity = \"0\";\r\n loader.style.pointerEvents = \"none\";\r\n setTimeout(() => {\r\n if (this.busy === 0) loader.hidden = true;\r\n }, 200);\r\n }\r\n\r\n /** Waits for the viewer's hello. */\r\n started(): Promise<VersionInfo> {\r\n return new Promise<VersionInfo>((resolve, reject) => {\r\n const timer = setTimeout(() => {\r\n this.hello = null;\r\n reject(new FreePdfError(\"TIMEOUT\", \"the viewer did not start (is baseUrl right, and WebGL available?)\"));\r\n }, HELLO_TIMEOUT_MS);\r\n this.hello = {\r\n resolve: (info) => {\r\n clearTimeout(timer);\r\n resolve(info);\r\n },\r\n reject: (e) => {\r\n clearTimeout(timer);\r\n reject(e);\r\n },\r\n };\r\n });\r\n }\r\n\r\n private receive(event: MessageEvent): void {\r\n if (event.origin !== this.origin || event.source !== this.iframe.contentWindow) return;\r\n const msg: unknown = event.data;\r\n if (!isRecord(msg) || msg.ch !== this.channel) return;\r\n if (msg.fps !== PROTOCOL_VERSION) {\r\n // Another protocol version: fail what is waiting for it now, not after a timeout.\r\n const err = new FreePdfError(\"UNSUPPORTED_PROTOCOL\", `the viewer speaks protocol ${String(msg.fps)}; this wrapper speaks ${PROTOCOL_VERSION}`);\r\n if (msg.kind === \"hello\" && this.hello) {\r\n this.hello.reject(err);\r\n this.hello = null;\r\n return;\r\n }\r\n const p = msg.kind === \"res\" && typeof msg.id === \"number\" ? this.pending.get(msg.id) : undefined;\r\n if (p && typeof msg.id === \"number\") {\r\n this.pending.delete(msg.id);\r\n clearTimeout(p.timer);\r\n p.reject(err);\r\n return;\r\n }\r\n this.emit(\"error\", { code: err.code, message: err.message });\r\n return;\r\n }\r\n switch (msg.kind) {\r\n case \"hello\": {\r\n const info = isRecord(msg.info) ? msg.info : {};\r\n const version: VersionInfo = { sdk: String(info.sdk ?? \"\"), pdfcraftRev: String(info.pdfcraftRev ?? \"\") };\r\n if (version.sdk !== SDK_VERSION) {\r\n console.warn(`Free PDF SDK: the wrapper is ${SDK_VERSION} but the viewer is ${version.sdk}; serve matching files`);\r\n }\r\n this.hello?.resolve(version);\r\n this.hello = null;\r\n return;\r\n }\r\n case \"res\": {\r\n if (typeof msg.id !== \"number\") return;\r\n const p = this.pending.get(msg.id);\r\n if (!p) return;\r\n this.pending.delete(msg.id);\r\n clearTimeout(p.timer);\r\n if (msg.ok === true) p.resolve(msg.result);\r\n else {\r\n const e = asErrorInfo(msg.error);\r\n p.reject(new FreePdfError(e.code, e.message));\r\n }\r\n return;\r\n }\r\n case \"evt\": {\r\n if (typeof msg.name !== \"string\") return;\r\n if (msg.name === \"error\" && this.hello) {\r\n const e = asErrorInfo(msg.data);\r\n this.hello.reject(new FreePdfError(e.code, e.message));\r\n this.hello = null;\r\n return;\r\n }\r\n if (msg.name === \"documentError\" || msg.name === \"error\") {\r\n this.emit(msg.name, asErrorInfo(msg.data));\r\n } else if (this.listeners.has(msg.name as EventName)) {\r\n this.emit(msg.name as EventName, msg.data as never);\r\n }\r\n return;\r\n }\r\n default:\r\n return;\r\n }\r\n }\r\n\r\n emit<K extends EventName>(name: K, data: EventMap[K]): void {\r\n if (name === \"ready\") this.readyInfo = data as VersionInfo;\r\n for (const listener of [...(this.listeners.get(name) ?? [])]) {\r\n try {\r\n (listener as Listener<K>)(data);\r\n } catch (e) {\r\n console.error(`Free PDF SDK: a ${name} listener threw`, e);\r\n }\r\n }\r\n }\r\n\r\n request<T>(method: string, params?: Record<string, unknown>, transfer: Transferable[] = [], timeoutMs = this.timeoutMs): Promise<T> {\r\n if (this.destroyed) return Promise.reject(new FreePdfError(\"DESTROYED\", \"the viewer was destroyed\"));\r\n const contentWindow = this.iframe.contentWindow;\r\n if (!contentWindow) return Promise.reject(new FreePdfError(\"NOT_READY\", \"the viewer is not attached to the page\"));\r\n const id = this.nextId;\r\n this.nextId = this.nextId >= 0x7fffffff ? 1 : this.nextId + 1;\r\n return new Promise<T>((resolve, reject) => {\r\n const timer = setTimeout(() => {\r\n this.pending.delete(id);\r\n reject(new FreePdfError(\"TIMEOUT\", `${method} got no reply in ${timeoutMs} ms`));\r\n }, timeoutMs);\r\n this.pending.set(id, { resolve: resolve as (v: unknown) => void, reject, timer });\r\n // The viewer drops the request once the deadline has passed, so a request that timed out\r\n // here never takes effect later (frames stall in background tabs).\r\n const deadline = Date.now() + timeoutMs;\r\n try {\r\n contentWindow.postMessage({ fps: PROTOCOL_VERSION, ch: this.channel, kind: \"req\", id, method, params: params ?? {}, deadline }, this.origin, transfer);\r\n } catch (e) {\r\n clearTimeout(timer);\r\n this.pending.delete(id);\r\n reject(new FreePdfError(\"BAD_REQUEST\", `${method} could not be sent: ${e instanceof Error ? e.message : String(e)}`));\r\n }\r\n });\r\n }\r\n\r\n async load(source: DocumentSource, options?: { password?: string }): Promise<LoadResult> {\r\n if (this.destroyed) throw new FreePdfError(\"DESTROYED\", \"the viewer was destroyed\");\r\n this.busyStart();\r\n try {\r\n let doc: { name: string; bytes: ArrayBuffer };\r\n try {\r\n doc = await readDocument(source, this.timeoutMs * 2);\r\n } catch (e) {\r\n // The viewer reports its own load failures; a fetch that failed never reached it.\r\n const err = e instanceof FreePdfError ? e : new FreePdfError(\"FETCH_FAILED\", String(e));\r\n this.emit(\"documentError\", { code: err.code, message: err.message });\r\n throw err;\r\n }\r\n const { name, bytes } = doc;\r\n const params: Record<string, unknown> = { name, data: bytes };\r\n if (options?.password !== undefined) params.password = options.password;\r\n return await this.request<LoadResult>(\"load\", params, [bytes], this.timeoutMs * 2);\r\n } finally {\r\n this.idle();\r\n }\r\n }\r\n\r\n async unlock(password: string): Promise<Permissions> {\r\n const r = await this.request<{ permissions: Permissions }>(\"unlock\", { password });\r\n return r.permissions;\r\n }\r\n\r\n getPermissions(): Promise<Permissions> {\r\n return this.request<Permissions>(\"getPermissions\");\r\n }\r\n\r\n async importXfdf(xfdf: string | Blob, options?: { replace?: boolean }): Promise<number> {\r\n const text = typeof xfdf === \"string\" ? xfdf : await xfdf.text();\r\n return this.request<number>(\"importXfdf\", { xfdf: text, replace: options?.replace ?? false });\r\n }\r\n\r\n exportXfdf(): Promise<string> {\r\n return this.request<string>(\"exportXfdf\");\r\n }\r\n\r\n getAnnotations(): Promise<Annotation[]> {\r\n return this.request<Annotation[]>(\"getAnnotations\");\r\n }\r\n\r\n deleteAllAnnotations(): Promise<number> {\r\n return this.request<number>(\"deleteAllAnnotations\");\r\n }\r\n\r\n async setAuthor(author: string): Promise<void> {\r\n await this.request(\"setAuthor\", { author });\r\n }\r\n\r\n async setTheme(theme: Theme): Promise<void> {\r\n await this.request(\"setTheme\", { theme });\r\n }\r\n\r\n async setMode(mode: Mode): Promise<void> {\r\n await this.request(\"setMode\", { mode });\r\n }\r\n\r\n async setFeatures(features: FeatureFlags): Promise<void> {\r\n await this.request(\"setFeatures\", { features: { ...features } });\r\n }\r\n\r\n async setUi(ui: UiOptions): Promise<void> {\r\n await this.request(\"setUi\", { ui: plainUi(ui) });\r\n }\r\n\r\n getConfig(): Promise<ViewerConfig> {\r\n return this.request<ViewerConfig>(\"getConfig\");\r\n }\r\n\r\n async setDisabledElements(ids: ElementId[]): Promise<void> {\r\n await this.request(\"setDisabledElements\", { ids: [...ids] });\r\n }\r\n\r\n async setLocale(locale: string): Promise<string> {\r\n const r = await this.request<{ locale: string }>(\"setLocale\", { locale });\r\n return r.locale;\r\n }\r\n\r\n getPageCount(): Promise<number> {\r\n return this.request<number>(\"getPageCount\");\r\n }\r\n\r\n async goToPage(page: number): Promise<void> {\r\n await this.request(\"goToPage\", { page });\r\n }\r\n\r\n async setZoom(zoom: Zoom): Promise<void> {\r\n await this.request(\"setZoom\", { zoom });\r\n }\r\n\r\n isDirty(): Promise<boolean> {\r\n return this.request<boolean>(\"isDirty\");\r\n }\r\n\r\n async save(): Promise<Uint8Array> {\r\n return this.request<Uint8Array>(\"save\", undefined, [], this.timeoutMs * 2);\r\n }\r\n\r\n version(): Promise<VersionInfo> {\r\n return this.request<VersionInfo>(\"version\");\r\n }\r\n\r\n async destroy(): Promise<void> {\r\n if (this.destroyed) return;\r\n this.destroyed = true;\r\n window.removeEventListener(\"message\", this.onMessage);\r\n const error = new FreePdfError(\"DESTROYED\", \"the viewer was destroyed\");\r\n for (const p of this.pending.values()) {\r\n clearTimeout(p.timer);\r\n p.reject(error);\r\n }\r\n this.pending.clear();\r\n this.hello?.reject(error);\r\n this.hello = null;\r\n this.listeners.clear();\r\n this.root.remove();\r\n }\r\n\r\n on<K extends EventName>(name: K, listener: Listener<K>): void {\r\n let set = this.listeners.get(name);\r\n if (!set) {\r\n set = new Set();\r\n this.listeners.set(name, set);\r\n }\r\n set.add(listener as AnyListener);\r\n if (name === \"ready\" && this.readyInfo) {\r\n const info = this.readyInfo;\r\n queueMicrotask(() => {\r\n if (this.listeners.get(name)?.has(listener as AnyListener)) (listener as Listener<\"ready\">)(info);\r\n });\r\n }\r\n }\r\n\r\n off<K extends EventName>(name: K, listener: Listener<K>): void {\r\n this.listeners.get(name)?.delete(listener as AnyListener);\r\n }\r\n}\r\n\r\n/**\r\n * Mounts a viewer in `element` (which it fills) and resolves once it is ready and, if\r\n * `options.document` is given, once that document is open. Rejects with {@link FreePdfError}\r\n * (and removes the iframe) when the viewer cannot start or the document cannot be opened.\r\n *\r\n * @param element - The element to mount the viewer in; give it a size.\r\n * @param options - Where the SDK is hosted, and how the viewer starts.\r\n */\r\nexport async function init(element: HTMLElement, options: InitOptions): Promise<FreePdfViewer> {\r\n if (!(element instanceof HTMLElement)) throw new FreePdfError(\"BAD_REQUEST\", \"init needs an element to mount the viewer in\");\r\n if (!options || typeof options.baseUrl !== \"string\") throw new FreePdfError(\"BAD_REQUEST\", \"init needs options.baseUrl\");\r\n const base = new URL(options.baseUrl.endsWith(\"/\") ? options.baseUrl : `${options.baseUrl}/`, document.baseURI);\r\n if (base.origin !== location.origin) {\r\n throw new FreePdfError(\"BAD_REQUEST\", `the SDK must be served from this page's origin (${location.origin}), not ${base.origin}`);\r\n }\r\n const theme = options.theme ?? \"system\";\r\n const viewer = new Viewer(element, base, options.timeoutMs ?? DEFAULT_TIMEOUT_MS, loaderOptions(options.loader), theme);\r\n for (const [name, listener] of Object.entries(options.listeners ?? {})) {\r\n if (typeof listener === \"function\") viewer.on(name as EventName, listener as Listener<EventName>);\r\n }\r\n try {\r\n const info = await viewer.started();\r\n // Plain copies: a reactive proxy (Vue) can't be posted to the iframe.\r\n const config: Record<string, unknown> = {\r\n mode: options.mode ?? \"view\",\r\n theme,\r\n disabledElements: [...(options.disabledElements ?? [])],\r\n };\r\n if (options.features !== undefined) config.features = { ...options.features };\r\n if (options.ui !== undefined) config.ui = plainUi(options.ui);\r\n if (options.author !== undefined) config.author = options.author;\r\n if (options.locale !== undefined) config.locale = options.locale;\r\n await viewer.request(\"configure\", config);\r\n viewer.emit(\"ready\", info);\r\n if (options.document) {\r\n await viewer.load(options.document, options.password === undefined ? undefined : { password: options.password });\r\n }\r\n viewer.idle();\r\n return viewer;\r\n } catch (e) {\r\n await viewer.destroy();\r\n throw e instanceof FreePdfError ? e : new FreePdfError(\"INTERNAL\", String(e));\r\n }\r\n}\r\n\r\n/** The SDK entry point. */\r\nexport const FreePdf = {\r\n /** See {@link init}. */\r\n init,\r\n /** The wrapper's version. */\r\n version: SDK_VERSION,\r\n} as const;\r\n\r\nexport default FreePdf;\r\n"]}
1
+ {"version":3,"file":"free-pdf-sdk.js","sourceRoot":"","sources":["../src/free-pdf-sdk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,+CAA+C;AAC/C,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC;AAEnC,4DAA4D;AAC5D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC,0CAA0C;AAC1C,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAWzG,6CAA6C;AAC7C,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,aAAa;IACb,UAAU;IACV,UAAU;IACV,YAAY;IACZ,mBAAmB;IACnB,gBAAgB;IAChB,OAAO;IACP,WAAW;IACX,aAAa;IACb,SAAS;IACT,WAAW;IACX,eAAe;IACf,WAAW;IACX,YAAY;IACZ,UAAU;IACV,SAAS;IACT,MAAM;IACN,UAAU;IACV,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,MAAM;IACN,cAAc;IACd,MAAM;IACN,SAAS;IACT,aAAa;CACL,CAAC;AAgRX,4DAA4D;AAC5D,MAAM,OAAO,YAAa,SAAQ,KAAK;IAIrC;;;OAGG;IACH,YAAY,IAAe,EAAE,OAAe;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,IAAI,GAA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GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC9D,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS;YAAE,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QACjE,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS;YAAE,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QACjE,MAAM,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC3B,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACrB,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QACnH,CAAC;QACD,MAAM,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QACvB,MAAM,CAAC,YAAY,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAChF,CAAC;AACH,CAAC;AAED,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,wBAAwB;IACxB,IAAI;IACJ,6BAA6B;IAC7B,OAAO,EAAE,WAAW;CACZ,CAAC;AAEX,eAAe,OAAO,CAAC","sourcesContent":["/**\n * Free PDF SDK: an embeddable PDF viewer and annotator for the web, based on pdfcraft.\n *\n * ```ts\n * import { FreePdf } from \"@mecorelabs/free-pdf-sdk\";\n * const viewer = await FreePdf.init(document.getElementById(\"viewer\")!, {\n * baseUrl: \"/free-pdf-sdk/\",\n * mode: \"annotate\",\n * theme: \"system\",\n * document: { url: \"/files/artwork.pdf\" },\n * });\n * viewer.on(\"annotationsChanged\", ({ count }) => console.log(count));\n * ```\n *\n * Each viewer is an iframe on the host's own origin (the SDK folder must be served from the same\n * origin as the page). The wrapper talks to it over a versioned postMessage protocol; see\n * docs/api.md and docs/architecture.md.\n *\n * @packageDocumentation\n */\n\n/** The SDK version this wrapper belongs to. */\nexport const SDK_VERSION = \"0.2.1\";\n\n/** The postMessage protocol version this wrapper speaks. */\nexport const PROTOCOL_VERSION = 1;\n\n/** Every mode, in documentation order. */\nexport const MODES = [\"view\", \"review\", \"annotate\", \"fill\", \"sign\", \"organize\", \"edit\", \"full\"] as const;\n\n/**\n * Viewer mode: a preset of {@link Feature | features}. `view` is read-only; `review` adds notes\n * and text markup; `annotate` every kind of annotation and Fill & Sign; `fill` form filling and\n * Fill & Sign; `sign` adds digital signatures; `organize` pages and bookmarks; `edit` full\n * authoring without security, redaction, digital signatures or JavaScript; `full` everything\n * except JavaScript. Fine-tune any mode with {@link InitOptions.features}.\n */\nexport type Mode = (typeof MODES)[number];\n\n/** Every feature, in documentation order. */\nexport const FEATURES = [\n \"comments\",\n \"markup\",\n \"shapes\",\n \"ink\",\n \"stamps\",\n \"measurement\",\n \"fillSign\",\n \"formFill\",\n \"formDesign\",\n \"digitalSignatures\",\n \"signaturePanel\",\n \"pages\",\n \"bookmarks\",\n \"editContent\",\n \"flatten\",\n \"redaction\",\n \"accessibility\",\n \"standards\",\n \"javascript\",\n \"security\",\n \"history\",\n \"save\",\n \"download\",\n \"export\",\n \"print\",\n \"search\",\n \"copy\",\n \"documentInfo\",\n \"help\",\n \"palette\",\n \"preferences\",\n] as const;\n\n/**\n * Something the viewer can offer. A feature that is off is hidden everywhere in the viewer\n * (menus, toolbars, panels, context menus, shortcuts) and refused if reached anyway. The docs'\n * configuration page describes each one.\n */\nexport type Feature = (typeof FEATURES)[number];\n\n/** Feature switches, applied on top of the mode's features. */\nexport type FeatureFlags = Partial<Record<Feature, boolean>>;\n\n/** Right-hand panels {@link UiOptions.panels} accepts. */\nexport type PanelName = \"comments\" | \"bookmarks\" | \"pages\" | \"fields\" | \"layers\" | \"attachments\" | \"signatures\" | \"accessibility\" | \"tags\" | \"search\";\n\n/** Parts of the viewer's interface to show or hide (unset options keep their current value). */\nexport interface UiOptions {\n /** The Tools panel on the left, listing the tool groups of the enabled features (default true). */\n toolsPanel?: boolean;\n /** A slim rail that brings the Tools panel back once it is closed (default true). */\n toolsRail?: boolean;\n /** The floating tool bar beside the page (default true). */\n quickToolbar?: boolean;\n /** The right-hand rail: panel buttons, page navigation and zoom (default true). */\n rightRail?: boolean;\n /** Zoom and page display controls on the rail (default true). */\n zoomControls?: boolean;\n /** Page navigation on the rail (default true). */\n pageNavigation?: boolean;\n /** The main menu button (default true). */\n menu?: boolean;\n /** The \"Find tools and commands\" box (default true; needs the `palette` feature). */\n searchBox?: boolean;\n /** Show (true) or hide (false) right-hand panels; unlisted panels show when their feature is on. */\n panels?: Partial<Record<PanelName, boolean>>;\n /** Panels can't be moved, floated or closed from their tabs (default false). */\n lockLayout?: boolean;\n /** Also list tools that are planned but not available yet (default false). */\n showPlannedTools?: boolean;\n /** Links to web pages in documents may open, after a prompt (default true). */\n externalLinks?: boolean;\n}\n\n/** The viewer's configuration, as {@link FreePdfViewer.getConfig} reports it. */\nexport interface ViewerConfig {\n /** The mode. */\n mode: Mode;\n /** Every feature, on or off (the mode's preset with your overrides applied). */\n features: Record<Feature, boolean>;\n /** Interface options. */\n ui: Required<Omit<UiOptions, \"panels\">> & { panels: Partial<Record<PanelName, boolean>> };\n /** Hidden elements. */\n disabledElements: ElementId[];\n /** No feature that changes the document is on. */\n readOnly: boolean;\n}\n\n/** Colour theme; `system` follows the browser's preference. */\nexport type Theme = \"light\" | \"dark\" | \"system\";\n\n/** Zoom: a percentage (10–6400) or a fit. */\nexport type Zoom = number | \"fit-width\" | \"fit-page\";\n\n/**\n * Ids accepted by `disabledElements` and {@link FreePdfViewer.setDisabledElements}.\n * docs/api.md lists what each one hides.\n */\nexport type ElementId =\n | \"download\"\n | \"save\"\n | \"print\"\n | \"open\"\n | \"flatten\"\n | \"settings\"\n | \"import\"\n | \"tool:note\"\n | \"tool:freetext\"\n | \"tool:callout\"\n | \"tool:highlight\"\n | \"tool:underline\"\n | \"tool:strikeout\"\n | \"tool:squiggly\"\n | \"tool:caret\"\n | \"tool:replace\"\n | \"tool:ink\"\n | \"tool:line\"\n | \"tool:arrow\"\n | \"tool:square\"\n | \"tool:circle\"\n | \"tool:polygon\"\n | \"tool:polyline\"\n | \"tool:cloud\"\n | \"tool:attach\"\n | \"tool:stamp\"\n | \"tool:image\"\n | \"tool:link\"\n | \"tool:measure\"\n | \"tool:fillsign\"\n | \"tool:signature\";\n\n/** A PDF to open: fetched from a URL, or given as bytes. */\nexport type DocumentSource =\n | {\n /** URL of the PDF (same-origin, or CORS-enabled such as a Firebase Storage download URL). */\n url: string;\n /** File name shown in the viewer; defaults to the URL's last path segment. */\n name?: string;\n /** Options for `fetch` (headers, credentials). */\n fetchInit?: RequestInit;\n }\n | {\n /** The PDF's bytes. They are copied, never detached from the caller. */\n data: ArrayBuffer | Uint8Array | Blob;\n /** File name shown in the viewer; defaults to the Blob's name or `document.pdf`. */\n name?: string;\n };\n\n/**\n * The loading animation shown over the viewer while it starts and while a document opens.\n * Give one of `src` or `svg`; with neither, the built-in spinner is shown.\n */\nexport interface LoaderOptions {\n /** URL of an image: an SVG, GIF, animated WebP or PNG, or a `data:` URL. */\n src?: string;\n /** Inline SVG markup. It is shown as an image, so scripts in it never run. */\n svg?: string;\n /** Width of the image as a CSS length (default `48px`); the height follows its aspect ratio. */\n size?: string;\n /** Background behind it as a CSS colour (default: the viewer's background for the theme). */\n background?: string;\n /** What screen readers announce (default `Loading`). */\n label?: string;\n}\n\n/** A loader: a URL of an image (shorthand for `{ src }`), or {@link LoaderOptions}. */\nexport type Loader = string | LoaderOptions;\n\n/** Options for {@link FreePdf.init}. */\nexport interface InitOptions {\n /** URL of the SDK folder (the one holding `viewer/` and `version.json`), on the page's origin. */\n baseUrl: string;\n /** A document to open once the viewer is ready. */\n document?: DocumentSource;\n /** A preset of features (default `view`, read-only). */\n mode?: Mode;\n /** Turn individual features on or off, on top of the mode's preset. */\n features?: FeatureFlags;\n /** Show or hide parts of the interface. */\n ui?: UiOptions;\n /** Author of new comments; it wins over a name saved in the viewer's settings. */\n author?: string;\n /** Colour theme (default `system`). */\n theme?: Theme;\n /** Password: opens a document that needs one, and lifts owner restrictions (as {@link FreePdfViewer.unlock}). */\n password?: string;\n /** Parts of the interface to hide. */\n disabledElements?: ElementId[];\n /** Interface language, such as `en`, `de` or `zh-Hans` (closest available; English otherwise). */\n locale?: string;\n /**\n * Loading animation shown while the viewer starts and while a document opens (default: a\n * built-in spinner; `false`: none). Read once, when the viewer mounts.\n */\n loader?: Loader | false;\n /** Milliseconds to wait for a reply before rejecting with `TIMEOUT` (default 60000; loads get twice that). */\n timeoutMs?: number;\n /**\n * Listeners attached before the viewer starts, so they also hear events fired while `init`\n * is still running (`ready`, the first `documentLoaded`). `ready` also reaches listeners\n * added later with `on`.\n */\n listeners?: { [K in EventName]?: Listener<K> };\n}\n\n/** What the open document's security allows. */\nexport interface Permissions {\n /** Comments may be added, changed, deleted and imported. */\n canAnnotate: boolean;\n /** The document may be printed. */\n canPrint: boolean;\n /** Text and images may be copied. */\n canCopy: boolean;\n /** The document is encrypted. */\n isEncrypted: boolean;\n /** An owner password would lift restrictions ({@link FreePdfViewer.unlock}). */\n canUnlock: boolean;\n}\n\n/** A reply in a comment thread. */\nexport interface AnnotationReply {\n /** The reply's id (XFDF `name`). */\n id: string;\n /** Author (XFDF `title`). */\n author: string | null;\n /** Text. */\n contents: string | null;\n /** Last modified, ISO 8601. */\n date: string | null;\n}\n\n/** A comment, as {@link FreePdfViewer.getAnnotations} lists it. */\nexport interface Annotation {\n /** The annotation's id (XFDF `name`). */\n id: string;\n /** The PDF subtype in lowercase: `text` (note), `freetext`, `square`, `circle`, `line`, `ink`, `polygon`, `polyline`, `highlight`, `underline`, `squiggly`, `strikeout`, `stamp`, `caret`, `fileattachment`, `sound`, `redact`. */\n type: string;\n /** Author (XFDF `title`). */\n author: string | null;\n /** Subject. */\n subject: string | null;\n /** Text. */\n contents: string | null;\n /** Last modified (else created), ISO 8601. */\n date: string | null;\n /** 0-based page index. */\n pageIndex: number;\n /** Colour, `#RRGGBB`. */\n color: string | null;\n /** Replies, oldest first. */\n replies: AnnotationReply[];\n}\n\n/** A newly opened document. */\nexport interface DocumentInfo {\n /** Number of pages. */\n pageCount: number;\n /** What its security allows. */\n permissions: Permissions;\n}\n\n/** The result of {@link FreePdfViewer.load}. */\nexport interface LoadResult extends DocumentInfo {\n /** The `password` lifted owner restrictions. */\n unlocked: boolean;\n}\n\n/** Versions of the SDK and of pdfcraft. */\nexport interface VersionInfo {\n /** The SDK version (semver). */\n sdk: string;\n /** The pdfcraft commit the viewer was built from. */\n pdfcraftRev: string;\n}\n\n/** Error codes. `TIMEOUT`, `DESTROYED` and `FETCH_FAILED` come from the wrapper; the rest from the viewer. */\nexport type ErrorCode =\n | \"BAD_REQUEST\"\n | \"UNKNOWN_METHOD\"\n | \"UNSUPPORTED_PROTOCOL\"\n | \"NOT_READY\"\n | \"NO_DOCUMENT\"\n | \"LOAD_FAILED\"\n | \"NEEDS_PASSWORD\"\n | \"WRONG_PASSWORD\"\n | \"NOT_PERMITTED\"\n | \"READ_ONLY\"\n | \"XFDF_INVALID\"\n | \"TOO_LARGE\"\n | \"BUSY\"\n | \"INTERNAL\"\n | \"TIMEOUT\"\n | \"DESTROYED\"\n | \"FETCH_FAILED\";\n\n/** An error as data: what events carry. */\nexport interface ErrorInfo {\n /** Machine-readable code. */\n code: ErrorCode;\n /** Human-readable message (English). */\n message: string;\n}\n\n/** Every failure of the SDK: a typed code and a message. */\nexport class FreePdfError extends Error implements ErrorInfo {\n /** Machine-readable code. */\n readonly code: ErrorCode;\n\n /**\n * @param code - Machine-readable code.\n * @param message - Human-readable message.\n */\n constructor(code: ErrorCode, message: string) {\n super(message);\n this.name = \"FreePdfError\";\n this.code = code;\n }\n}\n\n/** Events and the data each one carries. */\nexport interface EventMap {\n /** The viewer is configured and ready for requests. */\n ready: VersionInfo;\n /** A document opened. */\n documentLoaded: DocumentInfo;\n /** A document could not be opened. */\n documentError: ErrorInfo;\n /** Comments were added, changed or removed (by the user or the API). */\n annotationsChanged: { count: number };\n /** The document gained or lost unsaved changes. */\n dirtyChanged: { dirty: boolean };\n /** Something failed outside a request (for example a wrong `password` at load). */\n error: ErrorInfo;\n /** The user pressed Save in the viewer: here is the saved PDF. The viewer treats it as saved. */\n saveRequested: { name: string; saveAs: boolean; data: Uint8Array };\n}\n\n/** An event name. */\nexport type EventName = keyof EventMap;\n\n/** A listener for event `K`. */\nexport type Listener<K extends EventName> = (data: EventMap[K]) => void;\n\n/** A mounted viewer. Every method is async and rejects with {@link FreePdfError}. */\nexport interface FreePdfViewer {\n /** Opens a document, replacing the one shown. */\n load(document: DocumentSource, options?: { password?: string }): Promise<LoadResult>;\n /** Lifts owner restrictions with the owner password; resolves to the new permissions. */\n unlock(password: string): Promise<Permissions>;\n /** What the open document's security allows. */\n getPermissions(): Promise<Permissions>;\n /** Imports comments from standard XFDF; `replace` deletes the existing ones first. Resolves to the number imported. */\n importXfdf(xfdf: string | Blob, options?: { replace?: boolean }): Promise<number>;\n /** The document's comments as XFDF (author in `title`). */\n exportXfdf(): Promise<string>;\n /** The document's comments with their replies; the length is the exact count. */\n getAnnotations(): Promise<Annotation[]>;\n /** Deletes every comment (one undo step per comment); resolves to how many there were. */\n deleteAllAnnotations(): Promise<number>;\n /** Sets the author of new comments. */\n setAuthor(author: string): Promise<void>;\n /** Sets the colour theme. */\n setTheme(theme: Theme): Promise<void>;\n /** Switches mode; your feature overrides still apply on top of it. */\n setMode(mode: Mode): Promise<void>;\n /** Replaces the feature overrides (relative to the mode). Pass `{}` to use the mode's features as they are. */\n setFeatures(features: FeatureFlags): Promise<void>;\n /** Changes interface options; options you leave out keep their value. */\n setUi(ui: UiOptions): Promise<void>;\n /** The resolved configuration: mode, every feature on or off, interface options. */\n getConfig(): Promise<ViewerConfig>;\n /** Hides parts of the interface (replaces the previous list). */\n setDisabledElements(ids: ElementId[]): Promise<void>;\n /** Sets the interface language; resolves to the language used. */\n setLocale(locale: string): Promise<string>;\n /** Number of pages. */\n getPageCount(): Promise<number>;\n /** Shows page `page` (1-based). */\n goToPage(page: number): Promise<void>;\n /** Sets the zoom: a percentage, `fit-width` or `fit-page`. */\n setZoom(zoom: Zoom): Promise<void>;\n /** Whether there are unsaved changes. */\n isDirty(): Promise<boolean>;\n /** The PDF with every change (comments included); the viewer then treats it as saved. */\n save(): Promise<Uint8Array>;\n /** Versions of the SDK and pdfcraft. */\n version(): Promise<VersionInfo>;\n /** Removes the viewer; pending requests reject with `DESTROYED`. Safe to call twice. */\n destroy(): Promise<void>;\n /** Adds a listener. */\n on<K extends EventName>(name: K, listener: Listener<K>): void;\n /** Removes a listener. */\n off<K extends EventName>(name: K, listener: Listener<K>): void;\n /** The iframe holding the viewer. */\n readonly iframe: HTMLIFrameElement;\n}\n\nconst HELLO_TIMEOUT_MS = 30_000;\nconst DEFAULT_TIMEOUT_MS = 60_000;\n\ninterface Pending {\n resolve: (value: unknown) => void;\n reject: (error: FreePdfError) => void;\n timer: ReturnType<typeof setTimeout>;\n}\n\ntype AnyListener = (data: never) => void;\n\nfunction isRecord(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null;\n}\n\nfunction asErrorInfo(v: unknown): ErrorInfo {\n if (isRecord(v) && typeof v.code === \"string\" && typeof v.message === \"string\") {\n return { code: v.code as ErrorCode, message: v.message };\n }\n return { code: \"INTERNAL\", message: \"malformed error from the viewer\" };\n}\n\n/** A plain copy of interface options (a reactive proxy can't be posted to the iframe). */\nfunction plainUi(ui: UiOptions): Record<string, unknown> {\n const out: Record<string, unknown> = { ...ui };\n if (ui.panels) out.panels = { ...ui.panels };\n return out;\n}\n\nfunction channelId(): string {\n const bytes = new Uint8Array(16);\n crypto.getRandomValues(bytes);\n return Array.from(bytes, (b) => b.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\nfunction nameFromUrl(url: string): string {\n try {\n const last = new URL(url, location.href).pathname.split(\"/\").filter(Boolean).pop();\n return last ? decodeURIComponent(last) : \"document.pdf\";\n } catch {\n return \"document.pdf\";\n }\n}\n\n/** Copies the document's bytes into a fresh ArrayBuffer (safe to transfer). A URL is fetched within `timeoutMs`. */\nasync function readDocument(source: DocumentSource, timeoutMs: number): Promise<{ name: string; bytes: ArrayBuffer }> {\n if (\"url\" in source) {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), timeoutMs);\n const callerSignal = source.fetchInit?.signal;\n const onAbort = (): void => controller.abort();\n callerSignal?.addEventListener(\"abort\", onAbort, { once: true });\n if (callerSignal?.aborted) controller.abort();\n try {\n const response = await fetch(source.url, { ...source.fetchInit, signal: controller.signal });\n if (!response.ok) throw new FreePdfError(\"FETCH_FAILED\", `could not fetch the document: HTTP ${response.status}`);\n return { name: source.name ?? nameFromUrl(source.url), bytes: await response.arrayBuffer() };\n } catch (e) {\n if (e instanceof FreePdfError) throw e;\n const why = controller.signal.aborted && !callerSignal?.aborted ? `no response in ${timeoutMs} ms` : String(e);\n throw new FreePdfError(\"FETCH_FAILED\", `could not fetch the document: ${why}`);\n } finally {\n clearTimeout(timer);\n callerSignal?.removeEventListener(\"abort\", onAbort);\n }\n }\n const data = source.data;\n if (data instanceof Blob) {\n const fileName = typeof File !== \"undefined\" && data instanceof File ? data.name : undefined;\n return { name: source.name ?? fileName ?? \"document.pdf\", bytes: await data.arrayBuffer() };\n }\n if (data instanceof ArrayBuffer) return { name: source.name ?? \"document.pdf\", bytes: data.slice(0) };\n if (data instanceof Uint8Array) {\n const copy = new Uint8Array(data.byteLength);\n copy.set(data);\n return { name: source.name ?? \"document.pdf\", bytes: copy.buffer };\n }\n throw new FreePdfError(\"BAD_REQUEST\", \"document needs a url or data (ArrayBuffer, Uint8Array or Blob)\");\n}\n\n/** The built-in loader: a ring that turns (slower when the user asks for reduced motion). */\nconst DEFAULT_LOADER_SVG =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"48\" height=\"48\" viewBox=\"0 0 48 48\"><style>' +\n \"circle{fill:none;stroke-width:4;stroke-linecap:round}.t{stroke:rgba(128,128,136,.25)}\" +\n \".a{stroke:rgb(128,128,136);stroke-dasharray:30 200;transform-origin:24px 24px;animation:s .9s linear infinite}\" +\n \"@keyframes s{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.a{animation-duration:3s}}\" +\n '</style><circle class=\"t\" cx=\"24\" cy=\"24\" r=\"18\"/><circle class=\"a\" cx=\"24\" cy=\"24\" r=\"18\"/></svg>';\n\n/** Inline SVG markup is at most this long. */\nconst MAX_LOADER_SVG = 1024 * 1024;\n\n/** The loader as a plain, checked description (throws `BAD_REQUEST`), or `null` for none. */\nfunction loaderOptions(loader: Loader | false | undefined): LoaderOptions | null {\n if (loader === false) return null;\n if (loader === undefined) return { svg: DEFAULT_LOADER_SVG };\n if (typeof loader === \"string\") return { src: loader };\n if (!isRecord(loader)) throw new FreePdfError(\"BAD_REQUEST\", \"loader must be a URL, an object or false\");\n const out: LoaderOptions = {};\n for (const key of [\"src\", \"svg\", \"size\", \"background\", \"label\"] as const) {\n const v = loader[key];\n if (v === undefined) continue;\n if (typeof v !== \"string\") throw new FreePdfError(\"BAD_REQUEST\", `loader.${key} must be a string`);\n out[key] = v;\n }\n if (out.svg !== undefined && out.svg.length > MAX_LOADER_SVG) throw new FreePdfError(\"TOO_LARGE\", \"loader.svg is over 1 MiB\");\n if (out.src === undefined && out.svg === undefined) out.svg = DEFAULT_LOADER_SVG;\n return out;\n}\n\n/** The viewer's own background before it paints, so the loader matches it. */\nfunction themeBackground(theme: Theme): string {\n const dark = theme === \"dark\" || (theme === \"system\" && typeof matchMedia === \"function\" && matchMedia(\"(prefers-color-scheme: dark)\").matches);\n return dark ? \"#19191c\" : \"#f1f1f3\";\n}\n\n/** Builds the loader overlay (visible). */\nfunction loaderElement(options: LoaderOptions, theme: Theme): HTMLDivElement {\n const overlay = document.createElement(\"div\");\n overlay.setAttribute(\"role\", \"status\");\n overlay.dataset.fpsLoader = \"\";\n overlay.style.cssText = \"position:absolute;inset:0;display:flex;align-items:center;justify-content:center;transition:opacity .2s ease;\";\n overlay.style.background = options.background ?? themeBackground(theme);\n const img = document.createElement(\"img\");\n // An <img>: an SVG shown this way can't run scripts or load other resources.\n img.src = options.src ?? `data:image/svg+xml;charset=utf-8,${encodeURIComponent(options.svg ?? DEFAULT_LOADER_SVG)}`;\n img.alt = options.label ?? \"Loading\";\n img.decoding = \"async\";\n img.style.cssText = \"display:block;height:auto;max-width:80%;max-height:80%;\";\n img.style.width = options.size ?? \"48px\";\n overlay.appendChild(img);\n return overlay;\n}\n\nclass Viewer implements FreePdfViewer {\n readonly iframe: HTMLIFrameElement;\n /** Holds the iframe and the loader; what the viewer adds to the host's element. */\n private readonly root: HTMLDivElement;\n private readonly loader: HTMLDivElement | null;\n /** Work the loader is shown for (starting counts as one). */\n private busy = 1;\n private readonly origin: string;\n private readonly channel = channelId();\n private readonly pending = new Map<number, Pending>();\n private readonly listeners = new Map<EventName, Set<AnyListener>>();\n private readonly timeoutMs: number;\n private nextId = 1;\n private destroyed = false;\n private hello: { resolve: (info: VersionInfo) => void; reject: (e: FreePdfError) => void } | null = null;\n private readyInfo: VersionInfo | null = null;\n private readonly onMessage = (event: MessageEvent): void => this.receive(event);\n\n constructor(element: HTMLElement, baseUrl: URL, timeoutMs: number, loader: LoaderOptions | null, theme: Theme) {\n this.origin = baseUrl.origin;\n this.timeoutMs = timeoutMs;\n this.root = document.createElement(\"div\");\n this.root.style.cssText = \"position:relative;width:100%;height:100%;\";\n this.iframe = document.createElement(\"iframe\");\n this.iframe.src = new URL(`viewer/index.html#ch=${this.channel}`, baseUrl).href;\n this.iframe.title = \"PDF viewer\";\n this.iframe.setAttribute(\"allow\", \"clipboard-read; clipboard-write; fullscreen\");\n this.iframe.style.cssText = \"display:block;width:100%;height:100%;border:0;\";\n this.root.appendChild(this.iframe);\n this.loader = loader ? loaderElement(loader, theme) : null;\n if (this.loader) this.root.appendChild(this.loader);\n window.addEventListener(\"message\", this.onMessage);\n element.appendChild(this.root);\n }\n\n /** Shows the loader for a piece of work; pair with {@link idle}. */\n busyStart(): void {\n this.busy++;\n if (this.loader) {\n this.loader.hidden = false;\n this.loader.style.opacity = \"1\";\n this.loader.style.pointerEvents = \"\";\n }\n }\n\n /** Ends a piece of work; the loader fades out when none is left. */\n idle(): void {\n this.busy = Math.max(0, this.busy - 1);\n const loader = this.loader;\n if (!loader || this.busy > 0) return;\n // Clicks reach the viewer at once, not only when the fade is over.\n loader.style.opacity = \"0\";\n loader.style.pointerEvents = \"none\";\n setTimeout(() => {\n if (this.busy === 0) loader.hidden = true;\n }, 200);\n }\n\n /** Waits for the viewer's hello. */\n started(): Promise<VersionInfo> {\n return new Promise<VersionInfo>((resolve, reject) => {\n const timer = setTimeout(() => {\n this.hello = null;\n reject(new FreePdfError(\"TIMEOUT\", \"the viewer did not start (is baseUrl right, and WebGL available?)\"));\n }, HELLO_TIMEOUT_MS);\n this.hello = {\n resolve: (info) => {\n clearTimeout(timer);\n resolve(info);\n },\n reject: (e) => {\n clearTimeout(timer);\n reject(e);\n },\n };\n });\n }\n\n private receive(event: MessageEvent): void {\n if (event.origin !== this.origin || event.source !== this.iframe.contentWindow) return;\n const msg: unknown = event.data;\n if (!isRecord(msg) || msg.ch !== this.channel) return;\n if (msg.fps !== PROTOCOL_VERSION) {\n // Another protocol version: fail what is waiting for it now, not after a timeout.\n const err = new FreePdfError(\"UNSUPPORTED_PROTOCOL\", `the viewer speaks protocol ${String(msg.fps)}; this wrapper speaks ${PROTOCOL_VERSION}`);\n if (msg.kind === \"hello\" && this.hello) {\n this.hello.reject(err);\n this.hello = null;\n return;\n }\n const p = msg.kind === \"res\" && typeof msg.id === \"number\" ? this.pending.get(msg.id) : undefined;\n if (p && typeof msg.id === \"number\") {\n this.pending.delete(msg.id);\n clearTimeout(p.timer);\n p.reject(err);\n return;\n }\n this.emit(\"error\", { code: err.code, message: err.message });\n return;\n }\n switch (msg.kind) {\n case \"hello\": {\n const info = isRecord(msg.info) ? msg.info : {};\n const version: VersionInfo = { sdk: String(info.sdk ?? \"\"), pdfcraftRev: String(info.pdfcraftRev ?? \"\") };\n if (version.sdk !== SDK_VERSION) {\n console.warn(`Free PDF SDK: the wrapper is ${SDK_VERSION} but the viewer is ${version.sdk}; serve matching files`);\n }\n this.hello?.resolve(version);\n this.hello = null;\n return;\n }\n case \"res\": {\n if (typeof msg.id !== \"number\") return;\n const p = this.pending.get(msg.id);\n if (!p) return;\n this.pending.delete(msg.id);\n clearTimeout(p.timer);\n if (msg.ok === true) p.resolve(msg.result);\n else {\n const e = asErrorInfo(msg.error);\n p.reject(new FreePdfError(e.code, e.message));\n }\n return;\n }\n case \"evt\": {\n if (typeof msg.name !== \"string\") return;\n if (msg.name === \"error\" && this.hello) {\n const e = asErrorInfo(msg.data);\n this.hello.reject(new FreePdfError(e.code, e.message));\n this.hello = null;\n return;\n }\n if (msg.name === \"documentError\" || msg.name === \"error\") {\n this.emit(msg.name, asErrorInfo(msg.data));\n } else if (this.listeners.has(msg.name as EventName)) {\n this.emit(msg.name as EventName, msg.data as never);\n }\n return;\n }\n default:\n return;\n }\n }\n\n emit<K extends EventName>(name: K, data: EventMap[K]): void {\n if (name === \"ready\") this.readyInfo = data as VersionInfo;\n for (const listener of [...(this.listeners.get(name) ?? [])]) {\n try {\n (listener as Listener<K>)(data);\n } catch (e) {\n console.error(`Free PDF SDK: a ${name} listener threw`, e);\n }\n }\n }\n\n request<T>(method: string, params?: Record<string, unknown>, transfer: Transferable[] = [], timeoutMs = this.timeoutMs): Promise<T> {\n if (this.destroyed) return Promise.reject(new FreePdfError(\"DESTROYED\", \"the viewer was destroyed\"));\n const contentWindow = this.iframe.contentWindow;\n if (!contentWindow) return Promise.reject(new FreePdfError(\"NOT_READY\", \"the viewer is not attached to the page\"));\n const id = this.nextId;\n this.nextId = this.nextId >= 0x7fffffff ? 1 : this.nextId + 1;\n return new Promise<T>((resolve, reject) => {\n const timer = setTimeout(() => {\n this.pending.delete(id);\n reject(new FreePdfError(\"TIMEOUT\", `${method} got no reply in ${timeoutMs} ms`));\n }, timeoutMs);\n this.pending.set(id, { resolve: resolve as (v: unknown) => void, reject, timer });\n // The viewer drops the request once the deadline has passed, so a request that timed out\n // here never takes effect later (frames stall in background tabs).\n const deadline = Date.now() + timeoutMs;\n try {\n contentWindow.postMessage({ fps: PROTOCOL_VERSION, ch: this.channel, kind: \"req\", id, method, params: params ?? {}, deadline }, this.origin, transfer);\n } catch (e) {\n clearTimeout(timer);\n this.pending.delete(id);\n reject(new FreePdfError(\"BAD_REQUEST\", `${method} could not be sent: ${e instanceof Error ? e.message : String(e)}`));\n }\n });\n }\n\n async load(source: DocumentSource, options?: { password?: string }): Promise<LoadResult> {\n if (this.destroyed) throw new FreePdfError(\"DESTROYED\", \"the viewer was destroyed\");\n this.busyStart();\n try {\n let doc: { name: string; bytes: ArrayBuffer };\n try {\n doc = await readDocument(source, this.timeoutMs * 2);\n } catch (e) {\n // The viewer reports its own load failures; a fetch that failed never reached it.\n const err = e instanceof FreePdfError ? e : new FreePdfError(\"FETCH_FAILED\", String(e));\n this.emit(\"documentError\", { code: err.code, message: err.message });\n throw err;\n }\n const { name, bytes } = doc;\n const params: Record<string, unknown> = { name, data: bytes };\n if (options?.password !== undefined) params.password = options.password;\n return await this.request<LoadResult>(\"load\", params, [bytes], this.timeoutMs * 2);\n } finally {\n this.idle();\n }\n }\n\n async unlock(password: string): Promise<Permissions> {\n const r = await this.request<{ permissions: Permissions }>(\"unlock\", { password });\n return r.permissions;\n }\n\n getPermissions(): Promise<Permissions> {\n return this.request<Permissions>(\"getPermissions\");\n }\n\n async importXfdf(xfdf: string | Blob, options?: { replace?: boolean }): Promise<number> {\n const text = typeof xfdf === \"string\" ? xfdf : await xfdf.text();\n return this.request<number>(\"importXfdf\", { xfdf: text, replace: options?.replace ?? false });\n }\n\n exportXfdf(): Promise<string> {\n return this.request<string>(\"exportXfdf\");\n }\n\n getAnnotations(): Promise<Annotation[]> {\n return this.request<Annotation[]>(\"getAnnotations\");\n }\n\n deleteAllAnnotations(): Promise<number> {\n return this.request<number>(\"deleteAllAnnotations\");\n }\n\n async setAuthor(author: string): Promise<void> {\n await this.request(\"setAuthor\", { author });\n }\n\n async setTheme(theme: Theme): Promise<void> {\n await this.request(\"setTheme\", { theme });\n }\n\n async setMode(mode: Mode): Promise<void> {\n await this.request(\"setMode\", { mode });\n }\n\n async setFeatures(features: FeatureFlags): Promise<void> {\n await this.request(\"setFeatures\", { features: { ...features } });\n }\n\n async setUi(ui: UiOptions): Promise<void> {\n await this.request(\"setUi\", { ui: plainUi(ui) });\n }\n\n getConfig(): Promise<ViewerConfig> {\n return this.request<ViewerConfig>(\"getConfig\");\n }\n\n async setDisabledElements(ids: ElementId[]): Promise<void> {\n await this.request(\"setDisabledElements\", { ids: [...ids] });\n }\n\n async setLocale(locale: string): Promise<string> {\n const r = await this.request<{ locale: string }>(\"setLocale\", { locale });\n return r.locale;\n }\n\n getPageCount(): Promise<number> {\n return this.request<number>(\"getPageCount\");\n }\n\n async goToPage(page: number): Promise<void> {\n await this.request(\"goToPage\", { page });\n }\n\n async setZoom(zoom: Zoom): Promise<void> {\n await this.request(\"setZoom\", { zoom });\n }\n\n isDirty(): Promise<boolean> {\n return this.request<boolean>(\"isDirty\");\n }\n\n async save(): Promise<Uint8Array> {\n return this.request<Uint8Array>(\"save\", undefined, [], this.timeoutMs * 2);\n }\n\n version(): Promise<VersionInfo> {\n return this.request<VersionInfo>(\"version\");\n }\n\n async destroy(): Promise<void> {\n if (this.destroyed) return;\n this.destroyed = true;\n window.removeEventListener(\"message\", this.onMessage);\n const error = new FreePdfError(\"DESTROYED\", \"the viewer was destroyed\");\n for (const p of this.pending.values()) {\n clearTimeout(p.timer);\n p.reject(error);\n }\n this.pending.clear();\n this.hello?.reject(error);\n this.hello = null;\n this.listeners.clear();\n this.root.remove();\n }\n\n on<K extends EventName>(name: K, listener: Listener<K>): void {\n let set = this.listeners.get(name);\n if (!set) {\n set = new Set();\n this.listeners.set(name, set);\n }\n set.add(listener as AnyListener);\n if (name === \"ready\" && this.readyInfo) {\n const info = this.readyInfo;\n queueMicrotask(() => {\n if (this.listeners.get(name)?.has(listener as AnyListener)) (listener as Listener<\"ready\">)(info);\n });\n }\n }\n\n off<K extends EventName>(name: K, listener: Listener<K>): void {\n this.listeners.get(name)?.delete(listener as AnyListener);\n }\n}\n\n/**\n * Mounts a viewer in `element` (which it fills) and resolves once it is ready and, if\n * `options.document` is given, once that document is open. Rejects with {@link FreePdfError}\n * (and removes the iframe) when the viewer cannot start or the document cannot be opened.\n *\n * @param element - The element to mount the viewer in; give it a size.\n * @param options - Where the SDK is hosted, and how the viewer starts.\n */\nexport async function init(element: HTMLElement, options: InitOptions): Promise<FreePdfViewer> {\n if (!(element instanceof HTMLElement)) throw new FreePdfError(\"BAD_REQUEST\", \"init needs an element to mount the viewer in\");\n if (!options || typeof options.baseUrl !== \"string\") throw new FreePdfError(\"BAD_REQUEST\", \"init needs options.baseUrl\");\n const base = new URL(options.baseUrl.endsWith(\"/\") ? options.baseUrl : `${options.baseUrl}/`, document.baseURI);\n if (base.origin !== location.origin) {\n throw new FreePdfError(\"BAD_REQUEST\", `the SDK must be served from this page's origin (${location.origin}), not ${base.origin}`);\n }\n const theme = options.theme ?? \"system\";\n const viewer = new Viewer(element, base, options.timeoutMs ?? DEFAULT_TIMEOUT_MS, loaderOptions(options.loader), theme);\n for (const [name, listener] of Object.entries(options.listeners ?? {})) {\n if (typeof listener === \"function\") viewer.on(name as EventName, listener as Listener<EventName>);\n }\n try {\n const info = await viewer.started();\n // Plain copies: a reactive proxy (Vue) can't be posted to the iframe.\n const config: Record<string, unknown> = {\n mode: options.mode ?? \"view\",\n theme,\n disabledElements: [...(options.disabledElements ?? [])],\n };\n if (options.features !== undefined) config.features = { ...options.features };\n if (options.ui !== undefined) config.ui = plainUi(options.ui);\n if (options.author !== undefined) config.author = options.author;\n if (options.locale !== undefined) config.locale = options.locale;\n await viewer.request(\"configure\", config);\n viewer.emit(\"ready\", info);\n if (options.document) {\n await viewer.load(options.document, options.password === undefined ? undefined : { password: options.password });\n }\n viewer.idle();\n return viewer;\n } catch (e) {\n await viewer.destroy();\n throw e instanceof FreePdfError ? e : new FreePdfError(\"INTERNAL\", String(e));\n }\n}\n\n/** The SDK entry point. */\nexport const FreePdf = {\n /** See {@link init}. */\n init,\n /** The wrapper's version. */\n version: SDK_VERSION,\n} as const;\n\nexport default FreePdf;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mecorelabs/free-pdf-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Free PDF SDK: an embeddable, white-label PDF viewer, annotator and editor for the web, with React, Vue, Svelte, Angular and Web Component integrations",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "homepage": "https://freepdfsdk.mecorelabs.com",
@@ -1,9 +1,9 @@
1
1
  # Third-party notices
2
2
 
3
3
  Free PDF SDK is built on [pdfcraft](https://github.com/storytold/pdfcraft) by the ArtCraft Team
4
- and the PdfCraft contributors (MIT OR Apache-2.0), at upstream commit `6fb6b7cf6fd8dc105fdd56a764d207cff6140694`.
4
+ and the PdfCraft contributors (MIT OR Apache-2.0), at upstream commit `88dad98dd478d255399b1405b33765f4da542704`.
5
5
  Free PDF SDK modifies pdfcraft's interface crate (pdfcraft-ui-egui) with opt-in hooks for
6
- white-label branding and for hiding features; the modified build is `af36697f412c7e6d5933afaca0d439bbe4bf95c9`
6
+ white-label branding and for hiding features; the modified build is `9e66e3c4dacb5a2bcd7ac2a19cbfcd870ec13a65`
7
7
  (`pdfcraftRev` in `version.json`). The viewer's .wasm embeds the material below; each
8
8
  licence is in this folder. Generated by `scripts/collect-notices.mjs` — do not edit by hand.
9
9
 
@@ -205,36 +205,36 @@ Generated by `scripts/collect-notices.mjs` from Cargo.lock (wasm32 target).
205
205
  | parking_lot_core | 0.9.12 | MIT OR Apache-2.0 |
206
206
  | pastey | 0.2.3 | MIT OR Apache-2.0 |
207
207
  | pbkdf2 | 0.13.0 | MIT OR Apache-2.0 |
208
- | pdfcraft-a11y | 0.10.0 | MIT OR Apache-2.0 |
209
- | pdfcraft-annot | 0.10.0 | MIT OR Apache-2.0 |
210
- | pdfcraft-audit | 0.10.0 | MIT OR Apache-2.0 |
211
- | pdfcraft-compare | 0.10.0 | MIT OR Apache-2.0 |
212
- | pdfcraft-content | 0.10.0 | MIT OR Apache-2.0 |
213
- | pdfcraft-cos | 0.10.0 | MIT OR Apache-2.0 |
214
- | pdfcraft-create | 0.10.0 | MIT OR Apache-2.0 |
215
- | pdfcraft-crypt | 0.10.0 | MIT OR Apache-2.0 |
216
- | pdfcraft-edit | 0.10.0 | MIT OR Apache-2.0 |
217
- | pdfcraft-engine | 0.10.0 | MIT OR Apache-2.0 |
218
- | pdfcraft-export | 0.10.0 | MIT OR Apache-2.0 |
219
- | pdfcraft-filters | 0.10.0 | MIT OR Apache-2.0 |
220
- | pdfcraft-fonts | 0.10.0 | MIT OR Apache-2.0 |
221
- | pdfcraft-forms | 0.10.0 | MIT OR Apache-2.0 |
222
- | pdfcraft-geom | 0.10.0 | MIT OR Apache-2.0 |
223
- | pdfcraft-js | 0.10.0 | MIT OR Apache-2.0 |
224
- | pdfcraft-measure | 0.10.0 | MIT OR Apache-2.0 |
225
- | pdfcraft-model | 0.10.0 | MIT OR Apache-2.0 |
226
- | pdfcraft-ocr | 0.10.0 | MIT OR Apache-2.0 |
227
- | pdfcraft-optimize | 0.10.0 | MIT OR Apache-2.0 |
228
- | pdfcraft-organize | 0.10.0 | MIT OR Apache-2.0 |
229
- | pdfcraft-platform | 0.10.0 | MIT OR Apache-2.0 |
230
- | pdfcraft-preflight | 0.10.0 | MIT OR Apache-2.0 |
231
- | pdfcraft-print | 0.10.0 | MIT OR Apache-2.0 |
232
- | pdfcraft-redact | 0.10.0 | MIT OR Apache-2.0 |
233
- | pdfcraft-render | 0.10.0 | MIT OR Apache-2.0 |
234
- | pdfcraft-sign | 0.10.0 | MIT OR Apache-2.0 |
235
- | pdfcraft-ui-egui | 0.10.0 | MIT OR Apache-2.0 |
236
- | pdfcraft-xfa | 0.10.0 | MIT OR Apache-2.0 |
237
- | pdfcraft-xfdf | 0.10.0 | MIT OR Apache-2.0 |
208
+ | pdfcraft-a11y | 0.11.0 | MIT OR Apache-2.0 |
209
+ | pdfcraft-annot | 0.11.0 | MIT OR Apache-2.0 |
210
+ | pdfcraft-audit | 0.11.0 | MIT OR Apache-2.0 |
211
+ | pdfcraft-compare | 0.11.0 | MIT OR Apache-2.0 |
212
+ | pdfcraft-content | 0.11.0 | MIT OR Apache-2.0 |
213
+ | pdfcraft-cos | 0.11.0 | MIT OR Apache-2.0 |
214
+ | pdfcraft-create | 0.11.0 | MIT OR Apache-2.0 |
215
+ | pdfcraft-crypt | 0.11.0 | MIT OR Apache-2.0 |
216
+ | pdfcraft-edit | 0.11.0 | MIT OR Apache-2.0 |
217
+ | pdfcraft-engine | 0.11.0 | MIT OR Apache-2.0 |
218
+ | pdfcraft-export | 0.11.0 | MIT OR Apache-2.0 |
219
+ | pdfcraft-filters | 0.11.0 | MIT OR Apache-2.0 |
220
+ | pdfcraft-fonts | 0.11.0 | MIT OR Apache-2.0 |
221
+ | pdfcraft-forms | 0.11.0 | MIT OR Apache-2.0 |
222
+ | pdfcraft-geom | 0.11.0 | MIT OR Apache-2.0 |
223
+ | pdfcraft-js | 0.11.0 | MIT OR Apache-2.0 |
224
+ | pdfcraft-measure | 0.11.0 | MIT OR Apache-2.0 |
225
+ | pdfcraft-model | 0.11.0 | MIT OR Apache-2.0 |
226
+ | pdfcraft-ocr | 0.11.0 | MIT OR Apache-2.0 |
227
+ | pdfcraft-optimize | 0.11.0 | MIT OR Apache-2.0 |
228
+ | pdfcraft-organize | 0.11.0 | MIT OR Apache-2.0 |
229
+ | pdfcraft-platform | 0.11.0 | MIT OR Apache-2.0 |
230
+ | pdfcraft-preflight | 0.11.0 | MIT OR Apache-2.0 |
231
+ | pdfcraft-print | 0.11.0 | MIT OR Apache-2.0 |
232
+ | pdfcraft-redact | 0.11.0 | MIT OR Apache-2.0 |
233
+ | pdfcraft-render | 0.11.0 | MIT OR Apache-2.0 |
234
+ | pdfcraft-sign | 0.11.0 | MIT OR Apache-2.0 |
235
+ | pdfcraft-ui-egui | 0.11.0 | MIT OR Apache-2.0 |
236
+ | pdfcraft-xfa | 0.11.0 | MIT OR Apache-2.0 |
237
+ | pdfcraft-xfdf | 0.11.0 | MIT OR Apache-2.0 |
238
238
  | pem-rfc7468 | 1.0.0 | Apache-2.0 OR MIT |
239
239
  | peniko | 0.6.1 | Apache-2.0 OR MIT |
240
240
  | percent-encoding | 2.3.2 | MIT OR Apache-2.0 |
@@ -4,7 +4,7 @@
4
4
 
5
5
  Every asset PdfCraft includes, bundles or uses to build its published material, with its author, source and licence. The policy is in [AGENTS.md](AGENTS.md) §1. The machine-readable list, with SHA-256 hashes, is [ATTRIBUTION.toml](ATTRIBUTION.toml). Licence texts are kept beside the assets and summarised in [NOTICE](NOTICE).
6
6
 
7
- ## In this repository (272)
7
+ ## In this repository (277)
8
8
 
9
9
  | Asset | Title | Author | Licence | Source | Used for |
10
10
  |---|---|---|---|---|---|
@@ -280,6 +280,11 @@ Every asset PdfCraft includes, bundles or uses to build its published material,
280
280
  | `crates/ui-egui/src/i18n/vi.tsv` | Vietnamese interface translation catalog | PdfCraft contributors | MIT OR Apache-2.0 | Contributor-original: clean-room translations of PdfCraft's English UI labels; PhotoCraft and VectorCraft Vietnamese catalogs used only as translation memory when English source and semantic context matched; original catalog reviewed by a native Vietnamese-speaking contributor; 2026-10-15 coverage additions are AI-assisted and not separately native-reviewed | Vietnamese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs |
281
281
  | `crates/ui-egui/src/i18n/sl.tsv` | Slovene interface translation catalog | PdfCraft contributors | MIT OR Apache-2.0 | Contributor-original: clean-room translations of PdfCraft's English UI labels, no proprietary localisation resources | Slovene UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs |
282
282
  | `vendor/vello_common/assets/probe.png` | vello_common probe reference image (rendered from probe.rgba) | Linebender vello contributors | MIT OR Apache-2.0 | vello_common 0.0.8 (crates.io), vendored in vendor/vello_common; regenerated by its vello_sparse_tests regenerate_probe_reference binary | Reference picture of the vendored vello_common probe module, for people only; the build reads probe.rgba, not this file |
283
+ | `crates/ui-egui/src/i18n/nb.tsv` | Norwegian Bokmål interface translation catalog | PdfCraft contributors | MIT OR Apache-2.0 | Contributor-original: clean-room translations of PdfCraft's English UI labels, no proprietary localisation resources | Norwegian Bokmål UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs |
284
+ | `assets/icons/superscript.svg` | Lucide icon "superscript" | Lucide Contributors (portions Cole Bemis, Feather) | ISC | https://github.com/lucide-icons/lucide (npm lucide-static 1.49.0, icons/superscript.svg) | UI icon, embedded via crates/ui-egui/src/icon_data.rs |
285
+ | `assets/icons/subscript.svg` | Lucide icon "subscript" | Lucide Contributors (portions Cole Bemis, Feather) | ISC | https://github.com/lucide-icons/lucide (npm lucide-static 1.49.0, icons/subscript.svg) | UI icon, embedded via crates/ui-egui/src/icon_data.rs |
286
+ | `assets/icons/pilcrow.svg` | Lucide icon "pilcrow" | Lucide Contributors (portions Cole Bemis, Feather) | ISC | https://github.com/lucide-icons/lucide (npm lucide-static 1.49.0, icons/pilcrow.svg) | UI icon, embedded via crates/ui-egui/src/icon_data.rs |
287
+ | `assets/icons/move-horizontal.svg` | Lucide icon "move-horizontal" | Lucide Contributors (portions Cole Bemis, Feather) | ISC | https://github.com/lucide-icons/lucide (npm lucide-static 1.49.0, icons/move-horizontal.svg) | UI icon, embedded via crates/ui-egui/src/icon_data.rs |
283
288
 
284
289
  ## Compiled in through dependencies (6)
285
290
 
package/version.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
- "sdk": "0.2.0",
3
- "pdfcraftRev": "af36697f412c7e6d5933afaca0d439bbe4bf95c9"
2
+ "sdk": "0.2.1",
3
+ "pdfcraftRev": "9e66e3c4dacb5a2bcd7ac2a19cbfcd870ec13a65"
4
4
  }
@@ -0,0 +1,4 @@
1
+ [diffend] Oversized file quarantined before diffing.
2
+ name: package/viewer/fps-viewer-2048cf2709_bg.wasm
3
+ size: 40028293 bytes
4
+ sha256: 2048cf27096e5cd1e2df9b00bd8b7b47c495c8ea1d7042d9b7e96558a1c32040
@@ -2878,7 +2878,7 @@ function __wbg_get_imports() {
2878
2878
  return ret;
2879
2879
  },
2880
2880
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
2881
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2763, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2881
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2768, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2882
2882
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_e7a4a32c2194c314___convert__closures_____invoke___wasm_bindgen_e7a4a32c2194c314___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_e7a4a32c2194c314___JsError___true_);
2883
2883
  return ret;
2884
2884
  },
@@ -2893,22 +2893,22 @@ function __wbg_get_imports() {
2893
2893
  return ret;
2894
2894
  },
2895
2895
  __wbindgen_generic_0000000000000004: function(arg0, arg1) {
2896
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 8021, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2896
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 8049, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2897
2897
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_e7a4a32c2194c314___convert__closures_____invoke___wasm_bindgen_e7a4a32c2194c314___sys__JsNullable_wgpu_5c9b80f14fc867ac___backend__webgpu__webgpu_sys__gen_GpuAdapter__GpuAdapter___core_608f92abc48d28da___result__Result_____wasm_bindgen_e7a4a32c2194c314___JsError___true_);
2898
2898
  return ret;
2899
2899
  },
2900
2900
  __wbindgen_generic_0000000000000005: function(arg0, arg1) {
2901
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 2319, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2901
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 2324, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2902
2902
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_e7a4a32c2194c314___convert__closures_____invoke___web_sys_ea442f89be16ace0___features__gen_MessageEvent__MessageEvent______true_);
2903
2903
  return ret;
2904
2904
  },
2905
2905
  __wbindgen_generic_0000000000000006: function(arg0, arg1) {
2906
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 8021, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2906
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 8049, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2907
2907
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_e7a4a32c2194c314___convert__closures_____invoke___wasm_bindgen_e7a4a32c2194c314___sys__JsNullable_wgpu_5c9b80f14fc867ac___backend__webgpu__webgpu_sys__gen_GpuAdapter__GpuAdapter___core_608f92abc48d28da___result__Result_____wasm_bindgen_e7a4a32c2194c314___JsError___true__6);
2908
2908
  return ret;
2909
2909
  },
2910
2910
  __wbindgen_generic_0000000000000007: function(arg0, arg1) {
2911
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 8021, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2911
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 8049, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2912
2912
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_e7a4a32c2194c314___convert__closures_____invoke___wasm_bindgen_e7a4a32c2194c314___sys__JsNullable_wgpu_5c9b80f14fc867ac___backend__webgpu__webgpu_sys__gen_GpuAdapter__GpuAdapter___core_608f92abc48d28da___result__Result_____wasm_bindgen_e7a4a32c2194c314___JsError___true__7);
2913
2913
  return ret;
2914
2914
  },
@@ -2918,7 +2918,7 @@ function __wbg_get_imports() {
2918
2918
  return ret;
2919
2919
  },
2920
2920
  __wbindgen_generic_0000000000000009: function(arg0, arg1) {
2921
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 5454, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2921
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 5482, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2922
2922
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_e7a4a32c2194c314___convert__closures_____invoke_______true_);
2923
2923
  return ret;
2924
2924
  },
package/viewer/index.html CHANGED
@@ -16,8 +16,8 @@
16
16
  <canvas id="fps-canvas"></canvas>
17
17
  <script type="module">
18
18
  // Generated by scripts/build.ps1: the hashed wasm-bindgen glue and module.
19
- import init from "./fps-viewer-d187fa9496.js";
20
- init({ module_or_path: new URL("./fps-viewer-f5a9007df0_bg.wasm", import.meta.url) }).catch((e) => console.error("Free PDF SDK: the viewer could not start", e));
19
+ import init from "./fps-viewer-a2ad2665f7.js";
20
+ init({ module_or_path: new URL("./fps-viewer-2048cf2709_bg.wasm", import.meta.url) }).catch((e) => console.error("Free PDF SDK: the viewer could not start", e));
21
21
  </script>
22
22
  </body>
23
23
  </html>
@@ -1,4 +0,0 @@
1
- [diffend] Oversized file quarantined before diffing.
2
- name: package/viewer/fps-viewer-f5a9007df0_bg.wasm
3
- size: 39401192 bytes
4
- sha256: f5a9007df01896379946397767623bfb63c234983a3632495940155178c2acbd