.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "PDF::Report 3pm" .TH PDF::Report 3pm "2021-01-05" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" PDF::Report \- A wrapper written for PDF::API2 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use PDF::Report; \& \& my $pdf = new PDF::Report(%opts); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is a wrapper for Alfred Reibenschuh's \s-1PDF::API2\s0 Defines methods to create \s-1PDF\s0 reports .SH "VERSION" .IX Header "VERSION" .Vb 1 \& 1.36 .Ve .SH "METHODS" .IX Header "METHODS" .SS "new" .IX Subsection "new" my \f(CW$pdf\fR = new PDF::Report(%opts); .PP .Vb 3 \& Creates a new pdf report object. \& If no %opts are specified the module \& will use the factory defaults. .Ve .PP \&\fBExample:\fR .PP .Vb 2 \& my $pdf = new PDF::Report(PageSize => "letter", \& PageOrientation => "Landscape"); \& \& my $pdf = new PDF::Report(File => $file); .Ve .PP \&\f(CW%opts:\fR .PP .Vb 6 \& PageSize \- \*(Aq4A\*(Aq, \*(Aq2A\*(Aq, \*(AqA0\*(Aq, \*(AqA1\*(Aq, \*(AqA2\*(Aq, \& \*(AqA3\*(Aq, \*(AqA4\*(Aq, \*(AqA5\*(Aq, \*(AqA6\*(Aq, \*(Aq4B\*(Aq, \& \*(Aq2B\*(Aq, \*(AqB0\*(Aq, \*(AqB1\*(Aq, \*(AqB2\*(Aq, \*(AqB3\*(Aq, \& \*(AqB4\*(Aq, \*(AqB5\*(Aq, \*(AqB6\*(Aq, \*(AqLETTER\*(Aq, \& \*(AqBROADSHEET\*(Aq, \*(AqLEDGER\*(Aq, \*(AqTABLOID\*(Aq, \& \*(AqLEGAL\*(Aq, \*(AqEXECUTIVE\*(Aq, \*(Aq36X36\*(Aq \& \& PageOrientation \- \*(AqPortrait\*(Aq, \*(AqLandscape\*(Aq .Ve .SS "newpage" .IX Subsection "newpage" \&\f(CW$pdf\fR\->newpage($nopage); .PP Creates a new blank page. Pass \f(CW$nopage\fR = 1 to toggle page numbering. .SS "openpage" .IX Subsection "openpage" \&\f(CW$pdf\fR\->openpage($index); .PP If no index is specified, this will open the last page of the document. .SS "importpage" .IX Subsection "importpage" Import page from another \s-1PDF\s0 document, see \s-1PDF::API2\s0 .SS "clonepage" .IX Subsection "clonepage" Clone page within document, see \s-1PDF::API2\s0 .SS "getPageDimensions" .IX Subsection "getPageDimensions" ($pagewidth, \f(CW$pageheight\fR) = \f(CW$pdf\fR\->\fBgetPageDimensions()\fR; .PP Returns the width and height of the page according to what page size chosen in \*(L"new\*(R". .SS "addRawText" .IX Subsection "addRawText" \&\f(CW$pdf\fR\->addRawText($text, \f(CW$x\fR, \f(CW$y\fR, \f(CW$color\fR, \f(CW$underline\fR, \f(CW$indent\fR, \f(CW$rotate\fR); .PP Add \f(CW$text\fR at position \f(CW$x\fR, \f(CW$y\fR with \f(CW$color\fR, \f(CW$underline\fR, \f(CW$indent\fR and/or \f(CW$rotate\fR. .PP \&\s-1PDF::API2\s0 Removes all space between every word in the string you pass and then rejoins each word with one space. If you want to use a string with more than one space between words for formatting purposes, you can either use the hack below or change \s-1PDF::API2\s0 (that's what I did ;). The code below may or may not work according to what font you are using. I used 2 \exA0 per space because that worked for the Helvetica font I was using. .PP \&\fBTo use a fixed width string with more than one space between words, you can do something like:\fR .PP .Vb 10 \& sub replaceSpace { \& my $text = shift; \& my $nbsp = "\exA0"; \& my $new = \*(Aq\*(Aq; \& my @words = split(/ /, $text); \& foreach my $word (@words) { \& if (length($word)) { \& $new.=$word . \*(Aq \*(Aq; \& } else { \& $new.=$nbsp . $nbsp; \& } \& } \& chop($new); \& return $new; \& } .Ve .SS "setAddTextPos" .IX Subsection "setAddTextPos" \&\f(CW$pdf\fR\->setAddTextPos($hPos, \f(CW$vPos\fR); .PP Set the position on the page. Used by the addText function. .SS "getAddTextPos" .IX Subsection "getAddTextPos" ($hPos, \f(CW$vPos\fR) = \f(CW$pdf\fR\->\fBgetAddTextPos()\fR; .PP Return the (x, y) value of the text position. .SS "setAlign" .IX Subsection "setAlign" \&\f(CW$pdf\fR\->setAlign($align); .PP Set the justification of the text. Used by the addText function. .SS "getAlign" .IX Subsection "getAlign" \&\f(CW$align\fR = \f(CW$pdf\fR\->\fBgetAlign()\fR; .PP Returns the text justification. .SS "wrapText" .IX Subsection "wrapText" \&\f(CW$newtext\fR = \f(CW$pdf\fR\->wrapText($text, \f(CW$width\fR); .PP This is a helper function called by addText, which can be called by itself. \&\fBwrapText()\fR wraps \f(CW$text\fR within \f(CW$width\fR. .SS "addText" .IX Subsection "addText" \&\f(CW$pdf\fR\->addText($text, \f(CW$hPos\fR, \f(CW$textWidth\fR, \f(CW$textHeight\fR); .PP Takes \f(CW$text\fR and prints it to the current page at \f(CW$hPos\fR. You may just want to pass this function \f(CW$text\fR if the text is \*(L"pre-wrapped\*(R" and setAddTextPos has been called previously. Pass a \f(CW$hPos\fR to change the position the text will be printed on the page. Pass a \f(CW$textWidth\fR and addText will wrap the text for you. \f(CW$textHeight\fR controls the row height. .SS "addParagraph" .IX Subsection "addParagraph" \&\f(CW$pdf\fR\->addParagraph($text, \f(CW$hPos\fR, \f(CW$vPos\fR, \f(CW$width\fR, \f(CW$height\fR, \f(CW$indent\fR, \f(CW$lead\fR); .PP Add \f(CW$text\fR at ($hPos, \f(CW$vPos\fR) within \f(CW$width\fR and \f(CW$height\fR, with \f(CW$indent\fR. \&\f(CW$indent\fR is the number of spaces at the beginning of the first line. .SS "centerString" .IX Subsection "centerString" \&\f(CW$pdf\fR\->centerString($a, \f(CW$b\fR, \f(CW$yPos\fR, \f(CW$text\fR); .PP Centers \f(CW$text\fR between points \f(CW$a\fR and \f(CW$b\fR at position \f(CW$yPos\fR. Be careful how much text you try to jam between those points, this function shrinks the text till it fits! .SS "setRowHeight" .IX Subsection "setRowHeight" .SS "getStringWidth" .IX Subsection "getStringWidth" \&\f(CW$pdf\fR\->getStringWidth($String); .PP Returns the width of \f(CW$String\fR according to the current font and fontsize being used. .SS "addImg" .IX Subsection "addImg" \&\f(CW$pdf\fR\->addImg($file, \f(CW$x\fR, \f(CW$y\fR); .PP Add image \f(CW$file\fR to the current page at position ($x, \f(CW$y\fR). .SS "addImgScaled" .IX Subsection "addImgScaled" \&\f(CW$pdf\fR\->addImgScaled($file, \f(CW$x\fR, \f(CW$y\fR, \f(CW$scale\fR); .PP Add image \f(CW$file\fR to the current page at position ($x, \f(CW$y\fR) scaled to \f(CW$scale\fR. .SS "setGfxLineWidth" .IX Subsection "setGfxLineWidth" \&\f(CW$pdf\fR\->setGfxLineWidth($width); .PP Set the line width drawn on the page. .SS "getGfxLineWidth" .IX Subsection "getGfxLineWidth" \&\f(CW$width\fR = \f(CW$pdf\fR\->\fBgetGfxLineWidth()\fR; .PP Returns the current line width. .SS "drawLine" .IX Subsection "drawLine" \&\f(CW$pdf\fR\->drawLine($x1, \f(CW$y1\fR, \f(CW$x2\fR, \f(CW$y2\fR); .PP Draw a line on the current page starting at ($x1, \f(CW$y1\fR) and ending at ($x2, \f(CW$y2\fR). .SS "drawRect" .IX Subsection "drawRect" \&\f(CW$pdf\fR\->drawRect($x1, \f(CW$y1\fR, \f(CW$x2\fR, \f(CW$y2\fR); .PP Draw a rectangle on the current page. Top left corner is represented by ($x1, \f(CW$y1\fR) and the bottom right corner is ($x2, \f(CW$y2\fR). .SS "shadeRect" .IX Subsection "shadeRect" \&\f(CW$pdf\fR\->shadeRect($x1, \f(CW$y1\fR, \f(CW$x2\fR, \f(CW$y2\fR, \f(CW$color\fR); .PP Shade a rectangle with \f(CW$color\fR. Top left corner is ($x1, \f(CW$y1\fR) and the bottom right corner is ($x2, \f(CW$y2\fR). .IP "\fBDefined color-names are:\fR" 4 .IX Item "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 .Sp or the rgb-hex-notation: .Sp .Vb 1 \& #rgb, #rrggbb, #rrrgggbbb and #rrrrggggbbbb .Ve .Sp or the cmyk-hex-notation: .Sp .Vb 1 \& %cmyk, %ccmmyykk, %cccmmmyyykkk and %ccccmmmmyyyykkkk .Ve .Sp and additionally the hsv-hex-notation: .Sp .Vb 1 \& !hsv, !hhssvv, !hhhsssvvv and !hhhhssssvvvv .Ve .SS "drawPieGraph" .IX Subsection "drawPieGraph" \&\f(CW$pdf\fR\->drawPieGraph($x, \f(CW$y\fR, \f(CW$size\fR, \f(CW$rData\fR, \f(CW$rLabels\fR); .PP Method to create a piegraph using a reference to an array of values. It also takes a reference to an array for labels for each data value. A legend with all the colors and labels will appear if \f(CW$rLabels\fR is passed. \f(CW$x\fR and \&\f(CW$y\fR are the coordinates for the center of the pie and \f(CW$size\fR is the radius. .SS "getcolors" .IX Subsection "getcolors" Returns list of available colours .SS "drawBarcode" .IX Subsection "drawBarcode" \&\f(CW$pdf\fR\->drawBarcode($x, \f(CW$y\fR, \f(CW$scale\fR, \f(CW$frame\fR, \f(CW$type\fR, \f(CW$code\fR, \f(CW$extn\fR, \f(CW$umzn\fR, \f(CW$lmzn\fR, \f(CW$zone\fR, \f(CW$quzn\fR, \f(CW$spcr\fR, \f(CW$ofwt\fR, \f(CW$fnsz\fR, \f(CW$text\fR); .PP This is really not that complicated, trust me! ;) I am pretty unfamiliar with barcode lingo and types so if I get any of this wrong, lemme know! This is a very flexible way to draw a barcode on your \s-1PDF\s0 document. \&\f(CW$x\fR and \f(CW$y\fR represent the center of the barcode's position on the document. \&\f(CW$scale\fR is the size of the entire barcode 1 being 1:1, which is all you'll need most likely. \f(CW$type\fR is the type of barcode which can be codabar, 2of5int, 3of9, code128, or ean13. \f(CW$code\fR is the alpha-numeric code which the barcode will represent. \f(CW$extn\fR is the extension to the \f(CW$code\fR, where applicable. \f(CW$umzn\fR is the upper mending zone and \&\f(CW$lmzn\fR is the lower mending zone. \f(CW$zone\fR is the the zone or height of the bars. \&\f(CW$quzn\fR is the quiet zone or the space between the frame and the barcode. \f(CW$spcr\fR is what to put between each number/character in the text. \f(CW$ofwt\fR is the overflow width. \f(CW$fnsz\fR is the fontsize used for the text. \f(CW$text\fR is optional text beneathe the barcode. .SS "setFont" .IX Subsection "setFont" \&\f(CW$pdf\fR\->setFont($font); .PP Creates a new font object of type \f(CW$font\fR to be used in the page. .SS "getFont" .IX Subsection "getFont" \&\f(CW$fontname\fR = \f(CW$pdf\fR\->\fBgetFont()\fR; .PP Returns the font name currently being used. .SS "setSize" .IX Subsection "setSize" \&\f(CW$pdf\fR\->setSize($size); .PP Sets the fontsize to \f(CW$size\fR. Called before \fBsetFont()\fR. .SS "getSize" .IX Subsection "getSize" \&\f(CW$fontsize\fR = \f(CW$pdf\fR\->\fBgetSize()\fR; .PP Returns the font size currently being used. .SS "pages" .IX Subsection "pages" \&\f(CW$pages\fR = \f(CW$pdf\fR\->\fBpages()\fR; .PP The number of pages in the document. .SS "setInfo" .IX Subsection "setInfo" \&\f(CW$pdf\fR\->setInfo(%infohash); .PP Sets the info structure of the document. Valid keys for \f(CW%infohash:\fR Creator, Producer, CreationDate, Title, Subject, Author, etc. .SS "getInfo" .IX Subsection "getInfo" \&\f(CW%infohash\fR = \f(CW$pdf\fR\->\fBgetInfo()\fR; .PP Gets meta-data from the info structure of the document. Valid keys for \f(CW%infohash:\fR Creator, Producer, CreationDate, Title, Subject, Author, etc. .SS "saveAs" .IX Subsection "saveAs" Saves the document to a file. .PP .Vb 3 \& # Save the document as "file.pdf" \& my $fileName = "file.pdf"; \& $pdf\->saveAs($fileName); .Ve .SS "Finish" .IX Subsection "Finish" Returns the \s-1PDF\s0 document as text. Pass your own custom routine to do things on the footer of the page. Pass 'roman' for Roman Numeral page numbering. .PP .Vb 3 \& # Hand the document to the web browser \& print "Content\-type: application/pdf\en\en"; \& print $pdf\->Finish(); .Ve .SS "getPDFAPI2Object" .IX Subsection "getPDFAPI2Object" Object method returns underlying \s-1PDF::API2\s0 object .SH "AUTHOR EMERITUS" .IX Header "AUTHOR EMERITUS" Andrew Orr .SH "MAINTAINER" .IX Header "MAINTAINER" Aaron \s-1TEEJAY\s0 Trevena .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests to \f(CW\*(C`bug\-calendar\-model at rt.cpan.org\*(C'\fR, or through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .SH "SUPPORT" .IX Header "SUPPORT" You can find documentation for this module with the perldoc command. .PP .Vb 1 \& perldoc PDF::Report .Ve .PP You can also look for information at: .IP "\(bu" 4 \&\s-1RT: CPAN\s0's request tracker (report bugs here) .Sp .IP "\(bu" 4 AnnoCPAN: Annotated \s-1CPAN\s0 documentation .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Ratings .Sp .IP "\(bu" 4 \&\s-1METACPAN\s0 .Sp .IP "\(bu" 4 \&\s-1GITHUB\s0 .Sp .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "\s-1PDF::API2\s0" 4 .IX Item "PDF::API2" .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" Copyright 2008\-2010 Andy Orr .PP Copyright 2013 Aaron Trevena .PP This program is free software; you can redistribute it and/or modify it under the terms of either: the \s-1GNU\s0 General Public License as published by the Free Software Foundation; or the Artistic License. .PP See for more information.