pdfkit

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

PDFkit doesn't display pictures in PDF

别来无恙 提交于 2019-12-19 17:37:55
问题 Rails 2, PDFkit 0.5.0 Im generating a PDF from a View in Rails 2 with PDFkit and everything works fine. The only thing which doesn't work is displaying pictures in the pdf. When I look at the View in the Browser, the picture is there but its missing in the PDF. There is only a placeholder existing in the PDF. The image_tag is looking like this: <%= image_tag('plus.gif') %> I also tried to realize it with a css-file but it doesn't work either. Any ideas? 回答1: Because of the way that

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

Rails 3 and PDFKit. How to specify page size?

蹲街弑〆低调 提交于 2019-12-19 04:04:48
问题 I have been looking in the documentation but can't find the answer. How can I specify the page size of my pdf document and what are the available page sizes? I keep on looking and looking but I can't find good documentation. Please point me to a URL or let me know how can I code some page size into my PDF document. Oh and I don't want to do that on any config file because I need to generate PDf documents of different sizes. NOT in config file... PDFKit.configure do |config| config.wkhtmltopdf

Navigating Text box on a pdf is not working any more after iOS 13 - seems gestures issue using PDFKIT

天涯浪子 提交于 2019-12-18 09:24:34
问题 I implemented a project I used PDFKIT to do some how adding a floating Textbox on a pdf and it can navigate by users touch on screen using GestureRecognizer to move and put where users decide to. it has worked perfectly before iOS 13, but after it, it does not give you the chance to move the text box and I tried many ways to solve it but all failed. It seems that the problem somehow relates to GestureRecognizer but I am not sure, and also I really do not know how to fix it. I was working on

Extracting Additional Metadata from a PDF using iTextSharp

老子叫甜甜 提交于 2019-12-18 05:21:30
问题 I've seen the extraction of basic metadata (ie. author, title) using iTextSharp and it usually looks something like this: var pdfReader = new PdfReader(pdfData); var author = pdfReader.Info["author"] However, in my case I'm after something a bit more exotic, the additional "advanced" metadata that the document may contain. Pardon the paint highlights, but here is a screenshot from within Adobe Acrobat showing the data in question: In this case, it doesn't seem like this data is available

pdfkit does not style pdfs

痞子三分冷 提交于 2019-12-17 22:39:41
问题 I have a rails 3.1 app that creates pdf documents using pdfkit, and everything works as specified, except for the fact that the generated pdfs don't have any styling. I am assuming that wkhtmltopdf doesn't have access to my stylesheets and that it is not a larger issue than that. Would anyone have a clue as to how you would allow access to these stylesheets? I have basically followed railscast #220 on the subject, however I have had to create a new initializer to get pdfkit to work with rails

Why does PDFKit/wkhtmltopdf hang but renders PDF as expected when Rails app is killed?

六眼飞鱼酱① 提交于 2019-12-17 15:27:58
问题 Background After reading around it seemed to me that Prawn is out and wkhtmltopdf is in. It also seems like the PDFKit and wicked_pdf gems for Rails are the new cool. So I found a screencast by Ryan on how to use PDFKit. I installed everything, tested wkhtmltopdf on the CLI with no problems, fiddled around with Rails settingsto run multiple processes so the asset pipeline works, and all seemed good, except I'm still stuck at the very end of the process (actually getting the PDF response from