Rails 3 and PDFKit. How to specify page size?

前端 未结 3 1511
误落风尘
误落风尘 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 18:43

    Since it's using wkhtmltopdf to generate the PDFs I'm assuming you can use the same options that it supports. In a wkhtmltopdf manual I found, it mentions the following site for a list of sizes:

    http://doc.trolltech.com/4.6/qprinter.html#PaperSize-enum

    To set the page size, you can use the :page_size option like so:

    PDFKit.new(html, :page_size => 'Letter')
    

提交回复
热议问题