Merging multiple pdfs through API

  • Hi,
    I am loving the feature of merging/appending pdfs together. Can I do the same through APIs. If my user selects few from a list and want a single pdf out, can I give the send the template shortIds to stitch them together through API.


  • administrators

    hi! yes, i think you can use something like this:

    the list of operation that you define/see when using studio UI is represented as pdfOperations array attribute in json object when using http API.

      "template": {
        "shortid": "zhrkYUP",
        "pdfOperations": [{"type": "merge", "renderForEveryPage": false, "templateShortid": "yuHJKMO" }]

  • Thank you. Do you know if there is a limit of how many templates can be merged.
    I might have to append 30 templates or that possible.

    Thank you

  • administrators

    hi! i don't see any limit for how many templates you can use in merge operations, so basically there is no constraint that forbids you that, it should work. however you will need to try it to have the real answer because i've never tried to use many operations in a template

  • HI @bjrmatos. I tried using pdfOperations today and what I found is that if I have simple footer with display header/footer checked to show the page numbers and I do pdfOperations to show the "sample Watermark" then pdfOperations don't happen properly. One of these things happen... not both.
    If I set for both, on last page, I see partial sample watermark.

    'template': {'shortid' : (this.selectedDoc['templateId']) ? this.selectedDoc['templateId'] : "B1pj5g2m7",
                             "pdfOperations": [{"type": "merge", "renderForEveryPage": false, "templateShortid": "HJ3x6y2XQ"}]},

    OR If I display footer with Pdf-utils, how can I display page numbers and title of document in the footer.

  • Even if landscape checkbox is checked, the pdfOperations fails.
    In my situation, I have 14 templates for a feature and when I show as a Preview in my application, I want to add sample watermark to them.
    and when user is ready, i want to merge all these 14 templates as ONE pdf with no watermark.

    I found that by using display header/footer, I can show page numbers and the document title nicely but then sample watermark doesn't show properly (shows on last page only).

    If I go all pdfOperations to merge footers and I create footer templates, how can I show page numbers and title.

    Thank you for the answer.

Log in to reply

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