Question: This is a bit niche, hoping someone can help.

I'm using [DOMPDF](http://code.google.com/p/dompdf/) to convert HTML into PDF files - nice piece of kit using existing library infrastructure. However, when I specify the 'set\_paper' method it goes completely mental, sucking CPU out of existence and crashing. Odd, to say the least. It works when you do not specify this.

Code:-

```
            $dompdf = new DOMPDF();
        $dompdf->load_html($html);
        $dompdf->set_paper('a4', 'landscape');
        $dompdf->render();

        file_put_contents('data.pdf', $dompdf->output());

```

Answer: 
I had an issue with the landscape, because i was using

```
$dompdf->set_paper('a4', 'landscape');

```

after the 

```
$dompdf->render();

```

Correct order:

```
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->set_paper('a4', 'landscape');
$dompdf->render();

```
Considering it works when in portrait and not landscape, it probably has to do with a table being taller than one page. There is a bug that causes DOMPDF to crash if a table extends beyond one page. Either surround the content with another element like a div, or break the table apart into several tables.