You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling getOutputFromHtml() we're seeing the following errors on IIS8:
Fatal error: Uncaught exception 'RuntimeException' with message 'The file 'C:\Windows\TEMP\knp_snappy54637e792dbd24.73938986.pdf' was not created (command: C:\wkhtmltopdf\bin\wkhtmltopdf.exe --lowquality "C:\Windows\TEMP\knp_snappy54637e792da033.68527031.html" "C:\Windows\TEMP\knp_snappy54637e792dbd24.73938986.pdf").' in C:\inetpub\wwwroot\www.XXXXXX.co.uk\classes\Knp\Snappy\AbstractGenerator.php:300
Stack trace:
#0 C:\inetpub\wwwroot\www.XXXXXX.co.uk\classes\Knp\Snappy\AbstractGenerator.php(135): Knp\Snappy\AbstractGenerator->checkOutput('C:\\Windows\\TEMP...', 'C:\\wkhtmltopdf\\...')
#1 C:\inetpub\wwwroot\www.XXXXXX.co.uk\classes\Knp\Snappy\Pdf.php(52): Knp\Snappy\AbstractGenerator->generate(Array, 'C:\\Windows\\TEMP...', Array, false)
#2 C:\inetpub\wwwroot\www.XXXXXX.co.uk\classes\Knp\Snappy\AbstractGenerator.php(166): Knp\Snappy\Pdf->generate(Array, 'C:\\Windows\\TEMP...', Array)
#3 C:\inetpub\wwwroot\www.XXXXXX.co.uk\classes\Knp\Snappy\AbstractGenerator.php(189): Knp\Snappy\AbstractGenerator->getO in C:\inetpub\wwwroot\www.XXXXXX.co.uk\classes\Knp\Snappy\AbstractGenerator.php on line 300
Usage:
require_once '/classes/autoload.php';
use Knp\Snappy\Pdf;
$snappy = new Pdf('C:\wkhtmltopdf\bin\wkhtmltopdf.exe');
//header('Content-Type: application/pdf');
//header('Content-Disposition: attachment; filename="file.pdf"');
echo $snappy->getOutputFromHtml($Document);
As you can see, the command being generated is fine:
If we run this command manually in CMD, the pdf is created perfectly.
When ran from PHP I can confirm that knp_snappy54637e792da033.68527031.html is being created on disk (C:\Windows\TEMP), the ACCESS_DENIED is then occuring immedietly after.
We ran sysinternals procmon to prove this:
How can we get round this without giving waaaay too much windows access to the Application Pool? Does Snappy support the changing of the temp folder? i.e. we'd much prefer to change the location where the temporary html & pdf files are being created to a specific folder to which the application pool can have controlled access rights?
Also, when the php script can create the html file in the first place, why is it getting access denied when trying to create the pdf? Has anyone managed to get this working on IIS?
The text was updated successfully, but these errors were encountered:
I got the same issue today. IMO it can be related to two things:
an issue to access to the temporary folder (for that you can update the sys_temp_dir of you php.ini or also define your own temporary folder with $pdf->setTemporaryFolder("C:\AnotherPath");.
ACCESS_DENIED is occurring because IIS does not have permission to run C:\wkhtmltopdf\bin\wkhtmltopdf.exe. Give execute permissions to IUSR and IIS_IUSRS on wkhtmltopdf.exe and the Access Denied error should go away.
Hi there
When calling getOutputFromHtml() we're seeing the following errors on IIS8:
Usage:
As you can see, the command being generated is fine:
If we run this command manually in CMD, the pdf is created perfectly.
When ran from PHP I can confirm that knp_snappy54637e792da033.68527031.html is being created on disk (C:\Windows\TEMP), the ACCESS_DENIED is then occuring immedietly after.
We ran sysinternals procmon to prove this:
How can we get round this without giving waaaay too much windows access to the Application Pool? Does Snappy support the changing of the temp folder? i.e. we'd much prefer to change the location where the temporary html & pdf files are being created to a specific folder to which the application pool can have controlled access rights?
Also, when the php script can create the html file in the first place, why is it getting access denied when trying to create the pdf? Has anyone managed to get this working on IIS?
The text was updated successfully, but these errors were encountered: