How to merge PDF using dompdf?

Logan picture Logan · Feb 5, 2013 · Viewed 12k times · Source

I'm using dompdf library to create PDF. Beside I want to merge another PDF(it is located at particular path) pages with newly created PDF.

Is there anyway to do this using dompdf or Do we have any other library?

Answer

pratibha picture pratibha · Feb 5, 2013

Are you talking about overlaying one PDF on top of another or appending the pages of one document to another? DOMPDF doesn't currently support either type of functionality because it is focused on HTML to PDF conversion. Due to this focus by the project you're not likely to see any work put in to support the handling of existing PDFs anytime soon.

You would need to first render the HTML to PDF (maybe in two parts), then combine them using another tool like pdftk (system binary) or PDF Merger. I haven't tried PDF Merger, but pdftk works like a champ.