oracular (3) PDF::Builder::Lite.3pm.gz

Provided by: libpdf-builder-perl_3.026-1_all bug

NAME

       PDF::Builder::Lite - Lightweight PDF creation methods

SYNOPSIS

           $pdf = PDF::Builder::Lite->new();
           $pdf->page(595,842);
           $img = $pdf->image('some.jpg');
           $font = $pdf->corefont('Times-Roman');
           $font = $pdf->ttfont('TimesNewRoman.ttf');

DESCRIPTION

       This class is unmaintained (since 2007) and should not be used in new code. It combines many of the
       methods from PDF::Builder and PDF::Builder::Content into a single class but isn't really otherwise any
       easier to use.

       There have been many improvements and clarifications made to the rest of the distribution that aren't
       reflected here, so the term "Lite" no longer applies.  It remains solely for compatibility with existing
       legacy code.

METHODS

   new
           $pdf = PDF::Builder::Lite->new(%opts)

           $pdf = PDF::Builder::Lite->new()

   page
           $pdf->page()

           $pdf->page($width,$height)

           $pdf->page($llx,$lly, $urx,$ury)

           Opens a new page.

   mediabox
           $pdf->mediabox($w,$h)

           $pdf->mediabox($llx,$lly, $urx,$ury)

           Sets the global mediabox.

   saveas
           $pdf->saveas($file)

           Saves the document (may not be modified later) and deallocates the PDF structures.

           If $file is just a hyphen '-', the stringified copy is returned, otherwise the file is saved, and
           $self is returned (for chaining calls).

   corefont
           $font = $pdf->corefont($fontname)

           Returns a new or existing Adobe core font object.

           Examples:

               $font = $pdf->corefont('Times-Roman');
               $font = $pdf->corefont('Times-Bold');
               $font = $pdf->corefont('Helvetica');
               $font = $pdf->corefont('ZapfDingbats');

   ttfont
           $font = $pdf->ttfont($ttfile)

           Returns a new or existing TrueType font object.

           Examples:

               $font = $pdf->ttfont('TimesNewRoman.ttf');
               $font = $pdf->ttfont('/fonts/Univers-Bold.ttf');
               $font = $pdf->ttfont('../Democratica-SmallCaps.ttf');

   psfont
           $font = $pdf->psfont($ps_file, %options)

           $font = $pdf->psfont($ps_file)

           Returns a new Type1 (PS) font object.

           Examples:

               $font = $pdf->psfont('TimesRoman.pfa', 'afmfile' => 'TimesRoman.afm', 'encode' => 'latin1');
               $font = $pdf->psfont('/fonts/Univers.pfb', 'pfmfile' => '/fonts/Univers.pfm', 'encode' => 'latin2');

   create_egs
           $egs = $pdf->create_egs()

           Returns a new extended-graphics-state object.

           Examples:

               $egs = $pdf->create_egs();

   image_jpeg
           $img = $pdf->image_jpeg($file)

           Returns a new JPEG image object.

   image_png
           $img = $pdf->image_png($file)

           Returns a new PNG image object.

   image_tiff
           $img = $pdf->image_tiff($file, %opts)

           $img = $pdf->image_tiff($file)

           Returns a new TIFF image object.

   image_pnm
           $img = $pdf->image_pnm($file)

           Returns a new PNM image object.

   savestate
           $pdf->savestate()

           Saves the state of the page.

   restorestate
           $pdf->restorestate()

           Restores the state of the page.

   egstate
           $pdf->egstate($egs)

           Sets extended-graphics state.

   fillcolor
           $pdf->fillcolor($color)

           Sets the fill color. See "strokecolor" for color names and specifications.

   strokecolor
           $pdf->strokecolor($color)

           Sets the stroke color.

           Defined color-names are:

               aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond,
               blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue,
               cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgreen, darkgrey,
               darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon,
               darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet,
               deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen,
               fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew,
               hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon,
               lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgreen, lightgrey,
               lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey,
               lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine,
               mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen,
               mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite,
               navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen,
               paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple,
               red, rosybrown, royalblue, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna,
               silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal,
               thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen

           or the rgb-hex-notation:

               #rgb, #rrggbb, #rrrgggbbb and #rrrrggggbbbb

           or the cmyk-hex-notation:

               %cmyk, %ccmmyykk, %cccmmmyyykkk and %ccccmmmmyyyykkkk

           or the hsl-hex-notation:

               &hsl, &hhssll, &hhhssslll and &hhhhssssllll

           or the hsv-hex-notation:

               !hsv, !hhssvv, !hhhsssvvv and !hhhhssssvvvv

   linedash
           $pdf->linedash(@dash)

           Sets the line dash pattern.

   linewidth
           $pdf->linewidth($width)

           Sets the line width.

   transform
           $pdf->transform(%opts)

           Sets transformations (i.e., translate, rotate, scale, skew) in PDF-canonical order.

           Example:

               $pdf->transform(
                   'translate' => [$x,$y],
                   'rotate'    => $rot,
                   'scale'     => [$sx,$sy],
                   'skew'      => [$sa,$sb],
               )

   move
           $pdf->move($x,$y)

           Move to a new drawing location at C[$x,$y].

   line
           $pdf->line($x,$y)

           Draw a line to C[$x,$y].

   curve
           $pdf->curve($x1,$y1, $x2,$y2, $x3,$y3)

           Draw a Bezier curve with three control points.

   arc
           $pdf->arc($xc,$yc, $rx,$ry, $alpha,$beta, $move, $dir)

           $pdf->arc($xc,$yc, $rx,$ry, $alpha,$beta, $move)

           Draw an arc centered at C[$xc,$yc], with x radius C[$rx] and y radius C[$ry], from C[$alpha] degrees
           to C[$beta] degrees. If C[$move] is true, do not draw a line to the start of the arc. C[$dir]
           defaults to 0 for counter-clockwise sweep, and may be set to 1 for a clockwise sweep.

   ellipse
           $pdf->ellipse($xc,$yc, $rx,$ry)

           Draw an ellipse centered at C[$xc,$yc], with x radius C[$rx] and y radius C[$ry].

   circle
           $pdf->circle($xc,$yc, $r)

           Draw a circle centered at C[$xc,$yc], of radius C[$r].

   rect
           $pdf->rect($x,$y, $w,$h)

           Draw a rectangle with lower left corner at C[$x,$y], width (+x) C[$w] and height (+y) C[$h].

   rectxy
           $pdf->rectxy($x1,$y1, $x2,$y2)

           Draw a rectangle with opposite corners C[$x1,$y1] and C[$x2,$y2].

   poly
           $pdf->poly($x1,$y1, ..., $xn,$yn)

           Draw a polyline (multiple line segments) starting at (move to) C[$x1,$y1] and continuing on to
           C[$x2,$y2], ..., C[$xn,$yn].

   close
           $pdf->close()

           Close a shape (draw a line back to the beginning).

   stroke
           $pdf->stroke()

           Stroke (actually draw) a shape whose path has already been laid out, using the requested
           "strokecolor".

   fill
           $pdf->fill()

           Fill in a closed geometry (path), using the requested "fillcolor".  The non-zero winding rule is used
           if the path crosses itself.

   fillstroke
           $pdf->fillstroke()

           Fill (using "fillcolor") and stroke (using "strokecolor") a closed path.  The non-zero winding rule
           is used if the path crosses itself.

   image
           $pdf->image($imgobj, $x,$y, $w,$h)

           $pdf->image($imgobj, $x,$y, $scale)

           $pdf->image($imgobj, $x,$y)

           Please Note: The width/height or scale given is in user-space coordinates, which are subject to
           transformations which may have been specified beforehand.

           Per default this has a 72dpi resolution, so if you want an image to have a 150 or 300dpi resolution,
           you should specify a scale of 72/150 (or 72/300) or adjust width/height accordingly.

   textstart
           $pdf->textstart()

           Forces the start of text mode while in graphics.

   textfont
           $pdf->textfont($fontobj, $size)

           Define the current font to be an (already defined) font object at the given size.

   textleading
           $txt->textleading($leading)

           Set the baseline-to-baseline "leading" to be used for text lines.

   text
           $pdf->text($string)

           Applies (writes out) the given text at the current text location, using the already-specified font.

   nl
           $pdf->nl()

           Write a newline (drop down to the next line).

   textend
           $pdf->textend()

           Force an end to text output and return to graphics.

   print
           $pdf->print($font, $size, $x,$y, $rot, $just, $text)

           Convenience wrapper for shortening the textstart..textend sequence.

           Go into text mode, set the font to the object and size, go to the location, set any rotation, set
           justification, and write the array of text.  Justification is 0 for left, 1 for center, and 2 for
           right.

AUTHOR

       This module was originally written by Alfred Reibenschuh. It has had some minor updates over time, but
       otherwise is mostly unchanged.