Render Blade template as PDF + combine with existing PDFs
Having tried and banged my head against walls because of various PDF-generating libraries, I’ve found Spatie’s Browsershot to be the least frustrating and the one that works best. It renders Blade views almost properly.
But I can’t seem to find a way to use it to add existing PDF files as separate pages (what you’d do in Acrobat using Insert pages → From file).
Here’s an example of what I’m trying to do:
- I have a Blade view that renders project price estimates with lots of calculations and quotes for individual services; this view should be rendered as a PDF file (single-page at this point).
- Some of the prices in an estimate will come with attachments (formal quotes received from external providers); these are all numbered on the estimate view. Each of these external price quotes are stored as PDF files in the server’s filesystem, and should be appended to the PDF file as additional pages at the end, in the order they are numbered in the view
- Each attachment added to the PDF file should have an added text at a specified location on the page giving its number (e.g., “Attachment 2”)
Does anyone know of a package that will allow me to achieve this? It doesn’t have to be one package that does all three points above – I can do 1. with Browsershot and 2.–3. with another package, for example.
Please or to participate in this conversation.