Install of wkhtmltopdf

Hey Guys,

I’ve tried to install wkhtmltopdf, so i would be able to send sales orders etc in pdf’s.

However im facing some troubles.

If i use wkhtmltopdf straight from as a cli command it works, but when trying from erpnext i face the following error.

can someone help me out?


					</div>
			

<pre>Traceback (innermost last):

File “/home/ulrik/frappe-bench/apps/frappe/frappe/app.py”, line 52, in application
response = frappe.api.handle()
File “/home/ulrik/frappe-bench/apps/frappe/frappe/api.py”, line 42, in handle
return frappe.handler.handle()
File “/home/ulrik/frappe-bench/apps/frappe/frappe/handler.py”, line 66, in handle
execute_cmd(cmd)
File “/home/ulrik/frappe-bench/apps/frappe/frappe/handler.py”, line 89, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/ulrik/frappe-bench/apps/frappe/frappe/init.py”, line 526, in call
return fn(*args, **newargs)
File “/home/ulrik/frappe-bench/apps/frappe/frappe/templates/pages/print.py”, line 93, in download_pdf
frappe.local.response.filecontent = get_pdf(html)
File “/home/ulrik/frappe-bench/apps/frappe/frappe/utils/pdf.py”, line 28, in get_pdf
pdfkit.from_string(html, fname, options=options or {})
File “/home/ulrik/frappe-bench/env/local/lib/python2.7/site-packages/pdfkit/api.py”, line 68, in from_string
return r.to_pdf(output_path)
File “/home/ulrik/frappe-bench/env/local/lib/python2.7/site-packages/pdfkit/pdfkit.py”, line 131, in to_pdf
’ '.join(args))
IOError: Command failed: /usr/bin/wkhtmltopdf --margin-top 15mm --margin-right 15mm --page-size A4 --encoding UTF-8 --background --print-media-type --images --margin-left 15mm --no-outline --margin-bottom 15mm - /tmp/d7186958919ad48ba14b96722d0f2378c8dbff211862a8dc3689cf5a.pdf
Check whhtmltopdf output without ‘quiet’ option



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/c691154b-95a0-484a-b2ca-0bdb697a1197%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
Hi Ulrik,

Go to the record you are trying to print, click on “Preview” from print view, and save the file as HTML.

Then, try running this exact command, with source file as the html file:
/usr/bin/wkhtmltopdf --margin-top 15mm --margin-right 15mm --page-size A4 --encoding UTF-8 --background --print-media-type --images --margin-left 15mm --no-outline --margin-bottom 15mm /path/to/{{ SOURCE FILE }} /tmp/{{ TARGET FILE }}.pdf

-Anand.

On 15-Aug-2014, at 5:03 pm, Ulrik Tuemand <u....@gmail.com> wrote:

/usr/bin/wkhtmltopdf --margin-top 15mm --margin-right 15mm --page-size A4 --encoding UTF-8 --background --print-media-type --images --margin-left 15mm --no-outline --margin-bottom 15mm - /tmp/d7186958919ad48ba14b96722d0f2378c8dbff211862a8dc3689cf5a.pdf



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/B001CC3D-D6C4-46DD-919A-F19D783149DE%40erpnext.com.

    For more options, visit https://groups.google.com/d/optout.
Just to add my experience. 
Installing wkhtmltopdf using apt-get is outdated and does not support everything that frappe needs. I think you should download a .deb from their website and manually install it.
On Friday, 15 August 2014 12:33:53 UTC+1, Ulrik Tuemand wrote:
Hey Guys,

I've tried to install wkhtmltopdf, so i would be able to send sales orders etc in pdf's.

However im facing some troubles.

If i use wkhtmltopdf straight from as a cli command it works, but when trying from erpnext i face the following error.

can someone help me out?

					</div>
			

<pre>Traceback (innermost last):

File “/home/ulrik/frappe-bench/apps/frappe/frappe/app.py”, line 52, in application
response = frappe.api.handle()
File “/home/ulrik/frappe-bench/apps/frappe/frappe/api.py”, line 42, in handle
return frappe.handler.handle()
File “/home/ulrik/frappe-bench/apps/frappe/frappe/handler.py”, line 66, in handle
execute_cmd(cmd)
File “/home/ulrik/frappe-bench/apps/frappe/frappe/handler.py”, line 89, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/ulrik/frappe-bench/apps/frappe/frappe/init.py”, line 526, in call
return fn(*args, **newargs)
File “/home/ulrik/frappe-bench/apps/frappe/frappe/templates/pages/print.py”, line 93, in download_pdf
frappe.local.response.filecontent = get_pdf(html)
File “/home/ulrik/frappe-bench/apps/frappe/frappe/utils/pdf.py”, line 28, in get_pdf
pdfkit.from_string(html, fname, options=options or {})
File “/home/ulrik/frappe-bench/env/local/lib/python2.7/site-packages/pdfkit/api.py”, line 68, in from_string
return r.to_pdf(output_path)
File “/home/ulrik/frappe-bench/env/local/lib/python2.7/site-packages/pdfkit/pdfkit.py”, line 131, in to_pdf
’ '.join(args))
IOError: Command failed: /usr/bin/wkhtmltopdf --margin-top 15mm --margin-right 15mm --page-size A4 --encoding UTF-8 --background --print-media-type --images --margin-left 15mm --no-outline --margin-bottom 15mm - /tmp/d7186958919ad48ba14b96722d0f2378c8dbff211862a8dc3689cf5a.pdf
Check whhtmltopdf output without ‘quiet’ option



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f0ac94d1-e6ee-4c9c-aa4c-42d015197729%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
Hi Dhaifallah,

Thanks for the heads up! I've updated the readme.md: https://github.com/frappe/bench/blob/master/README.md#manual-install


@Pratik. Debian/Ubuntu has missing wkhtmltopdf installation in setup_frappe.sh.

-Anand.


On Sat, Aug 16, 2014 at 11:34 PM, Dhaifallah Alwadani <da…@gmail.com> wrote:
Just to add my experience.
Installing wkhtmltopdf using apt-get is outdated and does not support everything that frappe needs. I think you should download a .deb from their website and manually install it.

On Friday, 15 August 2014 12:33:53 UTC+1, Ulrik Tuemand wrote:
Hey Guys,

I've tried to install wkhtmltopdf, so i would be able to send sales orders etc in pdf's.


However im facing some troubles.

If i use wkhtmltopdf straight from as a cli command it works, but when trying from erpnext i face the following error.

can someone help me out?


					</div>
			

<pre>Traceback (innermost last):

File “/home/ulrik/frappe-bench/apps/frappe/frappe/app.py”, line 52, in application
response = frappe.api.handle()
File “/home/ulrik/frappe-bench/apps/frappe/frappe/api.py”, line 42, in handle
return frappe.handler.handle()
File “/home/ulrik/frappe-bench/apps/frappe/frappe/handler.py”, line 66, in handle
execute_cmd(cmd)
File “/home/ulrik/frappe-bench/apps/frappe/frappe/handler.py”, line 89, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/ulrik/frappe-bench/apps/frappe/frappe/init.py”, line 526, in call
return fn(*args, **newargs)
File “/home/ulrik/frappe-bench/apps/frappe/frappe/templates/pages/print.py”, line 93, in download_pdf
frappe.local.response.filecontent = get_pdf(html)
File “/home/ulrik/frappe-bench/apps/frappe/frappe/utils/pdf.py”, line 28, in get_pdf
pdfkit.from_string(html, fname, options=options or {})
File “/home/ulrik/frappe-bench/env/local/lib/python2.7/site-packages/pdfkit/api.py”, line 68, in from_string
return r.to_pdf(output_path)
File “/home/ulrik/frappe-bench/env/local/lib/python2.7/site-packages/pdfkit/pdfkit.py”, line 131, in to_pdf
’ '.join(args))
IOError: Command failed: /usr/bin/wkhtmltopdf --margin-top 15mm --margin-right 15mm --page-size A4 --encoding UTF-8 --background --print-media-type --images --margin-left 15mm --no-outline --margin-bottom 15mm - /tmp/d7186958919ad48ba14b96722d0f2378c8dbff211862a8dc3689cf5a.pdf
Check whhtmltopdf output without ‘quiet’ option



Note:



If you are posting an issue,


  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.

  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.

  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email

  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f0ac94d1-e6ee-4c9c-aa4c-42d015197729%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



Note:

 

If you are posting an issue,

 

  1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
  2. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  4. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CAAQzbF1JHgv668aKoikdx2xb%3DKXamjtoO2BhC5K%3DnOm_wjQyWQ%40mail.gmail.com.

    For more options, visit https://groups.google.com/d/optout.