Replies: 1 comment
-
after further investigation I noticed that the dynamic import of if (isNodeJS) {
var packageCapability = Promise.withResolvers();
var packageMap = null;
const loadPackages = async () => {
const fs = await import(/*webpackIgnore: true*/"fs"),
http = await import(/*webpackIgnore: true*/"http"),
https = await import(/*webpackIgnore: true*/"https"),
url = await import(/*webpackIgnore: true*/"url");
let canvas, path2d;
try {
canvas = await import(/*webpackIgnore: true*/"canvas");
} catch {}
try {
path2d = await import(/*webpackIgnore: true*/"path2d");
} catch {}
return new Map(Object.entries({
fs,
http,
https,
url,
canvas,
path2d
}));
};
... the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Attach (recommended) or Link to PDF file
sample.pdf
Web browser and its version
nodejs
Operating system and its version
windows 11
PDF.js version
4.7.76
Is the bug present in the latest PDF.js version?
Yes
Is a browser extension
No
Steps to reproduce the problem
when trying to render a pdf page on canvas, i get the following error:
What is the expected behavior?
it should correctly render the page and save it to a buffer
What went wrong?
file is correctly read, number of pages and viewport are correctly reported, but the render call fails:
Link to a viewer
No response
Additional context
this is the conversion function I wrote:
this is the package.json:
Beta Was this translation helpful? Give feedback.
All reactions