Rails 3 and PDFKit. How to specify page size?

前端 未结 3 1505
误落风尘
误落风尘 2021-01-06 18:36

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 look

3条回答
  •  醉酒成梦
    2021-01-06 19:02

    Pdkit accepts custom sizes:

      PDFKit.configure do |config|
        config.wkhtmltopdf = `which wkhtmltopdf`.strip
        config.default_options = {
              :page_width => '1682',
              :page_height => '2378'
          }
      end
    

    The sizes must be in milimeters (wkthmltopdf documentation).

提交回复
热议问题