SVG-to-PDFKit icon indicating copy to clipboard operation
SVG-to-PDFKit copied to clipboard

Browser crashing while generating large PDFs

Open AsrarMemon opened this issue 6 years ago • 0 comments

Hello,

In our application, we need to generate a PDF document having around 1000 pages and the pages contain .svg data inside them. In order to generate PDF with .svg data, we are using the following two libraries:

  • PDFKit v 0.8.0
  • SVG2PDF

For writing one page in the PDF document, we are following the below menioned steps:

  1. Create a page in the PDF document using PDFKit.
  2. Pass the SVG data to be placed in the page to "SVGtoPDF" method of SVG2PDF library.
  3. SVG2PDF converts the SVG data into PDF format and sends it back to PDFKit library.
  4. PDFKit inserts the received data into the new page.
  5. Iterate thru steps 1 to 3 till all the needed pages are generated and added to the PDF document.

The above steps are working well for small PDF documents having around 200 pages. But when we try to use the same code for a PDF file with 1000 pages, the browser crashes.

I've uploaded our code for your reference on the following URL: http://next.plnkr.co/edit/ScJoAUUfSGz2HUtCWr9X?preview In this demo code, when we click on the "Generate PDF" button, the browser crashes within 1 minute (as we are writing around 1000 pages).

In order to avoid the browser crashing, we also tried to delegate the task of SVG to PDF data (in BLOB object) conversion to multiple worker threads. But we are not sure how to combine the BLOB objects returned by each worker in a single PDF file.

Can you please guide us either in solving the browser crash issue or in working with multiple workers?

We are ready to pay if your development team can explain the solution to our developers. We will apply the changes suggested by your team to solve the issue. Once the issue is resolved, we are ready to send you the files updated by our team so that you can publish them in your next release.

We are also open to pay if the complete solution is provided to us directly by your development team.

Hope to receive immediate help on this issue! Thanking you in anticipation... Regards, Asrar

AsrarMemon avatar Sep 10 '18 11:09 AsrarMemon