html - WkHTMLtoPDF not loading local CSS and images -


i've seen multiple questions similar one, hesitant @ first post it. nothing suggested resolved issue , can't seem figure out what's wrong myself.

for project made 1 client wanted ability convert quotes customers (generated using online form) pdfs. simple enough. entire project in php, used following simple process:

  1. save quote temporary html file
  2. use wkhtmltopdf convert html file pdf
  3. output pdf file
  4. clean (delete temporary files)

this worked until changed servers. new server has firewall.

at first pdf conversion step returning firewall page saying server couldn't make outbound connections. resolve fed html file directly instead of linking (/var/www/mysite/temp/18382.html instead of www.example.com/temp/18382.html). converted html, firewall prevented loading of css , images

i can overcome css embedding directly in site instead of linking (using <style> tags), doesn't work images

i tried using relative links first. changed <img src="http://www.example.com/temp/image.jpg" /> <img src="./image.jpg" />. didn't work.

next tried <img src="file:///var/www/mysite/temp/image.jpg" /> didn't work, either

i read around , through wkhtmltopdf manual , tried several different command line arguments --enable-local-file-access, --enable /var/www/mysite/temp/, , --images nothing seems fix it

if on linux check ownership of images. windows find info on http://code.google.com/p/wkhtmltopdf/wiki/usage.

i tried different kind of paths image:

  1. <img src="file:///var/www/testpdf/flowers.jpg"><br>
  2. <img src="./flowers.jpg"><br>
  3. <img src="flowers.jpg"><br>
  4. <img src="/var/www/testpdf/flowers.jpg"><br>

all images showed correct. didn't use command line arguments (only wkhtmltopdf /var/www/testpdf/makepdf.html makepdf.pdf)


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -