PDFUtils causing file size to increase exponentially
We have been using jsreport for about a year and a half and love it. With assistance from @jan_blaha and @bjrmatos we successfully transitioned our reports from a fixed template to a dynamic one using a header and footer with auto populating page numbers and dynamic header and footer content.
Locally I noticed the performance was slower but didn't fully realise why until we published our changes in preparation for a big demo. We were using a $AU 20 a month Azure plan with our fixed template and getting really good performance i.e. 3-4 seconds for an 8 page report with images (around 200kb) we were extremely happy. Using PDFUtils to generate a dynamic header and footer (a hot topic for our reports) has blown the file size to 1.2mb. This doesn't seem like much but when you're talking 1000s of reports which need to be downloaded in bulk we're looking at a significant hosting cost increase (well over $400 a month which we had to use for our demo).
To negate issues with our design I created a blank template which downloads to a 9kb pdf. I then created a blank header-footer template and selected Merge Whole document . With a single page the file size jumped to 22kb I then added some page breaks in the main document and saw it jump to 44kb. This appears to confirm our suspicion that the pdfutil operation is taking the content of our main report from 189kb (8 pages) to 1.1mb when adding a header footer using PDFUtils. See this example of what happens to a 16kb file when pdfutils merge whole document is applied. https://playground.jsreport.net/w/ThePolymorph/Ttv3wrkl
My fear us that unless there is a straight forward way to have a dynamic header and footer and keep the file size low we will need to look for an alternative platform which would be a real shame.
Assistance in getting a workable solution would be greatly appreciated as we really love this platform.
This is a known problem which was recently fixed
Please try to update the pdf utils
npm i jsreport/jsreport-pdf-utils
Hi @jan_blaha I'm using the latest version but will certainly try that. Has this also been updated in the docker container as this is the area where it is most needed.
@jan_blaha wow! that brought a 1.2mb report back down to 200kb locally. This gives me a lot of hope so now going back to the question above how do I get this to work through the docker container, we are running this through Azure?
you need to make your own docker image.
we have some notes which may help here
@jan_blaha ok thanks, I'll give that a go. For something so critical (in my opinion) will this be included in future versions?
Sure, it will be part of the next release if there are no issues/side effects with it.
Hi @jan_blaha can you advise if the above fix (npm i jsreport/jsreport-pdf-utils) has been added yet, it's been working for me for the last 4 months without issue from the docker image I created (as advised above).
Not yet. I will be part of the 2.7.0 coming in one week hopefully.