Create pdf with DOM PDF outside DOMpdf directory

Muhammad Arslan Jamshaid picture Muhammad Arslan Jamshaid · Jan 30, 2013 · Viewed 10.8k times · Source

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

Answer

NBPalomino picture NBPalomino · Feb 25, 2014

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);