Laravel-snappy: \knp_snappy5bb098d140e970.93058232.pdf' was not created

Created on 30 Sep 2018  Â·  9Comments  Â·  Source: barryvdh/laravel-snappy

i am facing this issue need help please Thnx.

inside composer file
"barryvdh/laravel-dompdf": "^0.8.3",
"barryvdh/laravel-snappy": "^0.4.3",
"h4cc/wkhtmltoimage-amd64": "^0.12.4",
"h4cc/wkhtmltopdf-amd64": "^0.12.4",
"wemersonjanuario/wkhtmltopdf-windows": "0.12.2.3"

snappy config file
return array(

'pdf' => array(
    'enabled' => true,
    'binary' => base_path('vendor\wemersonjanuario\wkhtmltopdf-windows\bin\64bit\wkhtmltopdf'),
    'timeout' => false,
    'options' => array(),
    'env'     => array(),
),
'image' => array(
    'enabled' => true,
    'binary'  => 'vendor\h4cc\wkhtmltoimage-amd64',
    'timeout' => false,
    'options' => array(),
    'env'     => array(),
),

);

Print Controller file

$pdf = PDF::loadView('results',['students'=>$students,'school' => $school,'subject'=>$subjects]);
return $pdf->download('result.pdf');

RuntimeException
The file 'C:\Users\Abhay\AppData\Local\Temp\knp_snappy5bb098d140e970.93058232.pdf' was not created (command: D:\Projects\ResultAssessment\vendor\wemersonjanuario\wkhtmltopdf-windows\bin\64bit\wkhtmltopdf --lowquality "C:\Users\Abhay\AppData\Local\Temp\knp_snappy5bb098d13f12f7.97723818.html" "C:\Users\Abhay\AppData\Local\Temp\knp_snappy5bb098d140e970.93058232.pdf").

stale

All 9 comments

I am facing the same issue but I am on Ubuntu 18.04.

@AbhayLodhi Have you tried to just output pdf?

I noticed that I can output pdf or even manually save but when I try to call ->save(...) then it throws the exception.

When I run the command manually for example:

wkhtmltopdf 'tmp/knp_snappyXXXXXXXXXXXX.html' 'test.pdf'

I get following error:

Loading pages (1/6) Error: Failed loading page http://tmp/knp_snappyXXXXXXXXXXXX.html (sometimes it will work just to ignore this error with --load-error-handling ignore) Exit with code 1 due to network error: HostNotFoundError

I see it tries to access tmp/knp_snappyXXXXXXXXXXXX.html as it is the URL instead of loading local file.

hi, i try but fail if you found any solution please let me know and if i
found something helpful then i inform you

On Fri, Oct 5, 2018 at 6:57 PM milivojsa notifications@github.com wrote:

I am facing the same issue but I am on Ubuntu 18.04.

@AbhayLodhi https://github.com/AbhayLodhi Have you tried to just output
pdf?

I noticed that I can output pdf or even manually save but when I try to
call ->save(...) then it throws the exception.

When I run the command manually for example:

wkhtmltopdf 'tmp/knp_snappyXXXXXXXXXXXX.html' 'test.pdf'

I get following error:

Loading pages (1/6) Error: Failed loading page
http://tmp/knp_snappyXXXXXXXXXXXX.html (sometimes it will work just to
ignore this error with --load-error-handling ignore) Exit with code 1 due
to network error: HostNotFoundError

I see it tries to access tmp/knp_snappyXXXXXXXXXXXX.html as it is the URL
instead of loading local file.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/barryvdh/laravel-snappy/issues/317#issuecomment-427365868,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIr31DJcQhapLjNlSxIAFemd7lcRjCCFks5uh15egaJpZM4XA5kQ
.

--
Thanks & Regards-

Abhay Kumar Verma

Lucknow Uttar Pradesh

E- [email protected] abhay.verma@mminnovate.com

Same problem here...

I can confirm the same problem

just try to comment line to binary in snappy config file:
pdf' => array(
'enabled' => true,
// 'binary' => base_path('vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64'),
'timeout' => false,
'options' => array(),
'env' => array(),
),

just try to comment line to binary in snappy config file:
pdf' => array(
'enabled' => true,
// 'binary' => base_path('vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64'),
'timeout' => false,
'options' => array(),
'env' => array(),
),

after doing this i get that error.
RuntimeException
The exit status code '1' says something went wrong: stderr: "The system cannot find the path specified. " stdout: "" command: /usr/local/bin/wkhtmltopdf --lowquality "C:\Users\Abhay\AppData\Local\Temp\knp_snappy5bdaa33d4be445.70437324.html" "C:\Users\Abhay\AppData\Local\Temp\knp_snappy5bdaa33d79a8b1.38742081.pdf".

In my case it helped, because finally I found out, that wkhtmltopdf is already installed on my hosting and I still was getting similar error message:
The file '/tmp/knp_snappy5bdb29ed73ec01.07065997.pdf' was not created (command: /nfsmnt/hosting2_1/f/c/fcc203d9-a9c0-45a7-aae7-99f0743dd350/my_web/my_app/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 --lowquality '/tmp/knp_snappy5bdb29ed73c7a0.60260250.html' '/tmp/knp_snappy5bdb29ed73ec01.07065997.pdf').

When I have commented line in snapy config file as described in my previous post, export to pdf started to work OK.
I also wanted to know, where is wkhtmltopdf installed on my hosting so I tried to run command on my hosting:
/home/my_web/my_app$ whereis wkhtmltopdf
wkhtmltopdf: /usr/bin/wkhtmltopdf

So as you see, wkhtmltopdg was already installed in "/usr/bin/wkhtmltopdf"

Still facing this issue on Windows enviroment. I tried different approaches, but nothing works.
What I have done:

  • testing command from laravel in cmd = working
  • changed binary path many times = not working

I disabled removing temporary files in Abstract class -> php code generated temporary html file, so I hardcoded source file into load file. From cmd, everything is working properly, but not from PHP.

I also tried update access rights and set "Full control" to necessary folders, but nothing changed. Package is using fromShellCommandline() from Symfony. Then I tried to hardcode command, but again, no luck. Wkhtmltopdf is included in path enviroment vaue, but running command through shell_exec() is also not working.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/KnpLabs/snappy instead. When having doubts, please try to reproduce the issue with just snappy.
If you believe this is an actual issue with the latest version of laravel-snappy, please reply to this issue so we can investigate further.
Thank you for your contribution! Apologies for any delayed response on our side.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  Â·  3Comments

zhuojiawei picture zhuojiawei  Â·  5Comments

vitorf7 picture vitorf7  Â·  6Comments

tbaraiya picture tbaraiya  Â·  3Comments

jerearaujo03 picture jerearaujo03  Â·  5Comments