.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" 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 .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "PDF::Table 3pm" .TH PDF::Table 3pm "2018-04-21" "perl v5.26.2" "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::Table \- A utility class for building table layouts in a PDF::API2 object. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use PDF::API2; \& use PDF::Table; \& \& my $pdftable = new PDF::Table; \& my $pdf = new PDF::API2(\-file => "table_of_lorem.pdf"); \& my $page = $pdf\->page; \& \& # some data to layout \& my $some_data =[ \& ["1 Lorem ipsum dolor", \& "Donec odio neque, faucibus vel", \& "consequat quis, tincidunt vel, felis."], \& ["Nulla euismod sem eget neque.", \& "Donec odio neque", \& "Sed eu velit."], \& #... and so on \& ]; \& \& $left_edge_of_table = 50; \& # build the table layout \& $pdftable\->table( \& # required params \& $pdf, \& $page, \& $some_data, \& x => $left_edge_of_table, \& w => 495, \& start_y => 500, \& start_h => 300, \& # some optional params \& next_y => 750, \& next_h => 500, \& padding => 5, \& padding_right => 10, \& background_color_odd => "gray", \& background_color_even => "lightblue", #cell background color for even rows \& ); \& \& # do other stuff with $pdf \& $pdf\->saveas(); \&... .Ve .SH "EXAMPLE" .IX Header "EXAMPLE" For a complete working example or initial script look into distribution`s 'examples' folder. .SH "DESCRIPTION" .IX Header "DESCRIPTION" This class is a utility for use with the \s-1PDF::API2\s0 module from \s-1CPAN.\s0 It can be used to display text data in a table layout within a \s-1PDF.\s0 The text data must be in a 2D array (such as returned by a \s-1DBI\s0 statement handle \fIfetchall_arrayref()\fR call). The PDF::Table will automatically add as many new pages as necessary to display all of the data. Various layout properties, such as font, font size, and cell padding and background color can be specified for each column and/or for even/odd rows. Also a (non)repeated header row with different layout properties can be specified. .PP See the \*(L"\s-1METHODS\*(R"\s0 section for complete documentation of every parameter. .SH "METHODS" .IX Header "METHODS" .SS "\fInew()\fP" .IX Subsection "new()" .Vb 1 \& my $pdf_table = new PDF::Table; .Ve .IP "Description" 4 .IX Item "Description" Creates a new instance of the class. (to be improved) .IP "Parameters" 4 .IX Item "Parameters" There are no parameters. .IP "Returns" 4 .IX Item "Returns" Reference to the new instance .SS "\fItable()\fP" .IX Subsection "table()" .Vb 1 \& my ($final_page, $number_of_pages, $final_y) = table($pdf, $page, $data, %settings) .Ve .IP "Description" 4 .IX Item "Description" Generates a multi-row, multi-column table into an existing \s-1PDF\s0 document based on provided data set and settings. .IP "Parameters" 4 .IX Item "Parameters" .Vb 4 \& $pdf \- a PDF::API2 instance representing the document being created \& $page \- a PDF::API2::Page instance representing the current page of the document \& $data \- an ARRAY reference to a 2D data structure that will be used to build the table \& %settings \- HASH with geometry and formatting parameters. .Ve .Sp For full \f(CW%settings\fR description see section \*(L"Table settings\*(R" below. .Sp This method will add more pages to the pdf instance as required based on the formatting options and the amount of data. .IP "Returns" 4 .IX Item "Returns" The return value is a 3 items list where .Sp .Vb 3 \& $final_page \- The first item is a PDF::API2::Page instance that the table ends on \& $number_of_pages \- The second item is the count of pages that the table spans on \& $final_y \- The third item is the Y coordinate of the table bottom so that additional content can be added in the same document. .Ve .IP "Example" 4 .IX Item "Example" .Vb 12 \& my $pdf = new PDF::API2; \& my $page = $pdf\->page(); \& my $data = [ \& [\*(Aqfoo1\*(Aq,\*(Aqbar1\*(Aq,\*(Aqbaz1\*(Aq], \& [\*(Aqfoo2\*(Aq,\*(Aqbar2\*(Aq,\*(Aqbaz2\*(Aq] \& ]; \& my %settings = ( \& x => 10, \& w => 570, \& start_y => 220, \& start_h => 180, \& ); \& \& my ($final_page, $number_of_pages, $final_y) = $pdftable\->table( $pdf, $page, $data, %options ); .Ve .PP \fITable settings\fR .IX Subsection "Table settings" .PP Mandatory .IX Subsection "Mandatory" .PP There are some mandatory parameteres for setting table geometry and position across page(s) .IP "\fBx\fR \- X coordinate of upper left corner of the table. Left edge of the sheet is 0." 4 .IX Item "x - X coordinate of upper left corner of the table. Left edge of the sheet is 0." \&\fBValue:\fR can be any whole number satisfying 0 =< X < PageWidth \&\fBDefault:\fR No default value .Sp .Vb 1 \& x => 10 .Ve .IP "\fBstart_y\fR \- Y coordinate of upper left corner of the table at the initial page." 4 .IX Item "start_y - Y coordinate of upper left corner of the table at the initial page." \&\fBValue:\fR can be any whole number satisfying 0 < start_y < PageHeight (depending on space availability when embedding a table) \&\fBDefault:\fR No default value .Sp .Vb 1 \& start_y => 327 .Ve .IP "\fBw\fR \- width of the table starting from X." 4 .IX Item "w - width of the table starting from X." \&\fBValue:\fR can be any whole number satisfying 0 < w < PageWidth \- x \&\fBDefault:\fR No default value .Sp .Vb 1 \& w => 570 .Ve .IP "\fBstart_h\fR \- Height of the table on the initial page" 4 .IX Item "start_h - Height of the table on the initial page" \&\fBValue:\fR can be any whole number satisfying 0 < start_h < PageHeight \- Current Y position \&\fBDefault:\fR No default value .Sp .Vb 1 \& start_h => 250 .Ve .PP Optional .IX Subsection "Optional" .IP "\fBnext_h\fR \- Height of the table on any additional page" 4 .IX Item "next_h - Height of the table on any additional page" \&\fBValue:\fR can be any whole number satisfying 0 < next_h < PageHeight \&\fBDefault:\fR Value of param \fB'start_h'\fR .Sp .Vb 1 \& next_h => 700 .Ve .IP "\fBnext_y\fR \- Y coordinate of upper left corner of the table at any additional page." 4 .IX Item "next_y - Y coordinate of upper left corner of the table at any additional page." \&\fBValue:\fR can be any whole number satisfying 0 < next_y < PageHeight \&\fBDefault:\fR Value of param \fB'start_y'\fR .Sp .Vb 1 \& next_y => 750 .Ve .IP "\fBmax_word_length\fR \- Breaks long words (like serial numbers hashes etc.) by adding a space after every Nth symbol" 4 .IX Item "max_word_length - Breaks long words (like serial numbers hashes etc.) by adding a space after every Nth symbol" \&\fBValue:\fR can be any whole positive number \&\fBDefault:\fR 20 .Sp .Vb 1 \& max_word_length => 20 # Will add a space after every 20 symbols .Ve .IP "\fBpadding\fR \- Padding applied to every cell" 4 .IX Item "padding - Padding applied to every cell" .PD 0 .IP "\fBpadding_top\fR \- top cell padding, overrides 'padding'" 4 .IX Item "padding_top - top cell padding, overrides 'padding'" .IP "\fBpadding_right\fR \- right cell padding, overrides 'padding'" 4 .IX Item "padding_right - right cell padding, overrides 'padding'" .IP "\fBpadding_left\fR \- left cell padding, overrides 'padding'" 4 .IX Item "padding_left - left cell padding, overrides 'padding'" .IP "\fBpadding_bottom\fR \- bottom padding, overrides 'padding'" 4 .IX Item "padding_bottom - bottom padding, overrides 'padding'" .PD \&\fBValue:\fR can be any whole positive number .Sp \&\fBDefault padding:\fR 0 .Sp \&\fBDefault padding_*\fR \f(CW$padding\fR .Sp .Vb 5 \& padding => 5 # all sides cell padding \& padding_top => 8, # top cell padding, overrides \*(Aqpadding\*(Aq \& padding_right => 6, # right cell padding, overrides \*(Aqpadding\*(Aq \& padding_left => 2, # left cell padding, overrides \*(Aqpadding\*(Aq \& padding_bottom => undef # bottom padding will be 5 as it will fallback to \*(Aqpadding\*(Aq .Ve .IP "\fBborder\fR \- Width of table border lines." 4 .IX Item "border - Width of table border lines." .PD 0 .IP "\fBhorizontal_borders\fR \- Width of horizontal border lines. Overrides 'border' value." 4 .IX Item "horizontal_borders - Width of horizontal border lines. Overrides 'border' value." .IP "\fBvertical_borders\fR \- Width of vertical border lines. Overrides 'border' value." 4 .IX Item "vertical_borders - Width of vertical border lines. Overrides 'border' value." .PD \&\fBValue:\fR can be any whole positive number. When set to 0 will disable border lines. \&\fBDefault:\fR 1 .Sp .Vb 3 \& border => 3 # border width is 3 \& horizontal_borders => 1 # horizontal borders will be 1 overriding 3 \& vertical_borders => undef # vertical borders will be 3 as it will fallback to \*(Aqborder\*(Aq .Ve .IP "\fBvertical_borders\fR \- Width of vertical border lines. Overrides 'border' value." 4 .IX Item "vertical_borders - Width of vertical border lines. Overrides 'border' value." \&\fBValue:\fR Color specifier as 'name' or '\s-1HEX\s0' \&\fBDefault:\fR 'black' .Sp .Vb 1 \& border_color => \*(Aqred\*(Aq .Ve .IP "\fBfont\fR \- instance of PDF::API2::Resource::Font defining the fontf to be used in the table" 4 .IX Item "font - instance of PDF::API2::Resource::Font defining the fontf to be used in the table" \&\fBValue:\fR can be any PDF::API2::Resource::* type of font \&\fBDefault:\fR 'Times' with \s-1UTF8\s0 encoding .Sp .Vb 1 \& font => $pdf\->corefont("Helvetica", \-encoding => "utf8") .Ve .IP "\fBfont_size\fR \- Default size of the font that will be used across the table" 4 .IX Item "font_size - Default size of the font that will be used across the table" \&\fBValue:\fR can be any positive number \&\fBDefault:\fR 12 .Sp .Vb 1 \& font_size => 16 .Ve .IP "\fBfont_color\fR \- Font color for all rows" 4 .IX Item "font_color - Font color for all rows" .PD 0 .IP "\fBfont_color_odd\fR \- Font color for odd rows" 4 .IX Item "font_color_odd - Font color for odd rows" .IP "\fBfont_color_even\fR \- Font color for even rows" 4 .IX Item "font_color_even - Font color for even rows" .IP "\fBfont_underline\fR \- Font underline of the header row" 4 .IX Item "font_underline - Font underline of the header row" .PD \&\fBValue:\fR 'auto', integer of distance, or arrayref of distance & thickness (more than one pair will provide mlultiple underlines. Negative distance gives strike-through. \&\fBDefault:\fR none .IP "\fBbackground_color_odd\fR \- Background color for odd rows" 4 .IX Item "background_color_odd - Background color for odd rows" .PD 0 .IP "\fBbackground_color_even\fR \- Background color for even rows" 4 .IX Item "background_color_even - Background color for even rows" .PD \&\fBValue:\fR Color specifier as 'name' or '\s-1HEX\s0' \&\fBDefault:\fR 'black' font on 'white' background .Sp .Vb 5 \& font_color => \*(Aq#333333\*(Aq \& font_color_odd => \*(Aqpurple\*(Aq \& font_color_even => \*(Aq#00FF00\*(Aq \& background_color_odd => \*(Aqgray\*(Aq \& background_color_even => \*(Aqlightblue\*(Aq .Ve .IP "\fBrow_height\fR \- Desired row height but it will be honored only if row_height > font_size + padding_top + padding_bottom" 4 .IX Item "row_height - Desired row height but it will be honored only if row_height > font_size + padding_top + padding_bottom" \&\fBValue:\fR can be any whole positive number \&\fBDefault:\fR font_size + padding_top + padding_bottom .Sp .Vb 1 \& row_height => 24 .Ve .IP "\fBnew_page_func\fR \- \s-1CODE\s0 reference to a function that returns a PDF::API2::Page instance." 4 .IX Item "new_page_func - CODE reference to a function that returns a PDF::API2::Page instance." If used the parameter 'new_page_func' must be a function reference which when executed will create a new page and will return the object back to the module. For example you can use it to put Page Title, Page Frame, Page Numbers and other staff that you need. Also if you need some different type of paper size and orientation than the default A4\-Portrait for example B2\-Landscape you can use this function ref to set it up for you. For more info about creating pages refer to \s-1PDF::API2 PAGE METHODS\s0 Section. Don't forget that your function must return a page object created with \s-1PDF::API2\s0 \fIpage()\fR method. .Sp .Vb 1 \& new_page_func => $code_ref .Ve .ie n .IP "\fBheader_props\fR \- \s-1HASH\s0 reference to specific settings for the Header row of the table. See section ""Header Row Properties"" below" 4 .el .IP "\fBheader_props\fR \- \s-1HASH\s0 reference to specific settings for the Header row of the table. See section ``Header Row Properties'' below" 4 .IX Item "header_props - HASH reference to specific settings for the Header row of the table. See section Header Row Properties below" .Vb 1 \& header_props => $hdr_props .Ve .ie n .IP "\fBcolumn_props\fR \- \s-1HASH\s0 reference to specific settings for each column of the table. See section ""Column Properties"" below" 4 .el .IP "\fBcolumn_props\fR \- \s-1HASH\s0 reference to specific settings for each column of the table. See section ``Column Properties'' below" 4 .IX Item "column_props - HASH reference to specific settings for each column of the table. See section Column Properties below" .Vb 1 \& column_props => $col_props .Ve .ie n .IP "\fBcell_props\fR \- \s-1HASH\s0 reference to specific settings for each column of the table. See section ""Cell Properties"" below" 4 .el .IP "\fBcell_props\fR \- \s-1HASH\s0 reference to specific settings for each column of the table. See section ``Cell Properties'' below" 4 .IX Item "cell_props - HASH reference to specific settings for each column of the table. See section Cell Properties below" .Vb 1 \& cell_props => $cel_props .Ve .IP "\fBcell_render_hook\fR \- \s-1CODE\s0 reference to a function called with the current cell coordinates. If used the parameter 'cell_render_hook' must be a function reference. It is most useful for creating a url link inside of a cell. The following example adds a link in the first column of each non-header row:" 4 .IX Item "cell_render_hook - CODE reference to a function called with the current cell coordinates. If used the parameter 'cell_render_hook' must be a function reference. It is most useful for creating a url link inside of a cell. The following example adds a link in the first column of each non-header row:" .Vb 2 \& cell_render_hook => sub { \& my ($page, $first_row, $row, $col, $x, $y, $w, $h) = @_; \& \& # Do nothing except for first column (and not a header row) \& return unless ($col == 0); \& return if ($first_row); \& \& # Create link \& my $value = $list_of_vals[$row\-1]; \& my $url = "https://${hostname}/app/${value}"; \& \& my $annot = $page\->annotation(); \& $annot\->url( $url, \-rect => [$x, $y, $x+$w, $y+$h] ); \& }, .Ve .PP Header Row Properties .IX Subsection "Header Row Properties" .PP If the 'header_props' parameter is used, it should be a hashref. Passing an empty \s-1HASH\s0 will trigger a header row initialised with Default values. There is no 'data' variable for the content, because the module asumes that first table row will become the header row. It will copy this row and put it on every new page if 'repeat' param is set. .IP "\fBfont\fR \- instance of PDF::API2::Resource::Font defining the fontf to be used in the header row" 4 .IX Item "font - instance of PDF::API2::Resource::Font defining the fontf to be used in the header row" \&\fBValue:\fR can be any PDF::API2::Resource::* type of font \&\fBDefault:\fR 'font' of the table. See table parameter 'font' for more details. .IP "\fBfont_size\fR \- Font size of the header row" 4 .IX Item "font_size - Font size of the header row" \&\fBValue:\fR can be any positive number \&\fBDefault:\fR 'font_size' of the table + 2 .IP "\fBfont_color\fR \- Font color of the header row" 4 .IX Item "font_color - Font color of the header row" \&\fBValue:\fR Color specifier as 'name' or '\s-1HEX\s0' \&\fBDefault:\fR '#000066' .IP "\fBfont_underline\fR \- Font underline of the header row" 4 .IX Item "font_underline - Font underline of the header row" \&\fBValue:\fR 'auto', integer of distance, or arrayref of distance & thickness (more than one pair will provide mlultiple underlines. Negative distance gives strike-through. \&\fBDefault:\fR none .IP "\fBbg_color\fR \- Background color of the header row" 4 .IX Item "bg_color - Background color of the header row" \&\fBValue:\fR Color specifier as 'name' or '\s-1HEX\s0' \&\fBDefault:\fR #FFFFAA .IP "\fBrepeat\fR \- Flag showing if header row should be repeated on every new page" 4 .IX Item "repeat - Flag showing if header row should be repeated on every new page" \&\fBValue:\fR 0,1 1\-Yes/True, 0\-No/False \&\fBDefault:\fR 0 .IP "\fBjustify\fR \- Alignment of text in the header row." 4 .IX Item "justify - Alignment of text in the header row." \&\fBValue:\fR One of 'left', 'right', 'center' \&\fBDefault:\fR Same as column alignment (or 'left' if undefined) .Sp .Vb 9 \& my $hdr_props = \& { \& font => $pdf\->corefont("Helvetica", \-encoding => "utf8"), \& font_size => 18, \& font_color => \*(Aq#004444\*(Aq, \& bg_color => \*(Aqyellow\*(Aq, \& repeat => 1, \& justify => \*(Aqcenter\*(Aq \& }; .Ve .PP Column Properties .IX Subsection "Column Properties" .PP If the 'column_props' parameter is used, it should be an arrayref of hashrefs, with one hashref for each column of the table. The columns are counted from left to right so the hash reference at \f(CW$col_props\fR[0] will hold properties for the first column from left to right. If you \s-1DO NOT\s0 want to give properties for a column but to give for another just insert and empty hash reference into the array for the column that you want to skip. This will cause the counting to proceed as expected and the properties to be applyed at the right columns. .PP Each hashref can contain any of the keys shown below: .IP "\fBmin_w\fR \- Minimum width of this column. Auto calculation will try its best to honour this param but aplying it is \s-1NOT\s0 guaranteed." 4 .IX Item "min_w - Minimum width of this column. Auto calculation will try its best to honour this param but aplying it is NOT guaranteed." \&\fBValue:\fR can be any whole number satisfying 0 < min_w < w \&\fBDefault:\fR Auto calculated .IP "\fBmax_w\fR \- Maximum width of this column. Auto calculation will try its best to honour this param but aplying it is \s-1NOT\s0 guaranteed." 4 .IX Item "max_w - Maximum width of this column. Auto calculation will try its best to honour this param but aplying it is NOT guaranteed." \&\fBValue:\fR can be any whole number satisfying 0 < max_w < w \&\fBDefault:\fR Auto calculated .IP "\fBfont\fR \- instance of PDF::API2::Resource::Font defining the fontf to be used in this column" 4 .IX Item "font - instance of PDF::API2::Resource::Font defining the fontf to be used in this column" \&\fBValue:\fR can be any PDF::API2::Resource::* type of font \&\fBDefault:\fR 'font' of the table. See table parameter 'font' for more details. .IP "\fBfont_size\fR \- Font size of this column" 4 .IX Item "font_size - Font size of this column" \&\fBValue:\fR can be any positive number \&\fBDefault:\fR 'font_size' of the table. .IP "\fBfont_color\fR \- Font color of this column" 4 .IX Item "font_color - Font color of this column" \&\fBValue:\fR Color specifier as 'name' or '\s-1HEX\s0' \&\fBDefault:\fR 'font_color' of the table. .IP "\fBfont_underline\fR \- Font underline of this cell" 4 .IX Item "font_underline - Font underline of this cell" \&\fBValue:\fR 'auto', integer of distance, or arrayref of distance & thickness (more than one pair will provide mlultiple underlines. Negative distance gives strike-through. \&\fBDefault:\fR none .IP "\fBbackground_color\fR \- Background color of this column" 4 .IX Item "background_color - Background color of this column" \&\fBValue:\fR Color specifier as 'name' or '\s-1HEX\s0' \&\fBDefault:\fR undef .IP "\fBjustify\fR \- Alignment of text in this column" 4 .IX Item "justify - Alignment of text in this column" \&\fBValue:\fR One of 'left', 'right', 'center' \&\fBDefault:\fR 'left' .Sp Example: .Sp .Vb 10 \& my $col_props = [ \& {},# This is an empty hash so the next one will hold the properties for the second column from left to right. \& { \& min_w => 100, # Minimum column width of 100. \& max_w => 150, # Maximum column width of 150 . \& justify => \*(Aqright\*(Aq, # Right text alignment \& font => $pdf\->corefont("Helvetica", \-encoding => "latin1"), \& font_size => 10, \& font_color=> \*(Aqblue\*(Aq, \& background_color => \*(Aq#FFFF00\*(Aq, \& }, \& # etc. \& ]; .Ve .PP \&\s-1NOTE:\s0 If 'min_w' and/or 'max_w' parameter is used in 'col_props', have in mind that it may be overridden by the calculated minimum/maximum cell witdh so that table can be created. When this happens a warning will be issued with some advises what can be done. In cases of a conflict between column formatting and odd/even row formatting, 'col_props' will override odd/even. .PP Cell Properties .IX Subsection "Cell Properties" .PP If the 'cell_props' parameter is used, it should be an arrayref with arrays of hashrefs (of the same dimension as the data array) with one hashref for each cell of the table. .PP Each hashref can contain any of the keys shown below: .IP "\fBfont\fR \- instance of PDF::API2::Resource::Font defining the fontf to be used in this cell" 4 .IX Item "font - instance of PDF::API2::Resource::Font defining the fontf to be used in this cell" \&\fBValue:\fR can be any PDF::API2::Resource::* type of font \&\fBDefault:\fR 'font' of the table. See table parameter 'font' for more details. .IP "\fBfont_size\fR \- Font size of this cell" 4 .IX Item "font_size - Font size of this cell" \&\fBValue:\fR can be any positive number \&\fBDefault:\fR 'font_size' of the table. .IP "\fBfont_color\fR \- Font color of this cell" 4 .IX Item "font_color - Font color of this cell" \&\fBValue:\fR Color specifier as 'name' or '\s-1HEX\s0' \&\fBDefault:\fR 'font_color' of the table. .IP "\fBfont_underline\fR \- Font underline of this cell" 4 .IX Item "font_underline - Font underline of this cell" \&\fBValue:\fR 'auto', integer of distance, or arrayref of distance & thickness (more than one pair will provide mlultiple underlines. Negative distance gives strike-through. \&\fBDefault:\fR none .IP "\fBbackground_color\fR \- Background color of this cell" 4 .IX Item "background_color - Background color of this cell" \&\fBValue:\fR Color specifier as 'name' or '\s-1HEX\s0' \&\fBDefault:\fR undef .IP "\fBjustify\fR \- Alignment of text in this cell" 4 .IX Item "justify - Alignment of text in this cell" \&\fBValue:\fR One of 'left', 'right', 'center' \&\fBDefault:\fR 'left' .Sp Example: .Sp .Vb 7 \& my $cell_props = [ \& [ #This array is for the first row. If header_props is defined it will overwrite these settings. \& { #Row 1 cell 1 \& background_color => \*(Aq#AAAA00\*(Aq, \& font_color => \*(Aqyellow\*(Aq, \& font_underline => [ 2, 2 ], \& }, \& \& # etc. \& ], \& [#Row 2 \& { #Row 2 cell 1 \& background_color => \*(Aq#CCCC00\*(Aq, \& font_color => \*(Aqblue\*(Aq, \& }, \& { #Row 2 cell 2 \& background_color => \*(Aq#BBBB00\*(Aq, \& font_color => \*(Aqred\*(Aq, \& }, \& # etc. \& ], \& # etc. \& ]; \& \& OR \& \& my $cell_props = []; \& $cell_props\->[1][0] = { \& #Row 2 cell 1 \& background_color => \*(Aq#CCCC00\*(Aq, \& font_color => \*(Aqblue\*(Aq, \& }; .Ve .PP \&\s-1NOTE:\s0 In case of a conflict between column, odd/even and cell formatting, cell formatting will overwrite the other two. In case of a conflict between header row and cell formatting, header formatting will override cell. .SS "\fItext_block()\fP" .IX Subsection "text_block()" .Vb 1 \& my ($width_of_last_line, $ypos_of_last_line, $left_over_text) = text_block( $txt, $data, %settings) .Ve .IP "Description" 4 .IX Item "Description" Utility method to create a block of text. The block may contain multiple paragraphs. It is mainly used internaly but you can use it from outside for placing formatted text anywhere on the sheet. .Sp \&\s-1NOTE:\s0 This method will \s-1NOT\s0 add more pages to the pdf instance if the space is not enough to place the string inside the block. Leftover text will be returned and has to be handled by the caller \- i.e. add a new page and a new block with the leftover. .IP "Parameters" 4 .IX Item "Parameters" .Vb 3 \& $txt \- a PDF::API2::Page::Text instance representing the text tool \& $data \- a string that will be placed inside the block \& %settings \- HASH with geometry and formatting parameters. .Ve .IP "Reuturns" 4 .IX Item "Reuturns" The return value is a 3 items list where .Sp .Vb 3 \& $width_of_last_line \- Width of last line in the block \& $final_y \- The Y coordinate of the block bottom so that additional content can be added after it \& $left_over_text \- Text that was did not fit in the provided box geometry. .Ve .IP "Example" 4 .IX Item "Example" .Vb 3 \& # PDF::API2 objects \& my $page = $pdf\->page; \& my $txt = $page\->text; \& \& my %settings = ( \& x => 10, \& y => 570, \& w => 220, \& h => 180 \& \& #OPTIONAL PARAMS \& lead => $font_size | $distance_between_lines, \& align => "left|right|center|justify|fulljustify", \& hang => $optional_hanging_indent, \& Only one of the subsequent 3params can be given. \& They override each other.\-parspace is the weightest \& parspace => $optional_vertical_space_before_first_paragraph, \& flindent => $optional_indent_of_first_line, \& fpindent => $optional_indent_of_first_paragraph, \& indent => $optional_indent_of_text_to_every_non_first_line, \& ); \& \& my ( $width_of_last_line, $final_y, $left_over_text ) = $pdftable\->text_block( $txt, $data, %settings ); .Ve .SH "VERSION" .IX Header "VERSION" 0.9.7 .SH "AUTHOR" .IX Header "AUTHOR" Daemmon Hughes .SH "DEVELOPMENT" .IX Header "DEVELOPMENT" Further development since Ver: 0.02 \- Desislav Kamenov .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2006 by Daemmon Hughes, portions Copyright 2004 Stone Environmental Inc. (www.stone\-env.com) All Rights Reserved. .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available. .SH "PLUGS" .IX Header "PLUGS" .IP "by Daemmon Hughes" 4 .IX Item "by Daemmon Hughes" Much of the work on this module was sponsered by Stone Environmental Inc. (www.stone\-env.com). .Sp The \fItext_block()\fR method is a slightly modified copy of the one from Rick Measham's \s-1PDF::API2\s0 tutorial at http://pdfapi2.sourceforge.net/cgi\-bin/view/Main/YourFirstDocument .IP "by Desislav Kamenov (@deskata on Twitter)" 4 .IX Item "by Desislav Kamenov (@deskata on Twitter)" The development of this module was supported by \s-1SEEBURGER AG\s0 (www.seeburger.com) till year 2007 .Sp Thanks to my friends Krasimir Berov and Alex Kantchev for helpful tips and \s-1QA\s0 during development of versions 0.9.0 to 0.9.5 .Sp Thanks to all GitHub contributors! .SH "CONTRIBUTION" .IX Header "CONTRIBUTION" Hey PDF::Table is on GitHub. You are more than welcome to contribute! .PP https://github.com/kamenov/PDF\-Table .SH "SEE ALSO" .IX Header "SEE ALSO" \&\s-1PDF::API2\s0