-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Long single page PDF doesn't render at higher resolution #80
Comments
Hi @reyjexter , there is no way that I am aware of to control Pdfium's memory utilisation. The Pdfium WASM module you use must be compiled with a growable memory heap. There are notes on this in the documentation. Please provide the sample document you are trying to render if you wish me to attempt to reproduce the problem. |
Here's the example PDF that we are trying to render: https://github.com/reyjexter/pdfium-render-wasm/blob/master/www/long-content.pdf The size in pixels at 300 ppi is approximately:
|
Ok. I won't ask why you are attempting to render at those resolutions; I assume you have your reasons. There are two separate problems here, one (arguably) to do with Pdfium and Pixel dimensions in Even with a width of 7410 pixels and a height of "only" 19163 pixels, however, the rendered image is 567 megabytes in size. This brings us to your second problem: Safari and Firefox appear to have upper bounds on the maximum size of an I was able to successfully render the 567 Mb Long story short, the problem is not Pdfium per se (although certainly the choice of the |
Changed In short, it does appear that 65536 pixels is a sensible upper bound for bitmap dimensions. |
Testing rendering of the same document on a Linux machine, the maximum bitmap I was able to allocate was 2320723080 bytes in size (2.16 Gb). This seems to suggest that just over 2 Gb is a hard limit, irrespective of the platform. A bitmap that size correponds to pixel dimensions of 7410 x 78297. You will need to reconsider your target resolution, or file a bug report upstream with the Pdfium authors. |
Changed |
Thanks for the detailed explanation and yes this is something that we are also considering which is to use lower resolution for some documents. |
We have a use case which when trying to render a very long single page PDF on WASM, it doesn't show an image. Here's an example:
https://github.com/reyjexter/pdfium-render-wasm/blob/master/www/index.html
When reducing the size or resolution of image being rendered, this renders correctly so it looks like a memory related issue. What's the best way for pdfium-render to increase the allocated memory?
The expected result is to render the whole page as an image but it instead render a blank image. On some tests that we made, it renders the top portion of the page and the remaining being cut off. There's also no error that appears on console.
Thanks again!
The text was updated successfully, but these errors were encountered: