Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 如何在pdfkit中配置页偏移和结束_Ruby_Pdf Generation_Wkhtmltopdf_Pdfkit - Fatal编程技术网

Ruby 如何在pdfkit中配置页偏移和结束

Ruby 如何在pdfkit中配置页偏移和结束,ruby,pdf-generation,wkhtmltopdf,pdfkit,Ruby,Pdf Generation,Wkhtmltopdf,Pdfkit,我已在我的应用程序中成功安装了pdfkit。传递的任何给定html的输出pdf文件都有一些我不需要的额外页面。第2页是我从当前项目的html文件中需要的唯一相关页面。下面的配置块对于页偏移量没有正常工作。还有一种方法可以设置结束页面;在我的例子中,我将在第2页上偏移并结束 kit = PDFKit.new(File.new("#{@LOCAL_HTML_DIR}/#{html}.html")) PDFKit.configure { |config| config.defaul

我已在我的应用程序中成功安装了pdfkit。传递的任何给定html的输出pdf文件都有一些我不需要的额外页面。第2页是我从当前项目的html文件中需要的唯一相关页面。下面的配置块对于页偏移量没有正常工作。还有一种方法可以设置结束页面;在我的例子中,我将在第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")

我认为页码偏移量应该是数字,而不是字符串:

:页码偏移量=>2

而不是


:page_offset=>“2”

我最初试过,但仍然不起作用;关于结束选项有什么想法吗?pdfkit和wkhtmltopdf是否分别支持结束页面?page_offset对我来说很有用,wkhtmltopdf用QT修补。在wkhtmltopdf文档中,您使用的是二进制文件还是软件包(自制/rpm/等?),请注意,页面偏移量“仅可使用修补的QT()。”wkhtmltopdf--版本名称:wkhtmltopdf 0.9.9