pdf-factory 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/parser.cjs +1 -1
- package/dist/parser.cjs.map +1 -1
- package/dist/parser.js +13 -3
- package/dist/parser.js.map +1 -1
- package/dist/pdf-factory.cjs.map +1 -1
- package/dist/pdf-factory.js.map +1 -1
- package/package.json +15 -6
package/dist/parser.js
CHANGED
|
@@ -117818,7 +117818,7 @@ globalThis._pdfjsTestingUtils = { HighlightOutliner: Lu }, globalThis.pdfjsLib =
|
|
|
117818
117818
|
XfaLayer: ho
|
|
117819
117819
|
};
|
|
117820
117820
|
//#endregion
|
|
117821
|
-
//#region node_modules/.pnpm/pdf-to-img@6.
|
|
117821
|
+
//#region node_modules/.pnpm/pdf-to-img@6.1.0/node_modules/pdf-to-img/dist/parseInput.js
|
|
117822
117822
|
var od = "data:application/pdf;base64,";
|
|
117823
117823
|
async function sd(e) {
|
|
117824
117824
|
if (Buffer.isBuffer(e)) return Uint8Array.from(e);
|
|
@@ -117828,7 +117828,7 @@ async function sd(e) {
|
|
|
117828
117828
|
throw Error("pdf-to-img received an unexpected input. Provide a path to file, a data URL, a Uint8Array, a Buffer, or a ReadableStream.");
|
|
117829
117829
|
}
|
|
117830
117830
|
//#endregion
|
|
117831
|
-
//#region node_modules/.pnpm/pdf-to-img@6.
|
|
117831
|
+
//#region node_modules/.pnpm/pdf-to-img@6.1.0/node_modules/pdf-to-img/dist/index.js
|
|
117832
117832
|
var cd = u.default.dirname((0, u.createRequire)(import.meta.url).resolve("pdfjs-dist/package.json")), ld = (e) => {
|
|
117833
117833
|
let t = JSON.parse(JSON.stringify(e));
|
|
117834
117834
|
for (let e in t) typeof t[e] == "string" && (t[e] = t[e].replaceAll(/(^þÿ|\u0000)/g, ""));
|
|
@@ -117845,17 +117845,27 @@ async function ud(e, t = {}) {
|
|
|
117845
117845
|
data: n
|
|
117846
117846
|
}).promise, i = await r.getMetadata();
|
|
117847
117847
|
async function a(e) {
|
|
117848
|
-
let n = await r.getPage(e)
|
|
117848
|
+
let n = await r.getPage(e);
|
|
117849
|
+
if (n.destroyed) throw Error("page is already destroyed");
|
|
117850
|
+
let i = n.getViewport({ scale: t.scale ?? 1 }), { canvas: a } = r.canvasFactory.create(i.width, i.height, !!t.renderParams?.background);
|
|
117849
117851
|
return await n.render({
|
|
117850
117852
|
canvas: a,
|
|
117851
117853
|
viewport: i,
|
|
117852
117854
|
...t.renderParams
|
|
117853
117855
|
}).promise, a.toBuffer("image/png");
|
|
117854
117856
|
}
|
|
117857
|
+
async function o() {
|
|
117858
|
+
r.loadingTask.destroyed || await r.loadingTask.destroy();
|
|
117859
|
+
}
|
|
117855
117860
|
return {
|
|
117856
117861
|
length: r.numPages,
|
|
117857
117862
|
metadata: ld(i.info),
|
|
117858
117863
|
getPage: a,
|
|
117864
|
+
get isDestroyed() {
|
|
117865
|
+
return r.loadingTask.destroyed;
|
|
117866
|
+
},
|
|
117867
|
+
destroy: o,
|
|
117868
|
+
[Symbol.asyncDispose]: o,
|
|
117859
117869
|
[Symbol.asyncIterator]() {
|
|
117860
117870
|
return {
|
|
117861
117871
|
pg: 0,
|