Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^3: Creating PDF files with Perl

by holli (Monsignor)
on May 10, 2011 at 13:02 UTC ( #903976=note: print w/replies, xml ) Need Help??

in reply to Re^2: Creating PDF files with Perl
in thread Creating PDF files with Perl

Due to popular demand ^^, here is a hello world example:
use warnings; use strict; use Template; # create Template object my $ttt = Template->new(); # define template variables for replacement my $replacements = { name => "holli" }; my $template = join ("", <DATA>); # process input template, substituting variables and save it to disk $ttt->process( \$template, $replacements, "output.xml") || die $templa +te->error(); #call fop and translate xml file to pdf system "d:\\fop-1.0\\fop.bat -fo output.xml -pdf output.pdf" __DATA__ <?xml version="1.0" encoding="iso-8859-1"?> <fo:root xmlns:fo=""> <fo:layout-master-set> <fo:simple-page-master master-name="my-page"> <fo:region-body margin="1in"/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="my-page"> <fo:flow flow-name="xsl-region-body"> <fo:block>Hello, [% name %]!</fo:block> </fo:flow> </fo:page-sequence> </fo:root>
Instead of running fop via system, you might also look at XML::ApacheFOP.


You can lead your users to water, but alas, you cannot drown them.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://903976]
[Discipulus]: each node has 2 descendants only: can i just compose hash keys usinng coords?
[karlgoethebier]: Discipulus: you shouldn't smoke turkish spices before noon
[Discipulus]: karl you says the same of my mom: in your place I'd been
[Discipulus]: preoccupied.. ;=)
Discipulus stopped with turkisk spices anyway.. but better hashes than arrays!
[oiskuu]: Discipulus, from the edge or from the top?
[Discipulus]: oiskuu from the top aka 0-0 coords
[LanX]: edge or node?
[oiskuu]: from each height difference, there's a fixed number of "moves right" - "moves left". So it's a number of combinations.

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (12)
As of 2018-03-19 10:59 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (239 votes). Check out past polls.