【发布时间】:2014-03-14 22:21:42
【问题描述】:
我已在我的应用程序中成功安装了 pdfkit。传递的任何给定 html 的输出 pdf 文件都有一些我不需要的额外页面。第 2 页是我在当前项目的 html 文件中需要的唯一相关页面。以下配置块无法正常工作 page_offset。还有一种方法可以设置结束页面;就我而言,我会在第 2 页偏移并结束。
kit = PDFKit.new(File.new("#{@LOCAL_HTML_DIR}/#{html}.html"))
PDFKit.configure { |config| config.default_options = { :page_size => 'Letter', :margin_top => '0.5in', :margin_right => '0.5in', :margin_bottom => '0.7in', :margin_left => '0.5in', :zoom => 2, :page_offset => 2 }}
file = kit.to_file("#{@LOCAL_HTML_DIR}/#{html}.pdf")
【问题讨论】:
标签: ruby pdf-generation wkhtmltopdf pdfkit