Tag: wkhtmltopdf

wicked_pdf:是否可以只在第一页显示标题,仅在最后一页显示页脚?

现在我有:header => {:html => {:template => “layouts/pdf_header.html.erb”}}设置。 有什么我可以传递,只会在文档的第一页显示标题? 我也可以为页脚做这个吗? 这里几乎更重要,因为我不能真正想到任何其他方式让页脚动态地粘贴在页面底部,而每次都会有不同的长度和不同的页面数。

使用PDFkit gem生成pdf在rails 4上挂起

我可以下载pdf文件: curl google.com | wkhtmltopdf – test.pdf 所以这意味着,wkhtmlpdf安装成功了。 但是,当我尝试通过访问http://localhost:3000/contacts/1.pdf生成pdf文件时,它会挂起。 在状态栏中显示: Waiting for localhost… Rails服务器输出: Started GET “/contacts/1.pdf” for 127.0.0.1 at 2013-07-28 21:45:06 +0900 ActiveRecord::SchemaMigration Load (0.1ms) SELECT “schema_migrations”.* FROM “schema_migrations” Processing by ContactsController#show as HTML Parameters: {“id”=>”1”} Contact Load (0.3ms) SELECT “contacts”.* FROM “contacts” WHERE “contacts”.”id” = ? LIMIT 1 [[“id”, “1”]] Rendered contacts/show.html.erb within […]

rails 3和PDFkit

我正在尝试按照本教程 。 当我将.pdf添加到我的url时,它什么也没做。 我的控制器有: respond_to :html, :pdf. 我的mime类型已经宣布。 我也试过这个: respond_to do |format| format.html format.pdf { html = render_to_string(:layout => false , :action => “www.google.fr”) kit = PDFKit.new(html) send_data(kit.to_pdf, :filename => “candidats.pdf”, :type => ‘application/pdf’) return # to avoid double render call } end 但它不起作用,我不会得到错误。 我的浏览器一直在等localhost,但没有任何反应。 那么我应该如何尝试使用pdfkit? 编辑2: 根据我的rails的日志,rails成功地呈现HTML。 我在.log中看到这个,rails不会将它发送到webrick或我的浏览器。 我的浏览器一直在等待,等待,没有任何事情发生。 我这里只有一些小照片。 编辑3:我的webrick服务器似乎无法响应其他请求,一旦他开始获得我的url的.pdf版本,任何想法? 编辑4: 我使用rails 3.1,wkhtmltopdf […]

生成带有图像的pdf时,PDFkit会挂起

我想将网页呈现为PDF。 它使用单个图像,我已经读过你需要提供PDFkit的绝对URL才能使用图像,所以我的代码是: = image_tag image_url(user.avatar) 这在以HTML格式查看时有效,并且PDFkit能够生成删除了图像的PDF。 但是,在使用图像时,它会挂起,直到我杀死服务器。 我怎样才能让它发挥作用? 这是杀死服务器时的完整输出: 2013-12-04 13:53:36.576 wkhtmltopdf[27410:507] CoreText performance note: Client called CTFontCreateWithName() using name “Arial” and got font with PostScript name “ArialMT”. For best performance, only use PostScript names when calling this API. 2013-12-04 13:53:36.577 wkhtmltopdf[27410:507] CoreText performance note: Set a breakpoint on CTFontLogSuboptimalRequest to debug. 2013-12-04 13:53:36.582 wkhtmltopdf[27410:507] […]

PDF生成使用PDFKit和wkhtmotopdf挂起

我在OSX Lion上使用自制软件附带的wkhtmtopdf(0.9.9),突然之间我再也无法生成PDF了。 当我在URL的末尾添加.pdf时,wkhtmltopdf进程会启动,但该进程永远不会完成。 我怀疑这是wkhtmltopdf的问题,因为当我通过cli运行它时,该过程没有完成。 当我发出以下命令时,我得到一个test.pdf文件,但该过程永远不会完成,即使它说“完成”。 我能做些什么来强制完成这个过程吗? curl google.com | wkhtmltopdf – test.pdf % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 219 100 219 0 0 1685 0 –:–:– –:–:– –:–:– 5475 Loading page (1/2) Printing pages (2/2) Done

wkhtmltopdf RuntimeError(wkhtmltopdf的位置未知)

我正在使用Ubuntu 11.04在Ruby on Rails中开发应用程序。 在应用程序中,我需要生成pdf文档。 所以我使用的是wicked_pdf和wkhtmltopdf-binary gems。 在我的系统的开发环境中,一切正常。 但是一旦我使用Phusion Passenger在CentOS 5.6上部署应用程序,当我尝试动态生成pdf时,它会给我以下错误: RuntimeError(wkhtmltopdf的位置未知) 我使用的是Ruby1.9.2.p136 Rails 3.1.1 任何帮助将不胜感激….谢谢。