Merge Two or More PDFs

The code above enables you to combine multiple PDF documents created from different HTML contents into a single PDF file.

Two HTML contents have been rendered into separate PDF documents. The PdfDocument.mergePdf method is utilized to merge the two PDF documents, pdfdoc_a and pdfdoc_b, into a single PDF document named "merged."

The merging process is not limited to freshly rendered PDFs; it can also be applied to existing PDF documents using this method.