Do you have a question? Post it now! No Registration Necessary. Now with pictures!
May 25, 2005, 6:26 pm
rate this thread
I'd like to get some feedback about the name/functionality of this
module before I release it to cpan. Below is the POD:
XML::FOP - Access Apache FOP from Perl to create PDF files using
my $Fop = XML::FOP->new();
# create a PDF using a xml/xsl tranformation
outfile=>"temp1.pdf") or die "cannot create pdf: " . $Fop->errstr;
# create a PDF using an xsl-fo file
$Fop->fop(fo=>"foo.fo", outfile=>"temp2.pdf") or die
"cannot create pdf: " . $Fop->errstr;
# create a PostScript file using an xsl-fo file
rendertype=>"ps") or die "cannot create ps file: " . $Fop->errstr;
XML::FOP allows you to create PDFs (or other output types,
below) using Apache FOP.
Since FOP is written in Java, this module relies on Java.pm. You
need to have FOP and Java.pm installed before installing this
The biggest hurdle in getting this module to work will be
setting up FOP and Java.pm. I recommend you thoroughly read the FOP
Once you have them installed, you will need to make a change to the
JavaServer startup so that FOP will be accessible. Here is an
command to start the JavaServer on Linux:
Once the JavaServer is running you will be ready to start using
This will connect to the JavaServer and return a Fop object. It
if it cannot connect to the JavaServer.
The new call accepts a hash with the following keys: (note that
these options are the same as those in Java.pm)
host => hostname of remote machine to connect to
default is 'localhost'
port => port the JVM is listening on (JavaServer)
default is 2000
event_port => port that the remote JVM will send events to
default is 2001. If you specify '-1' for
value then the event service will be turned
if you're not doing any GUI work this might
a good idea as the second event port will
get used/opened saving some system
authfile => The path to a file whose first line is used as
shared 'secret' which will be passed to
JavaServer. To use this feature you must
JavaServer with the '--authfile=<filename>'
If the secret words match access will be
to this client. By default there is no
secret. See the 'Authorization' section in
Java.pm docs for more info.
debug => when set to true it will print various warn
messages stating what
the module is doing. Default is false.
allowed_paths => this is an array ref containing the
allowed paths for any filename
passed to this module (such as xml, xsl,
fo, or pdf filenames).
For example, if set to ['/home/foo'], then
only files within
/home/foo or its children directories will
be allowed. If any files
outside of this path are passed, the module
Default is undef, meaning files from
anywhere are allowed.
This makes the actual call to FOP.
The fop call accepts a hash with the following keys:
fo => path to the xsl-fo file, must I<not> be used with xml
xml => path to the xml file, must be used together with xsl
xsl => path to xsl stylesheet, must be used together with
outfile => filename to save the generated file as
rendertype => the type of file that should be generated.
Default is pdf. Also supports the following
mif - will be rendered as mif file
pcl - will be rendered as pcl file
ps - will be rendered as PostScript file
txt - will be rendered as text file
svg - will be rendered as a svg slides file
at - representation of area tree as XML
txt_encoding => if the 'txt' rendertype is used, this is
output encoding used for the outfile.
The encoding must be a valid java encoding.
s => if the 'at' rendertype is used, setting this to true
will omit the tree below block areas.
Will return 1 if the call is successfull.
Will return undef if there was a problem. In this case,
will contain a string explaining what went wrong.
Ken Prows (email@example.com)
SourceForge page for Java.pm/JavaServer:
FOP: http://xml.apache.org/fop /
COPYRIGHT and LICENSE
Copyright (C) 2005 Online-Rewards. All rights reserved.
This module is free software; you can redistribute it and/or modify
under the same terms as Perl itself.
- » ssh on command line: force using a group size (prime size) of 1024 (and no...
- — The site's Newest Thread. Posted in » Secure Shell Forum