Large PDF Generation



  • Hi,

    I'd like to know how large the document can handle for the PDF generation. Is it possible to generate a PDF with book level pages like 900-1000 pages?

    Thanks,



  • There is no specific limit for the number of pages. I have seen reports with many thousands of pages.

    However, the rendering time may increase significantly with complex graphics like charts.
    Its recommended to design one page, multiple it to thousands, and test the performance.



  • Hi, there's an error message shown as below when I was trying to generate a PDF with around 1500 pages, with a pdf utils configuration that merges single/multiple separate template(s):

    Error: Cannot create a string longer than 0x1fffffe8 characters
    at Object.slice (node:buffer:641:37)
    at Buffer.toString (node:buffer:791:14)
    at AsyncFunction.<anonymous>

    I'd like to ask if it's possible to generate a PDF with many thousands of pages with the pdf-utils merge operation being configured? If so, how could I solve the mentioned error above?

    Thanks.



  • @sjyeap Would you be able to replicate the issue for us? By providing the entities export and input data.



  • @jan_blaha Thank you for your reply. Please find the exported zipped file in this google link: https://drive.google.com/drive/folders/1xajuZRw9XfFcBzNg84u0TEMWZW2rcm9f?usp=sharing

    *PS: Today I restarted the server and tried to run the same program again. It worked for the first few times but after several attempts, the error repeats again.



  • Thank you for the export.

    pdf utils extension have issues with 600mb pdf you produce. I believe this will get solved in the jsreport v3 where we implement a much more optimized technique for communicating between worker processes. However, you will need to wait some months before this is released.

    The reason for 600mb pdf is your images. You use CSS style to reduce the image size to 300x300, but the pdf includes still the original size 650x940. To solve this, you can change the URL of your images from ?auto=compress&cs=tinysrgb&h=650&w=940 to ?auto=compress&cs=tinysrgb&h=300&w=300. You should see no errors afterwards.



  • Thank you very much for the reply. In over 90% of the situation we won't be hitting this size of report. We try to disable the toC but seems it can't help much in this situation. Is there a way for us to increase the memory allowed in the pdf utils process?



  • We transfer the big pdf buffer with base64 encoding and nodejs has a limit for max string size. I am afraid the memory increase won't help likely.

    As I mentioned earlier, the solution with embedding images with proper size should work for you. Doesn't it?



  • This is the sample project we are working on. We try to evaluate the capability of the tools and performance. Currently, we have requirement on the image clarity for the printed document to indicate defect location. As the number of defects can vary based on project size, it looks like we could encounter such an issue for a large project anyway.



  • @jan_blaha Thank you for the reply! It works perfectly fine after changing the size of images to 300x300.

    However, in our project we're actually considering to generate pdf files larger than 600mb. May I ask, can this issue be solved in jsreport v3? If yes, may I know approximately how many more months do I have to wait until it is released? Thanks.



  • Maybe you can also skip the TOC for now? You mentioned it didn't help? Try to disable the pdf utils extension fully.

    { "extensions": { "pdf-utils": { "enabled": false } } }
    

    It can be solved in v3, it is my expectation. We are still far away from some guessing of dates. Maybe a mid year.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.