Reputation: 642
wkhtmltopdf is an open source (LGPLv3) command line tools to render HTML into PDF. You can find more information about wkhtmltopdf from here
wkhtmltopdf is not working if input file name has special characters.
Let me put an example to clear the scienerio
Below code is working fine
shell_exec('wkhtmltopdf http://example.com/docs/Export_import_data_masters.html test.pdf');
But below code is not working if url have brackets in file name
shell_exec('wkhtmltopdf http://example.com/docs/Export_(import_data)_masters.html test.pdf');
It fails to create pdf from url if url has special characters in the file name.
Hope i am able to clear the question.
NOTE: File Link is provided by the third party so i can't change the file name or file path.
Upvotes: 1
Views: 1648
Reputation: 42885
There are two issues here:
The second URL is actually invalid. You remember the saying? "Garbage in, garbage out"? Brackets are not amongst the characters allowed in URLs, you have to escape them to form a valid URL:
http://example.com/docs/Export_%28import_data%29_masters.html
You have to consider that a command you execute in such manner will be interpreted by the shell that is invoked by the exec()
call. Shells interpret the input they process, especially control characters. So you might have to put quote chars around a URL argument or escape some characters to make things work.
Upvotes: 2