Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: Looping in PDF::Table module

by rnewsham (Curate)
on Jul 25, 2013 at 07:12 UTC ( [id://1046273]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Looping in PDF::Table module
in thread Looping in PDF::Table module

The properties x, start_y, next_y, start_h, next_h define the coordinates and size of the table. The start_y and start_h set the table position and height on the first page of the pdf. If there is more data than can be displayed on the first page it will continue on further pages with the y coordinates and height defined by next_y and next_h.

Here is an example that I extracted from one of my working programs, I have trimmed it down to remove irrelevant code so it is not a complete working example but should give you an idea.

use PDF::API2; use PDF::Table; my $pdftable = new PDF::Table; my $pdf = new PDF::API2(-file => 'reports/report.pdf'); $pdf->mediabox('A4'); my $page = $pdf->page; # define header properties my $hdr_props = { # This param could be a pdf core font or user specified TTF. # See PDF::API2 FONT METHODS for more information font => $pdf->corefont("Times", -encoding => "utf8"), font_size => 10, font_color => '#555555', bg_color => 'grey', repeat => 1, # 1/0 eq On/Off if the header row should be repea +ted to every new page }; # build the table layout $pdftable->table( # required params $pdf, $page, \@pdf_report_data, # report data in an array of hashes x => 50, w => 495, start_y => 755, # sets the y position of the table on the firs +t page next_y => 775, # sets the y position of tables on subsequent +pages start_h => 730, # sets the height of the table on the first pa +ge next_h => 750, # sets the height of the table on subsequent p +ages # some optional params padding => 5, padding_right => 10, background_color_odd => "white", # cell background colour f +or odd rows background_color_even => "lightgrey", # cell background colour f +or even rows header_props => $hdr_props, # loads the header properties as d +efined above ); # do other stuff with $pdf # save pdf $pdf->saveas();

Replies are listed 'Best First'.
Re^4: Looping in PDF::Table module
by divinafaudan (Initiate) on Jul 25, 2013 at 09:17 UTC
    Thank you for your reply rnewsham, i get your point. Sorry for my last post, i wasn't able to fully explain it. My problems occur because i created more than 1 table and i make sure that the second and so on tables looks attached to the end of the first table/table before the next table. I did this because i can't merge columns and rows using pdf::table module. Is it possible to merge columns and rows using pdf::table? if there is a way to do it, it will save me a lot from all the troubles i am facing right now.

      It does not appear to be a documented feature and a quick skim of the modules source and I can't see anything to suggest such a capability.

      You have raised an interesting issue that may slow my own adoption of PDF::Table. It looks like you will need to contact the authors and see if the functionality could be added. The code does not look particularly complicated so if they don't add it by the time I need it I will do it myself, unfortunately I have no need at the moment and more urgent matters need my attention so it won't be anytime soon.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1046273]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-25 17:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found