Method: RBPDF#setPageUnit
- Defined in:
- lib/rbpdf.rb
#setPageUnit(unit) ⇒ Object Also known as: set_page_unit
Set the units of measure for the document.
- @param string :unit
-
User measure unit. Possible values are:
-
pt: point
-
mm: millimeter (default)
-
cm: centimeter
-
in: inch
A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This is a very common unit in typography; font sizes are expressed in that unit.
-
- @access public
- @since 3.0.015 (2008-06-06)
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 |
# File 'lib/rbpdf.rb', line 580 def setPageUnit(unit) unit = unit.downcase # Set scale factor case unit when 'px', 'pt'; @k=1.0 # points when 'mm'; @k = @dpi / 25.4 # millimeters when 'cm'; @k = @dpi / 2.54 # centimeters when 'in'; @k = @dpi # inches # unsupported unit else Error("Incorrect unit: #{unit}") end @pdfunit = unit unless @cur_orientation.nil? setPageOrientation(@cur_orientation) end end |