Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Page Size in Wicked_PDF

Wicked_pdf docs show that I can use the following to change the page size:

render :pdf => 'file_name', :page_size => "b10"

However, this is limited to "named" page sizes such as "A4" or "Letter". I would like to use wkhtmltopdf's page_height and page_width properties, but the following appears to have no effect in wicked_pdf:

render :pdf => 'file_name', :page_height => 1, :page_width => 1

Is there a way to declare custom PDF page size in wicked_pdf?

like image 774
Lee Quarella Avatar asked Oct 24 '11 18:10

Lee Quarella


1 Answers

Looking at the wkhtmltopdf documentation it looks like you'll need to specify a unit of measurement for custom page sizes, eg:

render :pdf => 'file_name', :page_height => '5in', :page_width => '7in'

This was merged into the trunk of wkhtmltopdf in Dec 2009, so you'll want to make sure you have a fairly new version of the binary (0.9.9 or higher should be fine) if it still doesn't work.

like image 105
codatory Avatar answered Nov 04 '22 17:11

codatory