perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luiz Fernando B. Ribeiro" <l...@engenhosolucoes.com.br>
Subject Re: pdf generation
Date Mon, 20 Sep 2004 15:32:58 GMT
Ben Kim wrote:
> Dear list,
> 
> 1. pdf generation 
> I'd like to learn what people use to generate pdf files. I want to
> create pdf from an epl page, with all data from the database.

Take a look at the FOP project from the Apache Group. It's a Java 
subsystem able to render PDF from a xml file.
http://xml.apache.org/fop/

The way to generate the xml from your epl pages depends on whether you 
are using Embperl 2 or 1.

Below is a simple schema to achieve this with Embperl 1.3.6:
[-
my $html;
Execute({
	inputfile => 'your_page.epl',
	output => \$html,
});

$xml_fop = html2fop($html);
open F, "> /tmp/page.fop";
print F $xml_fop;
close F;

system('/path/to/fop/fop.sh', '/tmp/page.fop', '/tmp/page.pdf');
-]

The function html2fop have to manipulate the html and transform the 
elements into a FOP document. This can also be done with XSLT.

> 
> 2. Teeing the output to browser / filesystem
> 
> Related with this, I'd also like to know whether there's a way to print
> the html results of the database-driven epl page into a static html file.
> 
> The problem I have is that the epl pages are protected, and I don't want
> to mess with session id and other auth tokens when I use htmldoc. So it
> will have to output the result sent to the browser also to the filesystem.
> (Tee'd.)

The above recipe also shows how to do this.

Luiz Fernando B. Ribeiro
Engenho Soluções para a Internet
+55 11 4485-0136

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message