@hussmartinez/pdf-sdk 0.4.3 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/assets/processing/processing.worker.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lazy/{processing-worker-DmUXTvVf.js → processing-worker-D4qwaqbw.js} +2 -2
- package/dist/lazy/{processing-worker-DmUXTvVf.js.map → processing-worker-D4qwaqbw.js.map} +1 -1
- package/dist/react.js +6 -6
- package/dist/react.js.map +1 -1
- package/dist/shared/{en-DcHRkVwP.js → en-DAmVF5wH.js} +5 -18
- package/dist/shared/en-DAmVF5wH.js.map +1 -0
- package/package.json +5 -4
- package/dist/shared/en-DcHRkVwP.js.map +0 -1
package/README.md
CHANGED
|
@@ -109,8 +109,8 @@ You need Node 24 (see [`.node-version`](.node-version)) and pnpm. The exact pnpm
|
|
|
109
109
|
|
|
110
110
|
```sh
|
|
111
111
|
pnpm install # also installs the git hooks
|
|
112
|
-
pnpm verify # everything CI runs
|
|
113
112
|
pnpm verify:fast # the subset the pre-push hook runs
|
|
113
|
+
pnpm verify # everything CI runs; it needs Docker for the browser tests
|
|
114
114
|
```
|
|
115
115
|
|
|
116
116
|
The examples use the built package as an application would: [`examples/next`](examples/next) renders the editor in a Next.js App Router Server Component, and [`examples/vite`](examples/vite) has one page per asset mode, each under the Content Security Policy this README gives for it. The plain HTML example joins them with the standalone script.
|
|
@@ -121,7 +121,7 @@ The browser and end-to-end tests also need Docker. They run in the pinned browse
|
|
|
121
121
|
|
|
122
122
|
| Step | Script | Tool |
|
|
123
123
|
|---|---|---|
|
|
124
|
-
| Format and lint | `lint` | Biome, then `
|
|
124
|
+
| Format and lint | `lint` | Biome, with sdk-config's `noUncheckedAbortListener` plugin, then `hm-check-hidden-unicode`, which fails on characters an editor or a diff doesn't show, or that reorder text, in any tracked text file. Write them as escapes (sdk-core ADR 0052) |
|
|
125
125
|
| CSS rules | `lint:css` | stylelint, with the `hm-` namespace and token rules |
|
|
126
126
|
| Types | `typecheck` | TypeScript |
|
|
127
127
|
| Dependency rules | `lint:deps` | dependency-cruiser, through `hm-lint-deps` |
|
|
@@ -54,4 +54,4 @@ end\
|
|
|
54
54
|
endstream
|
|
55
55
|
endobj
|
|
56
56
|
`))}finish(e){let t=this.offsets.size+1,n=this.length,r=`xref\n0 ${t}\n0000000000 65535 f \n`,i=[...this.offsets.entries()].sort(([e],[t])=>e-t);for(let[,e]of i)r+=`${String(e).padStart(10,`0`)} 00000 n \n`;r+=`trailer\n<< /Size ${t} /Root ${e} 0 R >>\nstartxref\n${n}\n%%EOF\n`,this.push(ev(r));let a=new Uint8Array(this.length),o=0;for(let e of this.chunks)a.set(e,o),o+=e.length;return a}push(e){this.chunks.push(e),this.length+=e.length}}})),iv=/* @__PURE__ */ c({PdfError:()=>Y_,PdfPasswordError:()=>X_,PdfToolkit:()=>mv,createPdfToolkit:()=>av,imagesToPdf:()=>Q_});function av(e={}){return mv.create(e)}function ov(e){return typeof e==`object`&&e&&`data`in e?e:{data:e}}function sv(e){return e.replace(/[^\w.-]/g,`_`)||`attachment`}function cv(e){return Number.parseInt(e.replace(/^part-/,``),10)}function lv(e){return`--password=${e}`}function uv(e){return typeof e==`number`?String(e):typeof e==`string`?e:e.map(String).join(`,`)}function dv(e){let{userPassword:t,ownerPassword:n=t,keyLength:r=256,permissions:i={}}=e,a=[];r===40&&a.push(`--allow-weak-crypto`),a.push(`--encrypt`,`--user-password=${t}`,`--owner-password=${n}`,`--bits=${r}`),r===128&&a.push(`--use-aes=y`);let{print:o,modify:s,extract:c,accessibility:l}=i;return r===40?(o!==void 0&&a.push(`--print=${o===`none`?`n`:`y`}`),s!==void 0&&a.push(`--modify=${s===`none`?`n`:`y`}`),c!==void 0&&a.push(`--extract=${c?`y`:`n`}`)):(o!==void 0&&a.push(`--print=${o}`),s!==void 0&&a.push(`--modify=${s}`),c!==void 0&&a.push(`--extract=${c?`y`:`n`}`),l!==void 0&&a.push(`--accessibility=${l?`y`:`n`}`)),a.push(`--`),a}function fv(e){if(e.exitCode!==0&&e.exitCode!==3)throw pv(e)}function pv(e){let t=e.stderr.trim(),n=t.split(`
|
|
57
|
-
`).at(-1)??`qpdf failed with exit code ${e.exitCode}`;return/invalid password|password.*(required|incorrect)/i.test(t)?new X_(n,e.exitCode,t):new Y_(n,e.exitCode,t)}var mv,hv=o((()=>{J_(),Z_(),rv(),mv=class e{runner;constructor(e){this.runner=e}static async create(t={}){return new e(await G_.create(t))}unlock(e,t){return this.transform(e,[lv(t.password),`--decrypt`])}removePassword(e,t){return this.unlock(e,t)}lock(e,t){return this.transform(e,dv(t))}changePassword(e,t){let n={userPassword:t.newPassword,ownerPassword:t.newOwnerPassword??t.newPassword,...t.keyLength!==void 0&&{keyLength:t.keyLength},...t.permissions!==void 0&&{permissions:t.permissions}};return this.transform(e,[lv(t.currentPassword),...dv(n)])}async merge(e){if(e.length===0)throw TypeError(`merge() needs at least one source document`);let t=e.map(ov);return this.runner.run(t.map(e=>e.data),({dir:e,inputPaths:n,exec:r,fs:i})=>{let a=[`--empty`,`--pages`];t.forEach((e,t)=>{a.push(n[t]),e.password!==void 0&&a.push(`--password=${e.password}`),a.push(e.pages===void 0?`1-z`:uv(e.pages))});let o=`${e}/out.pdf`;return a.push(`--`,o),fv(r(a)),i.readFile(o)})}async split(e,t={}){let n=t.pagesPerFile??1;if(!Number.isInteger(n)||n<1)throw TypeError(`pagesPerFile must be a positive integer, got ${n}`);return this.runner.run([e],({dir:e,inputPaths:r,exec:i,fs:a})=>{let o=[];return t.password!==void 0&&o.push(lv(t.password)),o.push(`--split-pages=${n}`,r[0],`${e}/part-%d.pdf`),fv(i(o)),a.readdir(e).filter(e=>e.startsWith(`part-`)).sort((e,t)=>cv(e)-cv(t)).map(t=>a.readFile(`${e}/${t}`))})}extractPages(e,t){let n=[];return t.password!==void 0&&n.push(lv(t.password)),n.push(`--pages`,`.`,uv(t.pages),`--`),this.transform(e,n)}async rotate(e,t){let{angle:n,absolute:r=!1,pages:i,password:a}=t;if(r&&n<0)throw TypeError(`absolute rotation must use a non-negative angle (90, 180, or 270)`);let o=`${r?``:n<0?`-`:`+`}${Math.abs(n)}${i===void 0?``:`:${uv(i)}`}`,s=[];return a!==void 0&&s.push(lv(a)),s.push(`--rotate=${o}`),this.transform(e,s)}async pageCount(e,t={}){return this.runner.run([e],({inputPaths:e,exec:n})=>{let r=[];t.password!==void 0&&r.push(lv(t.password)),r.push(`--show-npages`,e[0]);let i=n(r);return fv(i),Number.parseInt(i.stdoutText.trim(),10)})}async isEncrypted(e){return this.runner.run([e],({inputPaths:e,exec:t})=>{let n=t([`--is-encrypted`,e[0]]);if(n.exitCode===0)return!0;if(n.exitCode===2)return!1;throw pv(n)})}async requiresPassword(e){return this.runner.run([e],({inputPaths:e,exec:t})=>{let n=t([`--requires-password`,e[0]]);if(n.exitCode===0)return!0;if(n.exitCode===2||n.exitCode===3)return!1;throw pv(n)})}compress(e,t={}){let{password:n,compressionLevel:r=9,objectStreams:i=!0,linearize:a=!1}=t;if(!Number.isInteger(r)||r<1||r>9)throw TypeError(`compressionLevel must be 1-9, got ${r}`);let o=[];return n!==void 0&&o.push(lv(n)),o.push(`--compress-streams=y`,`--recompress-flate`,`--compression-level=${r}`,`--object-streams=${i?`generate`:`preserve`}`),a&&o.push(`--linearize`),this.transform(e,o)}linearize(e,t={}){let n=[];return t.password!==void 0&&n.push(lv(t.password)),n.push(`--linearize`),this.transform(e,n)}repair(e,t={}){let n=[];return t.password!==void 0&&n.push(lv(t.password)),this.transform(e,n)}async watermark(e,t,n={}){let{mode:r=`overlay`,password:i,stampPassword:a,to:o,from:s,repeat:c}=n;return this.runner.run([e,t],({dir:e,inputPaths:t,exec:n,fs:l})=>{let u=[];i!==void 0&&u.push(lv(i)),u.push(`--${r}`,t[1]),a!==void 0&&u.push(`--password=${a}`),o!==void 0&&u.push(`--to=${uv(o)}`),s!==void 0&&u.push(`--from=${uv(s)}`),c!==void 0&&u.push(`--repeat=${uv(c)}`);let d=`${e}/out.pdf`;return u.push(`--`,t[0],d),fv(n(u)),l.readFile(d)})}deletePages(e,t){let n={pages:`1-z,${uv(t.pages).split(`,`).map(e=>`x${e}`).join(`,`)}`,...t.password!==void 0&&{password:t.password}};return this.extractPages(e,n)}reversePages(e,t={}){return this.extractPages(e,{pages:`z-1`,...t})}async collate(e,t={}){let n=t.groupSize??1;if(!Number.isInteger(n)||n<1)throw TypeError(`groupSize must be a positive integer, got ${n}`);if(e.length<2)throw TypeError(`collate() needs at least two source documents`);let r=e.map(ov);return this.runner.run(r.map(e=>e.data),({dir:e,inputPaths:t,exec:i,fs:a})=>{let o=[`--empty`,`--collate=${n}`,`--pages`];r.forEach((e,n)=>{o.push(t[n]),e.password!==void 0&&o.push(`--password=${e.password}`),o.push(e.pages===void 0?`1-z`:uv(e.pages))});let s=`${e}/out.pdf`;return o.push(`--`,s),fv(i(o)),a.readFile(s)})}flatten(e,t={}){let n=[];return t.password!==void 0&&n.push(lv(t.password)),n.push(`--generate-appearances`,`--flatten-annotations=${t.annotations??`all`}`),this.transform(e,n)}async addAttachment(e,t){let{data:n,name:r,mimeType:i,description:a,password:o}=t;return this.runner.run([e],async({dir:e,inputPaths:t,exec:s,fs:c})=>{let l=`${e}/${sv(r)}`;c.writeFile(l,await W_(n));let u=[];o!==void 0&&u.push(lv(o)),u.push(`--add-attachment`,l,`--key=${r}`,`--filename=${r}`),i!==void 0&&u.push(`--mimetype=${i}`),a!==void 0&&u.push(`--description=${a}`);let d=`${e}/out.pdf`;return u.push(`--`,t[0],d),fv(s(u)),c.readFile(d)})}removeAttachment(e,t){let n=[];return t.password!==void 0&&n.push(lv(t.password)),n.push(`--remove-attachment=${t.name}`),this.transform(e,n)}async getAttachment(e,t){return this.runner.run([e],({inputPaths:e,exec:n})=>{let r=[];t.password!==void 0&&r.push(lv(t.password)),r.push(`--show-attachment=${t.name}`,e[0]);let i=n(r);return fv(i),i.stdout})}async listAttachments(e,t={}){return(await this.getInfo(e,t)).attachments}async getInfo(e,t={}){return this.runner.run([e],({inputPaths:e,exec:n,fs:r})=>{let i=n([...t.password===void 0?[]:[lv(t.password)],`--json`,`--json-key=encrypt`,`--json-key=attachments`,`--json-key=pages`,e[0]]);fv(i);let a=JSON.parse(i.stdoutText),o=new TextDecoder(`latin1`).decode(r.readFile(e[0]).slice(0,1024)),s=/%PDF-(\d+\.\d+)/.exec(o)?.[1]??`unknown`,c=Object.entries(a.attachments??{}).map(([e,t])=>({name:e,...t.preferredname!==void 0&&{filename:t.preferredname},...t.description!==void 0&&{description:t.description}})),l=a.encrypt,u={pdfVersion:s,pageCount:a.pages?.length??0,encrypted:l?.encrypted??!1,attachments:c};if(l?.encrypted){let e=l.capabilities??{};u.encryption={bits:l.parameters?.bits??0,method:l.parameters?.method??`unknown`,userPasswordMatched:l.userpasswordmatched??!1,ownerPasswordMatched:l.ownerpasswordmatched??!1,permissions:{accessibility:e.accessibility??!1,extract:e.extract??!1,print:e.printhigh??e.printlow??!1,modify:e.modify??!1,annotate:e.modifyannotations??!1,fillForms:e.modifyforms??!1,assemble:e.modifyassembly??!1}}}return u})}async raw(e,t){return this.runner.run(e,({dir:e,inputPaths:n,exec:r,fs:i})=>{let a=`${e}/out.pdf`;return fv(r(t.map(e=>e.replace(/\$out/g,a).replace(/\$in(\d+)/g,(e,t)=>{let r=n[Number(t)];if(r===void 0)throw TypeError(`no input for placeholder $in${t}`);return r})))),i.readFile(a)})}async transform(e,t){return this.runner.run([e],({dir:e,inputPaths:n,exec:r,fs:i})=>{let a=`${e}/out.pdf`;return fv(r([...t,n[0],a])),i.readFile(a)})}}})),gv;function _v(e){return gv??=(async()=>{let[{createPdfToolkit:t},n]=await Promise.all([Promise.resolve().then(()=>(hv(),iv)),e()]);return t({wasmModule:await WebAssembly.compile(n)})})(),gv.catch(()=>{gv=void 0}),gv}function vv(e){de({async build(t,n){try{return{ok:!0,bytes:await F_(t,{toolkit:()=>_v(e),signal:n.signal,progress:e=>n.progress(e)})}}catch(e){if(e instanceof TypeError||e instanceof RangeError)return{ok:!1,error:e.name,message:e.message};throw e}}},{packageVersion:`0.4.
|
|
57
|
+
`).at(-1)??`qpdf failed with exit code ${e.exitCode}`;return/invalid password|password.*(required|incorrect)/i.test(t)?new X_(n,e.exitCode,t):new Y_(n,e.exitCode,t)}var mv,hv=o((()=>{J_(),Z_(),rv(),mv=class e{runner;constructor(e){this.runner=e}static async create(t={}){return new e(await G_.create(t))}unlock(e,t){return this.transform(e,[lv(t.password),`--decrypt`])}removePassword(e,t){return this.unlock(e,t)}lock(e,t){return this.transform(e,dv(t))}changePassword(e,t){let n={userPassword:t.newPassword,ownerPassword:t.newOwnerPassword??t.newPassword,...t.keyLength!==void 0&&{keyLength:t.keyLength},...t.permissions!==void 0&&{permissions:t.permissions}};return this.transform(e,[lv(t.currentPassword),...dv(n)])}async merge(e){if(e.length===0)throw TypeError(`merge() needs at least one source document`);let t=e.map(ov);return this.runner.run(t.map(e=>e.data),({dir:e,inputPaths:n,exec:r,fs:i})=>{let a=[`--empty`,`--pages`];t.forEach((e,t)=>{a.push(n[t]),e.password!==void 0&&a.push(`--password=${e.password}`),a.push(e.pages===void 0?`1-z`:uv(e.pages))});let o=`${e}/out.pdf`;return a.push(`--`,o),fv(r(a)),i.readFile(o)})}async split(e,t={}){let n=t.pagesPerFile??1;if(!Number.isInteger(n)||n<1)throw TypeError(`pagesPerFile must be a positive integer, got ${n}`);return this.runner.run([e],({dir:e,inputPaths:r,exec:i,fs:a})=>{let o=[];return t.password!==void 0&&o.push(lv(t.password)),o.push(`--split-pages=${n}`,r[0],`${e}/part-%d.pdf`),fv(i(o)),a.readdir(e).filter(e=>e.startsWith(`part-`)).sort((e,t)=>cv(e)-cv(t)).map(t=>a.readFile(`${e}/${t}`))})}extractPages(e,t){let n=[];return t.password!==void 0&&n.push(lv(t.password)),n.push(`--pages`,`.`,uv(t.pages),`--`),this.transform(e,n)}async rotate(e,t){let{angle:n,absolute:r=!1,pages:i,password:a}=t;if(r&&n<0)throw TypeError(`absolute rotation must use a non-negative angle (90, 180, or 270)`);let o=`${r?``:n<0?`-`:`+`}${Math.abs(n)}${i===void 0?``:`:${uv(i)}`}`,s=[];return a!==void 0&&s.push(lv(a)),s.push(`--rotate=${o}`),this.transform(e,s)}async pageCount(e,t={}){return this.runner.run([e],({inputPaths:e,exec:n})=>{let r=[];t.password!==void 0&&r.push(lv(t.password)),r.push(`--show-npages`,e[0]);let i=n(r);return fv(i),Number.parseInt(i.stdoutText.trim(),10)})}async isEncrypted(e){return this.runner.run([e],({inputPaths:e,exec:t})=>{let n=t([`--is-encrypted`,e[0]]);if(n.exitCode===0)return!0;if(n.exitCode===2)return!1;throw pv(n)})}async requiresPassword(e){return this.runner.run([e],({inputPaths:e,exec:t})=>{let n=t([`--requires-password`,e[0]]);if(n.exitCode===0)return!0;if(n.exitCode===2||n.exitCode===3)return!1;throw pv(n)})}compress(e,t={}){let{password:n,compressionLevel:r=9,objectStreams:i=!0,linearize:a=!1}=t;if(!Number.isInteger(r)||r<1||r>9)throw TypeError(`compressionLevel must be 1-9, got ${r}`);let o=[];return n!==void 0&&o.push(lv(n)),o.push(`--compress-streams=y`,`--recompress-flate`,`--compression-level=${r}`,`--object-streams=${i?`generate`:`preserve`}`),a&&o.push(`--linearize`),this.transform(e,o)}linearize(e,t={}){let n=[];return t.password!==void 0&&n.push(lv(t.password)),n.push(`--linearize`),this.transform(e,n)}repair(e,t={}){let n=[];return t.password!==void 0&&n.push(lv(t.password)),this.transform(e,n)}async watermark(e,t,n={}){let{mode:r=`overlay`,password:i,stampPassword:a,to:o,from:s,repeat:c}=n;return this.runner.run([e,t],({dir:e,inputPaths:t,exec:n,fs:l})=>{let u=[];i!==void 0&&u.push(lv(i)),u.push(`--${r}`,t[1]),a!==void 0&&u.push(`--password=${a}`),o!==void 0&&u.push(`--to=${uv(o)}`),s!==void 0&&u.push(`--from=${uv(s)}`),c!==void 0&&u.push(`--repeat=${uv(c)}`);let d=`${e}/out.pdf`;return u.push(`--`,t[0],d),fv(n(u)),l.readFile(d)})}deletePages(e,t){let n={pages:`1-z,${uv(t.pages).split(`,`).map(e=>`x${e}`).join(`,`)}`,...t.password!==void 0&&{password:t.password}};return this.extractPages(e,n)}reversePages(e,t={}){return this.extractPages(e,{pages:`z-1`,...t})}async collate(e,t={}){let n=t.groupSize??1;if(!Number.isInteger(n)||n<1)throw TypeError(`groupSize must be a positive integer, got ${n}`);if(e.length<2)throw TypeError(`collate() needs at least two source documents`);let r=e.map(ov);return this.runner.run(r.map(e=>e.data),({dir:e,inputPaths:t,exec:i,fs:a})=>{let o=[`--empty`,`--collate=${n}`,`--pages`];r.forEach((e,n)=>{o.push(t[n]),e.password!==void 0&&o.push(`--password=${e.password}`),o.push(e.pages===void 0?`1-z`:uv(e.pages))});let s=`${e}/out.pdf`;return o.push(`--`,s),fv(i(o)),a.readFile(s)})}flatten(e,t={}){let n=[];return t.password!==void 0&&n.push(lv(t.password)),n.push(`--generate-appearances`,`--flatten-annotations=${t.annotations??`all`}`),this.transform(e,n)}async addAttachment(e,t){let{data:n,name:r,mimeType:i,description:a,password:o}=t;return this.runner.run([e],async({dir:e,inputPaths:t,exec:s,fs:c})=>{let l=`${e}/${sv(r)}`;c.writeFile(l,await W_(n));let u=[];o!==void 0&&u.push(lv(o)),u.push(`--add-attachment`,l,`--key=${r}`,`--filename=${r}`),i!==void 0&&u.push(`--mimetype=${i}`),a!==void 0&&u.push(`--description=${a}`);let d=`${e}/out.pdf`;return u.push(`--`,t[0],d),fv(s(u)),c.readFile(d)})}removeAttachment(e,t){let n=[];return t.password!==void 0&&n.push(lv(t.password)),n.push(`--remove-attachment=${t.name}`),this.transform(e,n)}async getAttachment(e,t){return this.runner.run([e],({inputPaths:e,exec:n})=>{let r=[];t.password!==void 0&&r.push(lv(t.password)),r.push(`--show-attachment=${t.name}`,e[0]);let i=n(r);return fv(i),i.stdout})}async listAttachments(e,t={}){return(await this.getInfo(e,t)).attachments}async getInfo(e,t={}){return this.runner.run([e],({inputPaths:e,exec:n,fs:r})=>{let i=n([...t.password===void 0?[]:[lv(t.password)],`--json`,`--json-key=encrypt`,`--json-key=attachments`,`--json-key=pages`,e[0]]);fv(i);let a=JSON.parse(i.stdoutText),o=new TextDecoder(`latin1`).decode(r.readFile(e[0]).slice(0,1024)),s=/%PDF-(\d+\.\d+)/.exec(o)?.[1]??`unknown`,c=Object.entries(a.attachments??{}).map(([e,t])=>({name:e,...t.preferredname!==void 0&&{filename:t.preferredname},...t.description!==void 0&&{description:t.description}})),l=a.encrypt,u={pdfVersion:s,pageCount:a.pages?.length??0,encrypted:l?.encrypted??!1,attachments:c};if(l?.encrypted){let e=l.capabilities??{};u.encryption={bits:l.parameters?.bits??0,method:l.parameters?.method??`unknown`,userPasswordMatched:l.userpasswordmatched??!1,ownerPasswordMatched:l.ownerpasswordmatched??!1,permissions:{accessibility:e.accessibility??!1,extract:e.extract??!1,print:e.printhigh??e.printlow??!1,modify:e.modify??!1,annotate:e.modifyannotations??!1,fillForms:e.modifyforms??!1,assemble:e.modifyassembly??!1}}}return u})}async raw(e,t){return this.runner.run(e,({dir:e,inputPaths:n,exec:r,fs:i})=>{let a=`${e}/out.pdf`;return fv(r(t.map(e=>e.replace(/\$out/g,a).replace(/\$in(\d+)/g,(e,t)=>{let r=n[Number(t)];if(r===void 0)throw TypeError(`no input for placeholder $in${t}`);return r})))),i.readFile(a)})}async transform(e,t){return this.runner.run([e],({dir:e,inputPaths:n,exec:r,fs:i})=>{let a=`${e}/out.pdf`;return fv(r([...t,n[0],a])),i.readFile(a)})}}})),gv;function _v(e){return gv??=(async()=>{let[{createPdfToolkit:t},n]=await Promise.all([Promise.resolve().then(()=>(hv(),iv)),e()]);return t({wasmModule:await WebAssembly.compile(n)})})(),gv.catch(()=>{gv=void 0}),gv}function vv(e){de({async build(t,n){try{return{ok:!0,bytes:await F_(t,{toolkit:()=>_v(e),signal:n.signal,progress:e=>n.progress(e)})}}catch(e){if(e instanceof TypeError||e instanceof RangeError)return{ok:!1,error:e.name,message:e.message};throw e}}},{packageVersion:`0.4.5`})}async function yv(){let e=new URL(`qpdf.wasm`,self.location.href),t=await fetch(e);if(!t.ok)throw new T_(`WORKER_START_FAILED`,`qpdf.wasm couldn't be loaded from ${e}.`,{details:{asset:`qpdf.wasm`,status:t.status}});let n=new Uint8Array(await t.arrayBuffer()),r=[...new Uint8Array(await crypto.subtle.digest(`SHA-256`,n))].map(e=>e.toString(16).padStart(2,`0`)).join(``);if(r!==`48a6044e2b5abb32295fa1682e26f20338181bb2423b2ab6e8456b7c4a8c9756`)throw new T_(`WORKER_START_FAILED`,`qpdf.wasm doesn't match this version of the SDK. Copy dist/assets again after upgrading.`,{details:{asset:`qpdf.wasm`,expected:d,actual:r}});return n}vv(yv);
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as PdfError, S as pdfLimits, _ as PDF_MAX_CANVAS_PIXELS, a as checkId, b as addRotation, c as isRecord, d as PDF_MAX_STROKE_POINTS, f as PDF_MAX_TEXT_LENGTH, g as createPdfJsEngine, h as createPdfProcessor, i as checkAnnotation, l as PDF_MAX_FIELD_NAME_LENGTH, m as longerThan, n as createPdfSession, o as fields, p as PDF_POSITION_GRID, r as Invalid, s as invalid, t as pdfMessages, u as PDF_MAX_ID_LENGTH, v as linkDestination, w as isPdfError, x as pdfLimitDefinitions, y as safeLinkUrl } from "./shared/en-DAmVF5wH.js";
|
|
2
2
|
// src/core/format/plan-document.ts
|
|
3
3
|
var PDF_PLAN_FORMAT = "hm-pdf-plan";
|
|
4
4
|
var PDF_PLAN_VERSION = 1;
|