php - wkhtmltopdf not converting html to pdf -


wkhtmltopdf open source (lgplv3) command line tools render html pdf. can find more information wkhtmltopdf here

wkhtmltopdf not working if input file name has special characters.

let me put example clear scienerio

below code working fine

shell_exec('wkhtmltopdf http://example.com/docs/export_import_data_masters.html test.pdf'); 

but below code 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 create pdf url if url has special characters in file name.

hope able clear question.

note: file link provided third party can't change file name or file path.

there 2 issues here:

  1. the second url invalid. remember saying? "garbage in, garbage out"? brackets not amongst characters allowed in urls, have escape them form valid url:

    http://example.com/docs/export_%28import_data%29_masters.html

  2. you have consider command execute in such manner interpreted shell invoked exec() call. shells interpret input process, control characters. might have put quote chars around url argument or escape characters make things work.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -