There is an output method option to get a string that you can use as an attachment in an email, for example:
$mpdf->Output('', \Mpdf\Output\Destination::STRING_RETURN);
Is it possible to import this string again in a new MPDF-instance and add more content? I don't want to have to create individual PDF files first and then import them (importPage). My solution consists of independent PDF generators that should write to a shared PDF file.
CodePudding user response:
No, it is not possible.
The cleanest solution would be repeating the same PHP procedure with a new mPDF instance and then appending the new content.
<?php
$mpdf1 = new \Mpdf\Mpdf();
baseContent($mpdf1);
$mpdf1->Output('', \Mpdf\Output\Destination::STRING_RETURN);
$mpdf2 = new \Mpdf\Mpdf();
baseContent($mpdf2);
additionalContent($mpdf2);
$mpdf2->Output('', \Mpdf\Output\Destination::STRING_RETURN);