wkhtmltopdf

wicked_pdf does not run on Ubuntu server : wkhtmltopdf: cannot connect to X server

随声附和 提交于 2019-12-20 09:04:02
问题 I'm trying to use wicked_pdf on my prod server but it keeps failling : RuntimeError (Failed to execute: "/usr/bin/wkhtmltopdf" -q "file:////tmp/wicked_pdf20130709-23109-1adqx5g.html" "/tmp/wicked_pdf_generated_file20130709-23109-1ic5dbe.pdf" Error: PDF could not be generated! Command Error: wkhtmltopdf: cannot connect to X server ): app/controllers/contrats_controller.rb:15:in `block (2 levels) in show' app/controllers/contrats_controller.rb:11:in `show' I tried to follow this answer :

PDF Generation hangs using PDFKit and wkhtmotopdf

故事扮演 提交于 2019-12-20 07:35:04
问题 I'm on OSX Lion using wkhtmtopdf that came with homebrew (0.9.9) and all of the sudden I cannot generate PDFs anymore. When I tack .pdf on the end of a URL, the wkhtmltopdf process fires up, but the process never completes. I suspect it's an issue with wkhtmltopdf because the process is not completing when I run it via the cli either. When I issue the following command, I get a test.pdf file, but the process never finishes, even though it says "done". Is there something I can do to force the

WKHTMLTOPDF — Is possible to display dynamic headers?

淺唱寂寞╮ 提交于 2019-12-20 04:19:00
问题 Im using wkhtmltopdf --header-html option, but it seems, that it really works only with html code. Is there any way I can add some PHP and force it to working somehow? I need to display Date and user´s e-mail on every page... Thanks for any advice ;) 回答1: You can feed --header-html almost anything :) Try the following to see my point: wkhtmltopdf.exe --margin-top 30mm --header-html isitchristmas.com google.fi x.pdf So isitchristmas.com could be www.yoursite.com/magical/ponies.php Just to add,

How can I get wkhtmltopdf to display th and td background gradients?

与世无争的帅哥 提交于 2019-12-19 19:07:31
问题 I need to add background gradients to some td and th elements in page which gets converted to PDF, however I'm getting some very strange behavior from wkhtmltopdf, so when I do this: table { width: 100%; border-collapse: collapse; } th { height: 60px; border: 1px solid Black; } td { height: 100px; background: -webkit-linear-gradient(top, #ccc 0%, #888 100%); border: 1px solid Black; } <table> <tr> <th></th> </tr> <tr> <td></td> </tr> <tr> <td></td> </tr> </table> The height of the th seems to

Linux permissions issue when executing wkhtmltopdf-amd64

旧街凉风 提交于 2019-12-19 16:51:51
问题 When I run the executable "wkhtmltopdf-amd64" (from Linux), I get the following output: QPainter::begin(): Returned false============================] 100% Error: Unable to write to destination Exit with code 1 due to http error: 403 Forbidden I have seen in other forums that this is due to lack of permissions to write the temporary file. Which directory do I need to make writable in order to allow "wkhtmltopdf-amd64" to create the temporary file? 回答1: make sure you have access to the

wicked_pdf font size too large in production

雨燕双飞 提交于 2019-12-19 10:12:32
问题 I am experiencing an issue where the font sizing for rendered PDFs is larger in production . Everything looks great on the PDF generated in development. Here is the rendering from development : Here is the rendering from production : This is making it very difficult for me to format my document for the production server in development. Can you please take a look? HTML Version: http://www.hearingtracker.com/tickets/170 PDF Download: http://www.hearingtracker.com/tickets/170.pdf Here is my

How to use UTF-8 in PDFKit in Rails?

点点圈 提交于 2019-12-19 07:52:47
问题 I'm using PDFKit in my Rails app to generate PDF's. Problem is some of my content in contains non-ascii characters. How do I force it to use UTF-8? 回答1: Fixed by adding this to in the html head: <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> 回答2: You can write in PDFKIT configration. PDFKit.configure do |config| config.wkhtmltopdf = '/opt/wkhtmltopdf' config.default_options = { :encoding => 'UTF-8' :page_size => 'Letter', :margin_top => '0.3in', :margin_bottom => '0.1in

How to use UTF-8 in PDFKit in Rails?

无人久伴 提交于 2019-12-19 07:50:06
问题 I'm using PDFKit in my Rails app to generate PDF's. Problem is some of my content in contains non-ascii characters. How do I force it to use UTF-8? 回答1: Fixed by adding this to in the html head: <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> 回答2: You can write in PDFKIT configration. PDFKit.configure do |config| config.wkhtmltopdf = '/opt/wkhtmltopdf' config.default_options = { :encoding => 'UTF-8' :page_size => 'Letter', :margin_top => '0.3in', :margin_bottom => '0.1in

Executing wkhtmltopdf from PHP fails

假如想象 提交于 2019-12-19 06:57:31
问题 There have been a few topics similar to mine, but they did not help me. Maybe something new will come up. Problem: I can't execute wkhtmltopdf form PHP. My basic code is: exec('wkhtmltopdf http://somesite.com /home/user/file.pdf'); Now a few things I already checked: the same command works when executed from console safe_mode is disabled - I can execute commands in PHP, for example exec('ls'); works fine path to wkhtmltopdf can be found and I can run the program itself, for example exec(

Launching wkhtmltopdf from Runtime.getRuntime().exec(): never terminates?

五迷三道 提交于 2019-12-19 06:17:07
问题 I'm launching wkhtmltopdf from within my Java app (part of a Tomcat server, running in debug mode within Eclipse Helios on Win7 64-bit): I'd like to wait for it to complete, then Do More Stuff. String cmd[] = {"wkhtmltopdf", htmlPathIn, pdfPathOut}; Process proc = Runtime.getRuntime().exec( cmd, null ); proc.waitFor(); But waitFor() never returns. I can still see the process in the Windows Task Manager (with the command line I passed to exec(): looks fine). AND IT WORKS. wkhtmltopdf produces