In function loadHtmlFile(), there's these lines:
$chroot = $this->options->getChroot();
if (strpos($realfile, $chroot) !== 0) {
throw new Exception("Permission denied on $file. The file could not be found under the directory specified by Options::chroot.");
}
When I'm using Dompdf with Composer, it lives in vendor directory, so the $chroot value is path/to/my/project/vendor/dompdf/dompdf but my code don't lives inside vendor. My file lives in path/to/my/project/src/myfile.html.
I also read Options.php is says about $chroot:
Prevents dompdf from accessing system files or other files on the webserver. All local files opened by dompdf must be in a subdirectory of this directory.
But I'm using Composer in this case, I don't want to put my file in vendor directory.
You can change the chroot path during instantiation, e.g.
$dompdf = new Dompdf();
$dompdf->set_option('chroot', '/path/to/document/root');
Thanks!
Sorry to interrupt you. How could I possibly change the directory if the generated PDF has been downloaded? the default is on the download folder. I want to put it somewhere in my project file folder. Thank you.
@zander009 this type of question is more appropriate for the support forum.
That being said ... you can't. The location where the file is saved is entirely dependent on the client. You can't provide path information for a file download (it's a security risk).
Most helpful comment
You can change the chroot path during instantiation, e.g.