Skip to content

Paper and Page Layout

shairontoledo edited this page Sep 13, 2010 · 4 revisions

Paper is the area where the Postscript elements/objects are drawn. The margin is the document’s non-printable area (both by the cursors and by the page’s internal controllers). The :area_x and :area_y are the printable section of the paper.

The nouns come before the adjectives as in CSS, like this: margin-top, margin-top, etc.
You can specify an equal margin on all sides, like this:

doc=Document.new :paper :A5, :margin => 1

Defining custom margins
doc=Document.new :paper => :A5, :margin => [0.5, 1, 0.5, 2] #=>[top,right,bottom,left] 

Or specify individually as in the example below:
doc=Document.new :paper => :A4, :margin_left => 3

To use a landscape orientation just pass true to the :landscape option. Example:
doc=Document.new :paper => :A4, :landscape => true

The same goes for duplex printing:
doc=Document.new :paper => :letter, :duplex => true, :tumble => false

More info on preset paper sizes or Paper sizes known to Ghostscript

Custom Paper

Just pass the size as an array (width x height) and it will be sent to GS.

doc=Document.new :paper => [15,10]