|
Posted by x3v0-usenet on May 25, 2005, 2:26 pm
Please log in for more thread options
I'd like to get some feedback about the name/functionality of this
module before I release it to cpan. Below is the POD:
NAME
XML::FOP - Access Apache FOP from Perl to create PDF files using
XSL-FO.
SYNOPSIS
use XML::FOP;
my $Fop = XML::FOP->new();
# create a PDF using a xml/xsl tranformation
$Fop->fop(xml=>"foo.xml", xsl=>"bar.xsl",
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
$Fop->fop(fo=>"foo.fo", outfile=>"temp3.ps",
rendertype=>"ps") or die "cannot create ps file: " . $Fop->errstr;
DESCRIPTION
XML::FOP allows you to create PDFs (or other output types,
explained
below) using Apache FOP.
Since FOP is written in Java, this module relies on Java.pm. You
will
need to have FOP and Java.pm installed before installing this
module.
SETUP
The biggest hurdle in getting this module to work will be
installing and
setting up FOP and Java.pm. I recommend you thoroughly read the FOP
and
Java.pm documentation.
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
example
command to start the JavaServer on Linux:
/path/to/java -classpath
/path/to/fop.jar:/path/to/JavaServer.jar com.zzo.javaserver.JavaServer
Once the JavaServer is running you will be ready to start using
this
module.
METHODS
new
This will connect to the JavaServer and return a Fop object. It
will die
if it cannot connect to the JavaServer.
The new call accepts a hash with the following keys: (note that
many of
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
this
value then the event service will be turned
off -
if you're not doing any GUI work this might
be
a good idea as the second event port will
NOT
get used/opened saving some system
resources.
authfile => The path to a file whose first line is used as
a
shared 'secret' which will be passed to
JavaServer. To use this feature you must
start
JavaServer with the '--authfile=<filename>'
command-line option.
If the secret words match access will be
granted
to this client. By default there is no
shared
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
will die.
Default is undef, meaning files from
anywhere are allowed.
fop
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
and xsl
xml => path to the xml file, must be used together with xsl
xsl => path to xsl stylesheet, must be used together with
xml
outfile => filename to save the generated file as
rendertype => the type of file that should be generated.
Default is pdf. Also supports the following
formats:
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
the
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,
$Fop->errstr
will contain a string explaining what went wrong.
AUTHOR
Ken Prows (perl@xev.net)
SEE ALSO
Java.pm: Java.
SourceForge page for Java.pm/JavaServer:
http://sourceforge.net/projects/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
it
under the same terms as Perl itself.
|
| Similar Threads | Posted | | Proposed Module: Compress::AsciiFlate | March 10, 2006, 6:37 am |
| Proposed module: Number::NaryPP | March 10, 2006, 6:46 am |
| Proposed module: Music::ChordNamer | March 14, 2006, 1:57 pm |
| Re: Proposed CPAN Module: Tk::Canvas::Music (renamed to Tk::Music) | December 5, 2005, 2:18 am |
| Proposed Name Space DBIx::CopyRecords | December 31, 2006, 2:18 pm |
| Naming consultation request (proposed Geo::ReadGRIB) | April 25, 2006, 2:35 pm |
| Request for feedback: proposed new modules to aid VHDL projects | February 24, 2006, 9:49 am |
| Lower case module name for non-pragma module | January 4, 2005, 10:19 am |
| RFC: New module 'Module::Bundled::Files' | August 26, 2005, 3:49 pm |
| help with an MD5.pm module!! | September 3, 2005, 11:39 pm |
|