简体   繁体   中英

mPDF - How to create multiple PDFs?

I have two functions. 1st for creating a Debit Note and 2nd for creating Invoice. I call Debit Note Function first and then Invoice function. The content of both files appears to be Debit Note. However the file names seems to be correct for both the files.

When I call Invoice function 1st and then Debit Note function. The content of both the files appears to be Invoice and the file names seems to be correct for both the file.

PS: I am calling both the functions together.

$this->mpdf->setAutoTopMargin = 'stretch';
$this->mpdf->setAutoBottomMargin = 'stretch';
$this->mpdf->SetHTMLHeader($this->pdftemplate->Header());
$this->mpdf->SetHTMLFooter($this->pdftemplate->Footer());
$html = $this->pdftemplate->debitNote($debitNoteNo, $narration, $amount);
$this->mpdf->SetTitle("Debit Note");
$this->mpdf->SetAuthor("Vikash");
$this->mpdf->SetCreator("Vikash");
$this->mpdf->SetSubject($debitNoteNo);
$this->mpdf->WriteHTML($html);
$url = "/temp/dn/" . $debitNoteNo . ".pdf";
$this->mpdf->Output($url, "F");




$this->mpdf->setAutoTopMargin = 'stretch';
$this->mpdf->setAutoBottomMargin = 'stretch';
$this->mpdf->SetHTMLHeader($this->pdftemplate->Header());
$this->mpdf->SetHTMLFooter($this->pdftemplate->Footer());
$html = $this->pdftemplate->invoice($invoiceNo, $narration, $amount);
$this->mpdf->SetTitle("Invoice");
$this->mpdf->SetAuthor("Vikash");
$this->mpdf->SetCreator("Vikash");
$this->mpdf->SetSubject($invoiceNo);
$this->mpdf->WriteHTML($html);
$url = "/temp/invoice/" . $invoiceNo . ".pdf";
$this->mpdf->Output($url, "F");

Can anyone help me with this? Thanks for reading the question and your valuable answers.

正如我在github问题中所指出 ,最安全的方法是为每个生成的文件创建一个单独的mPDF实例。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM