PDF::Cairo::Util - utility functions


    use PDF::Cairo::Util;

    $points = cm(5);
    $points = in(8.5);
    $points = mm(300);
    ($width, $height) = paper_size('usletter');
    $hex = regular_polygon(6);



cm $centimeters

Converts the arguments from centimeters to points. Importable.

in $inches

Converts the arguments from inches to points. Importable.

mm $millimeters

Converts the arguments from millimeters to points. Importable.

paper_size %options
paper => $paper_size
wide|landscape => 1
tall|portrait => 1

Return size in points of a paper type. The default is "US Letter" (8.5x11 inches). The wide/tall options can be used to ensure that the orientation of the page is as expected. Importable.

The supported paper sizes are listed in PDF::Cairo::Papers.

regular_polygon $sides

Calculate the vertices of a regular polygon with $sides sides with radius 1, along with the relative lengths of the inradius and edge.

Returns a hashref:

      points => [ [$x0, $y0], ... ],
      edge => $edge_length,
      inradius => $inradius_length,
      radius => 1,

Calling the polygon($cx, $cy, $radius, $sides) method is equivalent to:

    $poly = regular_polygon($sides);
    @points = map(@$_, @{$poly->{points}});
    $pdf->translate($cx, $cy);


Gosh, none I hope.


J Greely, <jgreely at>