http://www.perlmonks.org?node_id=1013734

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

    lighterjoul:

    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.

    ...roboticus

    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 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.

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 www.cpan.org .This might help you