I will recall this design as there still limit on the handlebar on the size. This approach put lot of pressure in catering the handlebar data in dataURL format. Its better to setup an image proxy and use URL in the template to refer to the resized image. The performance is much better as well.
Posts made by silvercrux-afk
-
RE: Resized image using asynchronous helper using sharp
-
RE: Large PDF Generation
After further check, this issue only happen when using the run and profile. If I change the mode to Run only, the issue disappeared. Currently I am ok to generate file at 1GB referring image by URL.
-
RE: Large PDF Generation
It looks like this is due to the handlebar template too large. I changed from dataURI to Url to fetch the images.
and the error change to pdf utilsError while executing pdf-utils operations. Cannot create a string longer than 0x1fffffe8 characters
Error: Error while executing pdf-utils operations. Cannot create a string longer than 0x1fffffe8 characters
at module.exports (/app/node_modules/@jsreport/jsreport-core/lib/shared/createError.js:10:13)
at WorkerReporter.createError (/app/node_modules/@jsreport/jsreport-core/lib/shared/reporter.js:47:12)
at AsyncFunction.<anonymous> (/app/node_modules/@jsreport/jsreport-pdf-utils/lib/worker.js:191:22)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async ListenerCollection.fire (/app/node_modules/@jsreport/jsreport-core/lib/shared/listenerCollection.js:157:21)
at async afterRender (/app/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:104:5) -
Resized image using asynchronous helper using sharp
I am trying to use the sharp library and use a global asynchronous helper to handle the resize. it works well for once but second time it will failed and terminate the whole jsreport instance giving.
terminate called after throwing an instance of 'Napi::Error'
2022-04-10T09:42:51.270747300Z what():Searching further it it linked to the release of the resources
https://github.com/lovell/sharp/issues/2263
which recommend to include the library in main thread. I would like to ask for jsreport where can I load the library in main thread? -
RE: Large PDF Generation
I am retesting this on jsreport v3. I encounter the following. But from the error message, its quite difficult to identify the area which goes wrong.
2022-04-10T09:20:21.825Z - warn: Error when processing render request 6 Error when evaluating engine handlebars for template /elevator/cover
2022-04-10T09:20:21.825583200Z Invalid string length RangeError: Invalid string length
2022-04-10T09:20:21.825623900Z at String.replace (<anonymous>)
2022-04-10T09:20:21.825648200Z at executionFn (/app/node_modules/@jsreport/jsreport-core/lib/worker/render/executeEngine.js:139:39) rootId=32lk7nj9sy8tpre, id=pfjx2hcpag1tcxk
2022-04-10T09:20:21.826557400Z 2022-04-10T09:20:21.826Z - warn: Rendering request 6 finished with error in 294407 ms rootId=32lk7nj9sy8tpre, id=pfjx2hcpag1tcxk
2022-04-10T09:20:21.831042900Z 2022-04-10T09:20:21.830Z - warn: Error when processing render request 2 Error while executing pdf-utils operations. Error when evaluating engine handlebars for template /elevator/cover
2022-04-10T09:20:21.831105400Z Invalid string length Error: Error while executing pdf-utils operations. Error when evaluating engine handlebars for template /elevator/cover
2022-04-10T09:20:21.831126900Z Invalid string length
2022-04-10T09:20:21.831150000Z at module.exports (/app/node_modules/@jsreport/jsreport-core/lib/shared/createError.js:10:13)
2022-04-10T09:20:21.831172800Z at WorkerReporter.createError (/app/node_modules/@jsreport/jsreport-core/lib/shared/reporter.js:47:12)
2022-04-10T09:20:21.831195200Z at AsyncFunction.<anonymous> (/app/node_modules/@jsreport/jsreport-pdf-utils/lib/worker.js:191:22)
2022-04-10T09:20:21.831215000Z at async ListenerCollection.fire (/app/node_modules/@jsreport/jsreport-core/lib/shared/listenerCollection.js:157:21)
2022-04-10T09:20:21.831235300Z at async afterRender (/app/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:104:5)
2022-04-10T09:20:21.831257600Z at async WorkerReporter._render (/app/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:152:7)
2022-04-10T09:20:21.831279500Z at async /app/node_modules/@jsreport/jsreport-core/lib/worker/reporter.js:177:19
2022-04-10T09:20:21.831313900Z at async Domain.<anonymous> (/app/node_modules/@jsreport/advanced-workers/lib/workerHandler.js:141:19)
2022-04-10T09:20:21.831335900Z caused by: RangeError: Invalid string length
2022-04-10T09:20:21.831358400Z at String.replace (<anonymous>)
2022-04-10T09:20:21.831378900Z at executionFn (/app/node_modules/@jsreport/jsreport-core/lib/worker/render/executeEngine.js:139:39) rootId=32lk7nj9sy8tpre, id=32lk7nj9sy8tpre
2022-04-10T09:20:21.832673200Z -
Drawing shape on top of image in doc report
Hi,
I would like to create an docx report with image and on top drawing rectangle box on top of the images in different location. I wonder if jsreport able to support that. -
RE: Large PDF Generation
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.
-
RE: Large PDF Generation
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?
-
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,