KnpLabs / snappy

PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage
https://knplabs.com
MIT License
4.4k stars 436 forks source link

The output file scheme is not supported #489

Closed YellowPhoenix18 closed 1 year ago

YellowPhoenix18 commented 1 year ago

When use knp-snappy under windows you get a issue with the scheme when using getOutputFromHtml since Version 1.4.3. In the background the parse_url parses the drive-letter as scheme, resulting in "c" as scheme and a error with "The output file scheme is not supported. Expected '' or 'file' but got 'c'."

alexpozzi commented 1 year ago

Hello, I'm gonna work on a fix soon, in the meantime, you should use file:///c:\\your\\path\\... instead. The fix will be available in the next Snappy release.

YellowPhoenix18 commented 1 year ago

Yeah, basically I would agree, the issue is, that getOutputHtml creates temp files automatically and these files are the issue. So the fix must be in the code itself. I see no option to fix this issue myself, as I cant change the scheme of the temp files.

alexpozzi commented 1 year ago

True, I didn't think about that case. I'm afraid that your only option, at the moment, is to temporarily revert to 1.4.2.

YellowPhoenix18 commented 1 year ago

No worries. The issue is as far as I can see only under windows, as only windows is adding in the drive-letter. I tested the same code yesterday with 1.4.3 on Linux and there it was working fine, as a schema with no content is also allowed by your code.

For now I just uncommented the check-line in my local vendor-folder on windows, as this is only my dev-machine.

xicond commented 1 year ago

Unfortunately file:/// is not working in the executable wkhtmltopdf