Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top