Josh Josh - 1 month ago 5
PHP Question

DOMPDF - Defining DOMPDF_DPI on a case per case basis?

Is there something like:

$dompdf = new DOMPDF();
$dompdf->resolution(200);
$dompdf->load_html($html);
$dompdf->render();


Instead of having to set in the dompdf_config.inc.php, as I have multiple PDF files and they need different DPI.

Answer

If you are using the latest code from github then you can do the following:

php

$dompdf = new DOMPDF;
$dompdf->set_option( 'dpi' , '200' );
$dompdf->load_html($html);
$dompdf->render();

The full option list can be seen in the source.

Comments