Gossamer Forum
Home : General : Perl Programming :

module for PDF creation

Quote Reply
module for PDF creation
Can anyone recommend a module for generating PDF files?

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] module for PDF creation In reply to
I recently installed this on my server.....works really nicely....

http://www.easysw.com/htmldoc/
Quote Reply
Re: [yogi] module for PDF creation In reply to
PDF::Create

http://search.cpan.org/...01/lib/PDF/Create.pm

- wil
Quote Reply
Re: [Wil] module for PDF creation In reply to
Thanks for both your replies.

Wil, have you used this module? It seems to be a bit 'old', i.e. it's version 0.01 from 1999 (I am just wondering if it's still maintained....).

Paul, this looks good, but I am more looking for an actual perl module to do the job.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] module for PDF creation In reply to
You can use it from your perl script...using a system call but for perl modules I'd recommend:

http://search.cpan.org/...PDF-API2-0.2.3.8_fix

It is very new though....may be "too" new.

You may find some others here:

http://search.cpan.org/...module&query=PDF

Last edited by:

Paul: Jul 1, 2002, 2:58 AM
Quote Reply
Re: [yogi] module for PDF creation In reply to
Hi yogi

I've used PDF -> http://search.cpan.org/...ANTRO/PDF-111/PDF.pm before. It worked very well for me in creating A5 pages out of information from a database.

Cheers

- wil
Quote Reply
Re: [Paul] module for PDF creation In reply to
Hi Paul

I was testing HTMLdoc, and it works fine. I does what I want, namely produce a PDF file from a html like template. The other modules were to low-level for my purposes, and PDF::Template need PDFlib installed.

Have you ever tried to use HTMLdoc from within a perl script? The problem I am having is that I cannot get it to work when my input is a string. In the manpage it says you should do

htmldoc [options] -

and it would read from STDIN. Do you know how that works?

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] module for PDF creation In reply to
This should work....
Code:
system "htmldoc -t pdf --quiet --webpage -f /path/to/some_pdf_name.pdf /path/to/some_html_file.html"

Last edited by:

Paul: Jul 2, 2002, 6:06 AM
Quote Reply
Re: [Paul] module for PDF creation In reply to
Thanks for your answer.

Yes, this works, but the problem is that I don't have some_html_file.html saved on disk, I have a string $out that I want to make into a pdf.

What I have now (using GT::TempFile)
Code:
my $tpl = new GT::Template;
my $out = $tpl->parse('template.html', {test => 'test tag'});

my $file = new GT::TempFile;
open (FILE, "> $$file");
print FILE $out;
close FILE;

system qq{htmldoc -t pdf --quiet --webpage -f template.pdf $$file};
But rather than using a tempfile, I would like to be able to produce the pdf directly.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [Paul] module for PDF creation In reply to
For future reference, this works:
Code:
my $tpl = new GT::Template;
my $out = $tpl->parse('template.html', {test => 'test tag'});

open (FILE, "|htmldoc -t pdf --quiet --webpage -f template.pdf -");
print FILE $out;
close FILE;
i.e. set up the FILE filhandle as an output filter.

Ivan
-----
Iyengar Yoga Resources / GT Plugins