At the moment, I'm trying to trace where this issue arose from given that nothing major was changed.
But at the moment I currently use laravel-snappy to generate pdfs, I haven't had an issue until now when I am all of a sudden receiving the following errors:
The file 'C:\Users\ADMINI~1\AppData\Local\Temp\knp_snappy5a7d3011c11883.41249127.pdf' was not created (command: "C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf" --lowquality --images --enable-javascript --javascript-delay "10" "C:\Users\ADMINI~1\AppData\Local\Temp\knp_snappy5a7d3011b9a179.91650543.html" "C:\Users\ADMINI~1\AppData\Local\Temp\knp_snappy5a7d3011c11883.41249127.pdf").
Unfortunately, it doesn't tell me why it wasn't created. At this point in time, the error handler points to this specific line where it is returning this error:
if (!$this->fileExists($output)) {
throw new \RuntimeException(sprintf(
'The file \'%s\' was not created (command: %s).',
$output, $command
));
}
This line comes from this file: vendor\knplabs\knp-snappy\src\Knp\Snappy\AbstractGenerator.php
My wkhtmltopdf binary is located in the correct place, and nothing has changed in response to the setup of these files. And yes, at the moment these files are hosted and served on a Windows Server platform.
My config for the snappy:
<?php
return array(
'pdf' => array(
'enabled' => true,
'binary' => '"C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf"',
'timeout' => false,
'options' => array(),
'env' => array(),
),
'image' => array(
'enabled' => true,
'binary' => '"C:\Program Files\wkhtmltopdf\bin\wkhtmltoimage"',
'timeout' => false,
'options' => array(),
'env' => array(),
),
);
My files are being generated as such through my controller:
public function downloadPDF(Shipment $shipment) {
$shipment_details = $shipment->shipment_details;
$shipment->print_date = Carbon::now();
$shipment->save();
$pdf = PDF::loadView('shipments.pdf', compact('shipment','shipment_details'))
->setOption('images', true)
->setOption('enable-javascript', true)
->setOption('javascript-delay', 10);
return $pdf->download('shipment'.$shipment->uuid.'.pdf');
$shipment->print_date = Carbon::now();
$shipment->save();
}