kartik-v / yii2-mpdf

A Yii2 wrapper component for the mPDF library which generates PDF files from UTF-8 encoded HTML.
http://demos.krajee.com/mpdf
Other
161 stars 150 forks source link

fix add attachment #94

Closed klopus closed 5 years ago

klopus commented 5 years ago

Hello, I found an error to adding an attachment, I suggest this fix;

SetImportUse() is deprecated to mpdf 8

in pdf .php change row 391 if ($pdfAttachments) { $api->SetImportUse(); $api->SetHeader(null); $api->SetFooter(null); foreach ($pdfAttachments as $attachment) { $this->writePdfAttachment($api, $attachment); } }

to if ($pdfAttachments) { $api->SetHeader(null); $api->SetFooter(null); foreach ($pdfAttachments as $attachment) { $pagecount = $api->SetSourceFile($attachment); for ($i=1; $i<=($pagecount); $i++) { $api->AddPage(); $api->UseTemplate($api->ImportPage($i)); } } }

it's a quick fix, surely there is a better method

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.