Custom Page Size in Wicked_PDF

The Wicked_pdf docs show that I can use the following to resize a page:

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 the wkhtmltopdf properties page_height and page_width , but the following value has no effect in wicked_pdf:

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

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

+6
source share
1 answer

Looking at the wkhtmltopdf documentation, it looks like you need to specify a unit for custom page sizes, for example:

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

This was merged into the trunk of wkhtmltopdf in December 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.

+16
source

Source: https://habr.com/ru/post/899983/


All Articles