New module proposed: XML::FOP

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

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

            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=>"", outfile=>"temp2.pdf") or die
"cannot create pdf: " . $Fop->errstr;

            # create a PostScript file using an xsl-fo file
            $Fop->fop(fo=>"", outfile=>"",
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 You
    need to have FOP and installed before installing this

    The biggest hurdle in getting this module to work will be
installing and
    setting up FOP and I recommend you thoroughly read the FOP
and 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
    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 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

            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
off -
                            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>'
                            command-line option.
                            If the secret words match access will be
                            to this client.  By default there is no
                            secret.  See the 'Authorization' section in 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.

    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

            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 (


    SourceForge page for /

    FOP: /

    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.

Site Timeline