Pdf Rendering and merging taking a lot of time



  • I am looking for a better solution to merge a set of htmls into a single pdf. Each html can have any number of pages when rendered to pdf. When the final pdf is printed on a printer with two-page side printing option, each html should be printed as a single unit i.e. no printed page should have content from two htmls. Currently, I am rendering each html to pdf, using pdfjs to get pageCount, then merging each html one by one with a single blank page in between, if the last html had an odd number of pages.
    I am using jsreport.render for rendering, jsreport-pdf-utils/lib/utils/addPages for merging, and pdfjs.ExternalDocument for pageCount.
    Set of html to pdf conversion is done with Promise.all, so rendering is not a bottleneck when using http-server strategy but the merging is what takes most of time (I'll have to check for exact numbers).
    Can you tell me a better approach for this problem? Can I do this in a single operation of rendering with injecting blank page where necessary?



  • Is there any way to know the page count of pdf to be rendered from html before rendering? All the data is already embedded in html


Log in to reply
 

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