I think this is what you're looking for
Check the example provided in the docs, that's what you need.
Hello everyone, i'm using dompdf to generate pdf files and download them into my computer.
Now i'm generating multiple pdf files and i need to combine into one pdf file and download.
how can i do this in laravel?
I think this is what you're looking for
Check the example provided in the docs, that's what you need.
@ravp The information you're looking for is right there in the Usage section of the package @oussamamater posted.
Here's a little code to point you in the right direction:
$pdfmerge = PDFMerger::init();
$pdfmerge->addPDF(public_path('invoices/transport/INV'.$towinvoice->id.'-'.$towunit->claim_number.'.pdf'));
// Get the uploaded images to merge with the PDF
if(isset($uploadedImages)){
foreach($uploadedImages as $image){
$pdfmerge->addPDF($image->getPath()); // Add each file for merging / can be pdf files
}
}
// Merge the files
$pdfmerge->merge();
// Save the file
$pdfmerge->save(public_path('invoices/transport/merged/INV'.$towinvoice->id.'-'.$towunit->claim_number.'.pdf'), 'file');
@ravp I wrote the code. Use the dompdf to create the other PDF files and then use merger to merge them. $pdfMerge->save() method will generate the pdf file.
Read the docs on the two packages you're using, if you get stuck, post what you've come up with and someone will be able to help you.
You have to give it a try on your own and let us see some progress here.
@RayC +1 to "give it a try on your own".
I for real still can't see where the issue is, @ravp please read the full comments, they pointing towards what you need, there's no exact code to write for you, you need to do it on your own.
tmp directory (so you don't have to worry about the names later on).finder - symfony component I mentioned above.merge() and save() as the docs statedAnd give it a try*
Resource on how to manipulate files easily:
@oussamamater Has given you (@ravp) a straightforward path. I don’t think it can be explained any better.
Please or to participate in this conversation.