Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

matt@laracasts789's avatar

Changing from portrait to landscape view in same pdf (dompdf) - is it possible ?

I currently am loading a pdf document (using dompdf) and populating it with database information. I have tables included towards the end of the document and so I want to be able to change the view from portrait to landscape half way through. Is this possible ?

A basic example of my code is as follows;:

$pdf = \PDF::loadView('pages.page5', array('name'=>$name, 'email'=>$email))->setPaper("A4")->setOrientation("portrait");

return $pdf->stream();

Is there a way to change setOrientation through the middle of a document? Cheers for any help

0 likes
1 reply
TerrePorter's avatar

If i remember right, the orientation is per each page in the document.

Please or to participate in this conversation.