You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by paul womack <pw...@papermule.co.uk> on 2008/05/08 10:22:31 UTC

multiple outputs

If I want a TIFF and a PDF from the same input (xml + xsl), what's
my best course?

Clearly, running fop from the command line twice would work,
but can I get a performance "win" by converting to an intermediate fo
file, then doing a render run?

Or even making (and then using) a AT file?

Or can I reduce the fop startup overhead by running two
commands (how?) in the same instance?

  BugBear

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: multiple outputs

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
That has come up a number of times. To a certain degree, this is
possible, but PDF and TIFF(Java2D) use different font sources with
different font metrics which can lead to small differences between the
two output formats. See:
http://fop-users.markmail.org/message/n3myr6scq6afh7uz?q=tiff+pdf+output&page=2

The above example does the whole thing from the command-line but of
course, it's possible to do this in one JVM instance. 

See here for more information about the intermediate format (AT):
http://xmlgraphics.apache.org/fop/0.94/intermediate.html
From this information you should be able to derive how you can render
the same intermediate file twice to two different renderers.

On 08.05.2008 10:22:31 paul womack wrote:
> If I want a TIFF and a PDF from the same input (xml + xsl), what's
> my best course?
> 
> Clearly, running fop from the command line twice would work,
> but can I get a performance "win" by converting to an intermediate fo
> file, then doing a render run?
> 
> Or even making (and then using) a AT file?
> 
> Or can I reduce the fop startup overhead by running two
> commands (how?) in the same instance?
> 
>   BugBear



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: multiple outputs

Posted by Andreas Delmelle <an...@telenet.be>.
On May 8, 2008, at 14:06, paul womack wrote:
> Andreas Delmelle wrote:
>> If you would use FOP multiple times in a row, without restarting  
>> the JVM, then over a few runs that will save you minutes...
>> The very first run is always a lot slower due to static  
>> initialization, class loading etc. Once the VM is warmed up, the  
>> average runtime for a formatting run will drastically reduce. To  
>> see what I mean, you could already make the comparison: try 50  
>> isolated runs from the command-line, and afterwards, perform the  
>> same 50 runs, but then looped in a single small class.
>
> Hmm. As a compromise, I may be able to create a java class
> that accepts multiple "commandlines" from stdin.

A possible option: I once wrote a very small 'FOP server program'. No  
servlet container needed or anything, just a simple program that  
opens a socket, and listens for simple string requests in a form that  
suited me. A modified version of the example files, surrounded by an  
infinite loop.
If you know just a bit of Java, this should take only very little  
time. Programming threads and sockets in Java is a piece of cake,  
when compared to C.

Something like that suffices to keep the Java VM running until a  
forced shutdown, and avoid any startup overhead on all but the very  
first run.

I have only very little experience with Perl, but IIC, it should be  
equally straightforward to send the client request from within a script.

Maybe an idea for you.


HTH!

Cheers

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: multiple outputs

Posted by paul womack <pw...@papermule.co.uk>.
Andreas Delmelle wrote:
> 
> If you would use FOP multiple times in a row, without restarting the 
> JVM, then over a few runs that will save you minutes...
> The very first run is always a lot slower due to static initialization, 
> class loading etc. Once the VM is warmed up, the average runtime for a 
> formatting run will drastically reduce. To see what I mean, you could 
> already make the comparison: try 50 isolated runs from the command-line, 
> and afterwards, perform the same 50 runs, but then looped in a single 
> small class.

Hmm. As a compromise, I may be able to create a java class
that accepts multiple "commandlines" from stdin.

This could be driven either via a pipe from a script
(a sort of fop daemon) or via a command file, as per
egrep --file (etc)

I would prefer to avoid too much close-coupling with java
in my particular environment (system intgration,
coded in perl).

In conjunction with my requirment to have variable size
output, and 2 output formats, I think I need 3 runs
in total, so reducing startup overhead seems a useful
goal.

    BugBear

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: multiple outputs

Posted by Andreas Delmelle <an...@telenet.be>.
On May 8, 2008, at 10:22, paul womack wrote:

Hi

I see Jeremias has already given info about the AT, so I'll restrict  
myself to some other pointers that may be of use.

> If I want a TIFF and a PDF from the same input (xml + xsl), what's
> my best course?

One very convenient way to generate multiple outputs is to use FOP's  
Ant task.
That would not require much intervention or Java knowledge.

> Clearly, running fop from the command line twice would work,
> but can I get a performance "win" by converting to an intermediate fo
> file, then doing a render run?

We can't really say, without knowing more about the XSL transform. It  
depends on whether performing the same transform two times in a row  
weighs up to writing the fo to disk and reading it back again.
Note that you can optimize multiple identical transforms by using a  
cached javax.xml.transform.Templates based on the same stylesheet.  
That at least saves you from having to parse the stylesheet twice (or  
more?)

> <snip />
>
> Or can I reduce the fop startup overhead by running two
> commands (how?) in the same instance?

Have a look at the embedding examples:
http://xmlgraphics.apache.org/fop/0.95/embedding.html#examples

If you would use FOP multiple times in a row, without restarting the  
JVM, then over a few runs that will save you minutes...
The very first run is always a lot slower due to static  
initialization, class loading etc. Once the VM is warmed up, the  
average runtime for a formatting run will drastically reduce. To see  
what I mean, you could already make the comparison: try 50 isolated  
runs from the command-line, and afterwards, perform the same 50 runs,  
but then looped in a single small class.


HTH!

Cheers

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org