Tomas Smith
Tomas Smith

Reputation: 427

dompdf creating pdf

Is there a way to make dompdf see a CSS file to style the PDF output? Or does it have to be inline with a style attribute like style="border:...;"?

Here's what I tried:

require_once("pdf/dompdf_config.inc.php");
$html = ob_get_contents();
//ob_clean();
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->set_base_path(realpath(dirname(__FILE__)));
$dompdf->render();
$content = $dompdf->output();
$fileatt = "generated_pdfs/mypdfss.pdf";
file_put_contents($fileatt, $content);

Upvotes: 0

Views: 601

Answers (1)

Hue
Hue

Reputation: 413

It may be that you are trying to use styling for elements or selectors that are above CSS 2.1 (which dompdf currently supports). You can check thisdocumentation to verify whether the styling is supported.

Upvotes: 0

Related Questions