Esteban Cazorla
Esteban Cazorla

Reputation: 151

Black page in DOMPDF

I know that this is also questioned but the answers i found didnt help me...

Im trying to make this simple pdf file with DOMPDF:

<?php
require_once 'dompdf/dompdf_config.inc.php';
$html =
'<html> 
<head>
<style>
@page {margin-top: 0;margin-left: 0;
    }
.paginapdf{margin:10mm;
}
</style> 
</head>
<body><div class="paginapdf" style="background-color:red; width:277mm;    height:190mm"><p>Hola</p></div></body></html>';
$dompdf = new DOMPDF();
$dompdf->set_paper("A4", "landscape");
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("pdf".Date('Y-m-d').".pdf");
?>

And it works, but the first page is a blank page...

I think the problem is that im using all the A4 paper. If i change the .paginapdf margin to 1mm for example, the blank page doesnt appears...

Any idea?

Thanks a lot

Upvotes: 0

Views: 1181

Answers (1)

Esteban Cazorla
Esteban Cazorla

Reputation: 151

Ok, fixed...

I changed @page margin to 10mm and deleted the .paginapdf margins, now it works... why? i dont know hahaha

Upvotes: 1

Related Questions