How to split a PDF file to couples of small PDFs page by page?



  • Hi There,

    I can generate PDF file with Jsreport engine. I have an extended requirement that split PDF to multiple PDFs. E.g. I can generate a PDF file based on my handlebar template, and the PDF have 10 pages. Now I want to generate 10 PDFs, one page one PDF file, rather than 1 single PDF file with 10 pages. Is there any possibilities for me to do so? Thank you!


  • administrators

    hi! this is possible only if you adjust your template to work like that, so instead of doing 1 request with data of 10 pages, you do 10 request each one with data of 1 page. right now, 1 request will always produce 1 pdf file, so if you want 10 PDFs there is no other way to do it.



  • Hi @bjrmatos ,

    But we use "page-break" in ".handlebar" file so that it could split html to pages in PDF. As you said adjust my template, do you mean that I need to create template for each pages and data for each template as well? That is not possible, the pages are dynamic I could not create template for each of them.


  • administrators

    hi!

    do you mean that I need to create template for each pages and data for each template as well?

    no, i did not say that, i say that you should have just one template (as you already have) but just send data for one page, and do 10 requests instead of just one, so you get 10 pdf files in the end with one page each. i don't know if your data can be adjusted to produce just one page, in some cases it fits like when printing flight tickets, so one ticket should always be printed in just one page, but i don't know about your case, however it looks that you can do this, just remember that if you want 10 pdf files you need to send 10 requests and ensure that each request produces just one page.



  • @bjrmatos , Understood. Unfortunately, it is almost impossible to just pass data page by page. If Jsreport could add some configuration in future, maybe something like output one PDF or output page by page. That would be great.
    However, many thanks! I will try to find other way out.



  • I used Softaken Split PDF Software It runs on all Windows versions without any problem. I have separated several pages from a PDF of 250 pages in few minutes using this software.


Log in to reply
 

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