PDF-Table

 view release on metacpan or  search on metacpan

INFO/Table.html  view on Meta::CPAN

<pre>    &#39;new_page_func&#39;  =&#62; $code_ref,</pre>

<dt><a 
><b>cell_render_hook</b> - CODE reference to a function called with the current cell coordinates. See section <a href="#Cell_Render_Hook" class="podlinkpod"
>&#34;Cell Render Hook&#34;</a> below.</a></dt>

<dd>
<pre>    &#39;cell_render_hook&#39;  =&#62; $code_ref,</pre>

<dt><a 
><b>header_props</b> - HASH reference to specific settings for the Header row of the table. See section <a href="#Header_Row_Properties" class="podlinkpod"
>&#34;Header Row Properties&#34;</a> below.</a></dt>

<dd>
<pre>    &#39;header_props&#39; =&#62; $hdr_props,</pre>

<dt><a name="row_props_-_HASH_reference_to_specific_settings_for_each_row_of_the_table._See_section_&#34;Row_Properties&#34;_below."
><b>row_props</b> - HASH reference to specific settings for each row of the table. See section <a href="#Row_Properties" class="podlinkpod"
>&#34;Row Properties&#34;</a> below.</a></dt>

<dd>
<pre>    &#39;row_props&#39; =&#62; $my_row_props,</pre>

<dt><a name="column_props_-_HASH_reference_to_specific_settings_for_each_column_of_the_table._See_section_&#34;Column_Properties&#34;_below."
><b>column_props</b> - HASH reference to specific settings for each column of the table. See section <a href="#Column_Properties" class="podlinkpod"
>&#34;Column Properties&#34;</a> below.</a></dt>

<dd>
<pre>    &#39;column_props&#39; =&#62; $col_props,</pre>

<dt><a name="cell_props_-_HASH_reference_to_specific_settings_for_each_column_of_the_table._See_section_&#34;Cell_Properties&#34;_below."
><b>cell_props</b> - HASH reference to specific settings for each column of the table. See section <a href="#Cell_Properties" class="podlinkpod"
>&#34;Cell Properties&#34;</a> below.</a></dt>

<dd>
<pre>    &#39;cell_props&#39; =&#62; $cell_props,</pre>

<dt><a name="border_w_-_Width_of_table_border_lines."
><b>border_w</b> - Width of table border lines.</a></dt>

<dd>
<dt><a 
><b>h_border_w</b> - Width of horizontal border lines (top and bottom of the table). Overrides &#39;border_w&#39; value for horizontal usage. Note that if the table spills over onto following pages, only the very first top and very last bottom table ...

<dd>
<dt><a name="v_border_w_-_Width_of_vertical_border_lines._Overrides_&#39;border_w&#39;_value_for_vertical_usage."
><b>v_border_w</b> - Width of vertical border lines. Overrides &#39;border_w&#39; value for vertical usage.</a></dt>

<dd>
<p><b>Value:</b> can be any positive number. When set to 0, it will disable border lines. This is the line thickness for drawing a border.</p>

<p><b>Default:</b> <code>1</code> ($border_w_default)</p>

<p>The <i>border</i> is the <b>outside</b> frame around the table. It does not enter into table height or width calculations, so be sure to set your <code>x</code> and <code>w</code> settings to allow for the width of vertical borders, and your <code...

<pre>    &#39;border_w&#39;     =&#62; 3,     # border width is 3
    &#39;h_border_w&#39;   =&#62; 1,     # horizontal borders will be 1, overriding 3
    &#39;v_border_w&#39;   =&#62; undef, # vertical borders will be 3, as it will 
                             # fall back to &#39;border_w&#39;</pre>

<p>Note that both borders and rules overlay the exact boundary between two cells (i.e., the centerline). That is, one half of a rule or border will overlay the adjoining cells. Rules do not expand the size of the table, although borders will (by a to...

<p><b>Deprecated names:</b> <i>border</i> (now &#39;border_w&#39;), <i>horizontal_borders</i> (now &#39;h_border_w&#39;), and <i>vertical_borders</i> (now &#39;v_border_w&#39;); will go away in the future!</p>

<dt><a name="border_c_-_Border_color_for_all_borders."
><b>border_c</b> - Border color for all borders.</a></dt>

<dd>
<p><b>Value:</b> Color specifier as &#39;name&#39; or &#39;#rrggbb&#39;</p>

<p><b>Default:</b> <code>&#39;black&#39;</code> ($fg_color_default)</p>

<pre>    &#39;border_c&#39; =&#62; &#39;red&#39;,</pre>

<p><b>Deprecated name:</b> <i>border_color</i> (will go away in the future!)</p>

<p>The same color is used for both the horizontal and vertical borders.</p>
</dd>
</dl>

<h4><a class='u' href='#___top' title='click to go to top of document'
name="Optional_Cell,_Column,_Row,_or_Global_Settings"
>Optional Cell, Column, Row, or Global Settings</a></h4>

<p>These settings can be specified to apply to the entire table, or more narrowly applied to the header row (in header_props hash), one or more rows (in row_props array), one or more columns (in column_props array), or one or more individual cells (i...

<p>If a setting is specified in more than one place, the order of precedence is as follows: a header property (header row only), followed by a cell property, followed by a column property, followed by a row property, followed by a global setting, and...

<p>A global setting may only occur once (although it may be overridden by cell, column, or row usage of the same setting).</p>

<dl>
<dt><a name="default_text_-_A_string_to_use_if_no_content_(text)_is_defined_for_a_cell."
><b>default_text</b> - A string to use if no content (text) is defined for a cell.</a></dt>

<dd>
<p>It is also used if a cell has exhausted its given text content, and has been split over a page break. This can happen if other cells in the row have much more text content than this cell. Therefore, it might be a good idea to <i>not</i> use a defa...

<p>Note that <code>max_word_length</code> splitting is <i>not</i> applied to the default text, so be careful about using long words.</p>

<p>If you want different effects for different rows, columns, or cells, you can override the global default setting. If you want <b>(No content)</b> for the first printout of a cell (split over two or more pages) and <b>-</b> for second and later pri...

<p><b>Value:</b> any string (can be a blank &#39; &#39; or an empty string &#39;&#39;).</p>

<p><b>Default:</b> &#39;-&#39; ($empty_cell_text)</p>

<dt><a name="max_word_length_-_Breaks_long_words"
><b>max_word_length</b> - Breaks long words</a></dt>

<dd>
<p>It may be necessary to break up long words (like serial numbers, hashes, etc.) to fit within a column, by adding a space after every Nth symbol, unless a space (x20) is found already in the text.</p>

<p><b>Note</b> that this does <i>not</i> add a hyphen (dash)! It merely ensures that there will be no runs of non-space characters longer than <i>N</i> characters, reducing the chance of forcing an overly wide column.</p>

<p><b>Value:</b> can be any positive integer number (character count)</p>

<p><b>Default:</b> <code>20</code></p>

<pre>    &#39;max_word_length&#39; =&#62; 25,    # Will add a space after every 25 symbols
                                # unless there is a natural break (space)</pre>

<dt><a name="padding_-_Padding_applied_to_every_cell"

INFO/Table.html  view on Meta::CPAN


<p><b>Default:</b> <code>font_size + padding_top + padding_bottom</code></p>

<pre>    &#39;min_rh&#39; =&#62; 24,</pre>

<p><b>Deprecated name:</b> <i>row_height</i> (will go away in the future!)</p>

<dt><a name="justify_-_Alignment_of_text_in_a_cell."
><b>justify</b> - Alignment of text in a cell.</a></dt>

<dd>
<p><b>Value:</b> One of &#39;left&#39;, &#39;right&#39;, &#39;center&#39;</p>

<p><b>Default:</b> <code>&#39;left&#39;</code></p>

<dt><a name="min_w_-_Minimum_width_of_this_cell_or_column."
><b>min_w</b> - Minimum width of this cell or column.</a></dt>

<dd>
<p>PDF::Table will set a cell (and the column it&#39;s in) minimum width to fit the longest word (after splitting on <code>max_word_length</code>) found in the text. This amount may be increased to <code>min_w</code>. A column should be no narrower t...

<p><b>Value:</b> can be any number satisfying <code>0 &#60; min_w &#60; w</code></p>

<p><b>Default:</b> Auto calculated</p>

<p>Note that <code>min_w</code> is usually used for a column_props to set the column minimum width. If used in a row_props, it will act as a <i>global</i> setting; if used in a cell_props, that will force the minimum width for the cell&#39;s column.<...

<dt><a name="max_w_-_Maximum_width_of_this_column."
><b>max_w</b> - Maximum width of this column.</a></dt>

<dd>
<p>PDF::Table will set a cell (and the column it&#39;s in) maximum width to fit the total length of the text content. This will seldom be actually used, but <code>max_w</code> may be used to <i>reduce</i> this maximum. When columns are being widened ...

<p><b>Value:</b> can be any number satisfying <code>0 &#60; min_w &#8804; max_w &#60; w</code></p>

<p><b>Default:</b> Auto calculated</p>

<dt><a name="rule_w_-_Width_of_table_rule_lines_(internal_table_dividers)."
><b>rule_w</b> - Width of table rule lines (internal table dividers).</a></dt>

<dd>
<dt><a name="h_rule_w_-_Width_of_horizontal_rules_(bottom_of_a_cell)._Overrides_&#39;rule_w&#39;_value_for_horizontal_usage."
><b>h_rule_w</b> - Width of horizontal rules (bottom of a cell). Overrides &#39;rule_w&#39; value for horizontal usage.</a></dt>

<dd>
<dt><a name="v_rule_w_-_Width_of_vertical_rules_(left_side_of_a_cell)._Overrides_&#39;rule_w&#39;_value_for_vertical_usage."
><b>v_rule_w</b> - Width of vertical rules (left side of a cell). Overrides &#39;rule_w&#39; value for vertical usage.</a></dt>

<dd>
<p><b>Value:</b> can be any positive number. When set to 0, it will disable rules. This is the line thickness for drawing a rule.</p>

<p><b>Default:</b> <code>1</code> (corresponding border value)</p>

<p>A <i>rule</i> is a line bordering a <i>cell</i> in the table. While it does not enter into table height or width calculations, be sure to set your <code>padding</code> settings to allow sufficient clearance of cell content, especially if you make ...

<pre>    &#39;rule_w&#39;     =&#62; 3,     # rule width is 3
    &#39;h_rule_w&#39;   =&#62; 1,     # horizontal rules will be 1, overriding 3
    &#39;v_rule_w&#39;   =&#62; undef, # vertical rules will be 3, as it will 
                           # fall back to &#39;rule_w&#39;</pre>

<p>Note that both borders and rules overlay the exact boundary between two cells (i.e., the centerline). That is, one half of a rule or border will overlay the adjoining cells. Rules do not expand the size of the table. If you set particularly thick ...

<p>Cell rules inherit thickness and color from the border settings, so if you want no internal rules, you need to set</p>

<pre>    &#39;rule_w&#39;     =&#62; 0,     # no rules</pre>

<dt><a name="rule_c_-_Rule_color_for_all_rules."
><b>rule_c</b> - Rule color for all rules.</a></dt>

<dd>
<dt><a name="h_rule_c_-_Rule_color_for_horizontal_(bottom)_rules,_overriding_rule_c_for_this_usage."
><b>h_rule_c</b> - Rule color for horizontal (bottom) rules, overriding <code>rule_c</code> for this usage.</a></dt>

<dd>
<dt><a name="v_rule_c_-_Rule_color_for_vertical_(left)_rules,_overriding_rule_c_for_this_usage."
><b>v_rule_c</b> - Rule color for vertical (left) rules, overriding <code>rule_c</code> for this usage.</a></dt>

<dd>
<p><b>Value:</b> Color specifier as &#39;name&#39; or &#39;#rrggbb&#39;</p>

<p><b>Default:</b> <code>&#39;black&#39;</code> (corresponding border value)</p>

<pre>    &#39;rule_c&#39; =&#62; &#39;red&#39;,</pre>
</dd>
</dl>

<h4><a class='u' href='#___top' title='click to go to top of document'
name="New_Page_Function_Hook"
>New Page Function Hook</a></h4>

<p><b>new_page_func</b> is a CODE reference to a function that returns a PDF::Builder::Page instance.</p>

<p>If used, the parameter &#39;<code>new_page_func</code>&#39; must be a function reference which, when executed, will create a new page and will return the object to the module. For example, you can use it to put Page Title, Page Frame, Page Numbers...

<pre>    &#39;new_page_func&#39;  =&#62; $code_ref,</pre>

<p>The <code>$code_ref</code> may be an inline sub definition (as show below), or a regular named <code>sub</code> (e.g., &#39;new_page()&#39;) referenced as <code>\&#38;new_page</code>. The latter may be cleaner than inlining, if the routine is quit...

<p>An example of reusing a saved PDF page as a <i>template</i>:</p>

<pre>    my $pdf      = PDF::API2-&#62;new();
    my $template = PDF::API2-&#62;open(&#39;pdf/template.pdf&#39;);
    my $new_page_func = sub { return $pdf-&#62;import_page($template, 1); }

    table(
        ...
        new_page_func =&#62; $new_page_func,
        ...</pre>

<p>This will call a function to grab a copy of a template PDF&#39;s page 1 and insert it as the new last page of the PDF, as the starting point for the next <i>overflow</i> (continuation) page of the table, if needed. Note that the <code>$template-&#...

<p>You can also create a blank page and prefill it with desired content:</p>

<pre>    my $pdf      = PDF::API2-&#62;new();
    my $new_page_func = sub { 
        my $page = $pdf-&#62;page(); # so far, no difference from default behavior
        $page-&#62;mediaBox(...);  # set page size/orientation, etc.
        my $text = $page-&#62;text();
        # set font, placement, etc.
        $text-&#62;text(...);  # write header, footer, etc.
        ...



( run in 1.897 second using v1.01-cache-2.11-cpan-39bf76dae61 )