Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

create tables with text and images in pdf

by lighterjoul (Initiate)
on Jan 17, 2013 at 09:16 UTC ( #1013734=perlquestion: print w/replies, xml ) Need Help??
lighterjoul has asked for the wisdom of the Perl Monks concerning the following question:

Hi everyone! I wanna to create a pdf with perl, and that pdf will contain a table ( a column with images, other columns with text), can anyone gives me some hints? the data might like this.
@data=[['col text1', 'col text1', image path1 ], ['col text2', 'col text2', image path2 ], ['col text3', 'col text3', image path3 ], .... ];
I searched google, and find the pdf::reportWriter, but I still can not find the related example for this requirement. Best wishes!

Replies are listed 'Best First'.
Re: create tables with text and images in pdf
by roboticus (Chancellor) on Jan 17, 2013 at 11:54 UTC


    I'd second ree's suggestion to use a package to do the heavy lifting for you. Laying out documents from scratch can be a bit tedious, especially when items are wont to move around from run to run. I've not tried the suggested module (HTML::HTMLDoc), but a little digging through cpan may help you find a module that you can use with minimal fuss.

    However, if you want to learn how to build PDF documents from scratch, you could find some examples here among the older nodes. The one I started with a year or so ago is Making Sudoku Puzzles Using PDF::API2. It's reasonably short, and shows how you can easily position text and draw simple graphics at different locations on a page.


    When your only tool is a hammer, all problems look like your thumb.

      Thank you roboticus, I will check that. :) I had known how to create the images and text in pdf, but what I want to find is just want to create table dynamically both containing text column and iamge column. I will search in CPAN later..:)
Re: create tables with text and images in pdf
by nithins (Sexton) on Jan 17, 2013 at 09:33 UTC

    search for PDF::API2 in .This might help you

Re: create tables with text and images in pdf
by vinoth.ree (Monsignor) on Jan 17, 2013 at 10:26 UTC

    I used this module to create PDF files CAM::PDF

    Suppose If you have your data in HTML content, you can use the HTML::HTMLDoc It turns HTML documents into PDF.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1013734]
Approved by Corion
NodeReaper puts the hammer down

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2018-01-19 06:30 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (215 votes). Check out past polls.