1

I am using Laravel-pdf package package to generate pdf. I want to generating two pdfs with different contents. But this package does not allow me to create second pdf with different content. I am getting first content in the second pdf.

This is my code

$pdf = PDF::loadView('pdf.bill', $data);
return $pdf->save('invoice.pdf'); 

$pdf = PDF::loadView('pdf.invoice', $data);
return $pdf->save('agreement.pdf'); 

1 Answer 1

1

I have solved the issue by changing PDFWrapper class's save method as below

public function save($filename) {
$mpdf=new \mPDF('c','A4','','' , 0 , 0 , 0 , 0 , 0 , 0); 
$mpdf->SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 0;  // 1 or 0 - whether to indent the first level of a list
$mpdf->WriteHTML($this->html);    
return $mpdf->Output($filename, 'F');
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.