When i try to load a HTML file which is in my storage Directory of my Laravel Project. I specified the path correctly and the file is there.
I tried moving the html file to the root of dompdf in the vendor map but that didn't help. Changing the path of chroot messes with other parts of dompdf itself. giving an error about not being able to find fonts.
This is the error i get
`Permission denied on <!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div class="body">
<h2>test</h2>
<hr/>
<p class="content">content test</p>
</div>
</body>
</html>. The file could not be found under the directory specified by Options::chroot.`
Are there any changes I could make in dompdf.php or Options.php to make it work?
Dompdf limits loading files from the local file system to the path set in the chroot option (by default the dompdf install directory, ref).
However, that's not what's causing your problem. The error seems to indicate that you are attempting to use $dompdf->loadHtmlFile()
to load a string containing the HTML document. This is the reason you see the content of the HTML document rather than a file path. When loading your HTML document use $dompdf->loadHtml()
instead.
Confirmed via discussion in the dompdf issue tracker: https://github.com/dompdf/dompdf/issues/1239