Hi I have mybb installed on my website. I have also installed dompdf and its working in its own directory i.e. I have installed in "DOM"
directory. Now I can easily general pdfs with this simple code , keeping in the "DOM"
directory.
<?php
require_once "dompdf_config.inc.php";
//$file = "www/test/css_at_font_face.html";
$file="msf.html";
$dompdf = new DOMPDF();
$dompdf->load_html_file($file);
$dompdf->render();
$dompdf->stream("sample.pdf");
?>
If I try to access other file that is out the director DOM
i.e.
load_html_file($file); $dompdf->render(); $dompdf->stream("sample.pdf");
?>
I receive error Remote file requested, but DOMPDF_ENABLE_REMOTE is false
Advanced UsageGet content from HTML file using file_get_contents() function in PHP. Load HTML content using loadHtml() method of Dompdf class. Control the PDF output using stream() function of Dompdf class. $filename – (string) Name of the PDF file.
Dompdf is an HTML to PDF converter At its heart, dompdf is (mostly) a CSS 2.1 compliant HTML layout and rendering engine written in PHP. It is a style-driven renderer: it will download and read external stylesheets, inline style tags, and the style attributes of individual HTML elements.
If you wish to generate multiple pdf files in one go, you must save the documents in the server and then use JavaScript for-loop inside AJAX and pass the files one by one in the background. This will not kill the loop process since AJAX runs in the background.
'templating system. </p>'. '</body></html>'; $dompdf = new DOMPDF(); $dompdf->load_html($html); $dompdf->render(); $output = $dompdf->output(); file_put_contents('Brochure. pdf', $output);
For enabling remote access DO NOT edit "dompdf_config.inc.php"
Use instead:
$dompdf = new DOMPDF();
$dompdf->set_option('enable_remote', TRUE);
$dompdf->set_option('enable_css_float', TRUE);
$dompdf->set_option('enable_html5_parser', FALSE);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With