I have a site which makes PDFs containing small images and charts on the client side (they are usually about 2-5 MB in size and all works well) I use jsPDF (1.5.3) to do that.
Today I encountered a problem which never happened before, and I am not quite sure what it even means.
When I try and create the PDF in question I get the following error in my console:
There was an error Error: requires deflate.js for compression
at C (jspdf.min.js:135)
at Object.I.processPNG (jspdf.min.js:135)
at Object.x.addImage (jspdf.min.js:50)
at pdf.self-b4b91c1a4baf7ae76684a8d5c1eb68e250cb9ac1ba550c09d9e01659877bff63.js?body=1:364
at new Promise (<anonymous>)
at pdf.self-b4b91c1a4baf7ae76684a8d5c1eb68e250cb9ac1ba550c09d9e01659877bff63.js?body=1:288
at Array.map (<anonymous>)
at pdf.self-b4b91c1a4baf7ae76684a8d5c1eb68e250cb9ac1ba550c09d9e01659877bff63.js?body=1:287
at Array.map (<anonymous>)
at buildPDF (pdf.self-b4b91c1a4baf7ae76684a8d5c1eb68e250cb9ac1ba550c09d9e01659877bff63.js?body=1:263)
So what is exactly the cause of this? Is the PDF too big? Too many pictures / charts?
I would paste the code, but the file is pretty big, and it's just standard PDF building stuff!
Does anyone know what this could be about from the top of their head?
Thank you!
The solution was to change compression from 'FAST' to 'NONE' when adding images to PDF, to be more specific :
addImage(imageData, format, x, y, width, height, alias, COMPRESSION <- change this, rotation)