Mimic renderer with FOP called from Oxygen XML Editor

Here should go questions about transforming XML with XSLT and FOP.
sermo_de_arboribus
Posts: 3
Joined: Thu May 02, 2013 6:18 pm

Mimic renderer with FOP called from Oxygen XML Editor

Post by sermo_de_arboribus »

When I was getting the area tree XML out from the FOP renderer that I called from Oxygen XML editor, I noticed that the pagination and page-breaking of the area tree is not identical with the page-breaks in the PDF produced from the same source file with the same FOP renderer. On the Apache FOP site I found the information, that one needs to "mimic a renderer" in order to ensure the area tree to be identical with the actual PDF output. They suggest to call the XML renderer's mimicRenderer() method with an instance of the PDF renderer as the parameter (see http://xmlgraphics.apache.org/fop/1.1/i ... html#usage. Is there any way to configure Oxygen XML editor so it would take care of this task when calling FOP?
Kai Weber
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Mimic renderer with FOP called from Oxygen XML Editor

Post by sorin_ristache »

Hello,
sermo_de_arboribus wrote:the area tree XML out from the FOP renderer that I called from Oxygen XML editor
I don't know exactly what you mean. Please give an example.
sermo_de_arboribus wrote:the pagination and page-breaking of the area tree is not identical with the page-breaks in the PDF produced from the same source file with the same FOP renderer
An example is needed of both the area tree and the PDF output.
sermo_de_arboribus wrote:Is there any way to configure Oxygen XML editor so it would take care of this task when calling FOP?
Calling an internal method of the FOP processor should not be needed. If you have an XSL-FO file Oxygen can apply Apache FOP to that fiel for generating a PDF result. I don't see why you would need to call an internal method of the FOP processor. Maybe you can give a short example of the output that you get now and the output that you would want to get in order to compare them and find the differences.


Regards,
Sorin
sermo_de_arboribus
Posts: 3
Joined: Thu May 02, 2013 6:18 pm

Re: Mimic renderer with FOP called from Oxygen XML Editor

Post by sermo_de_arboribus »

Hi Sorin,
I don't know exactly what you mean. Please give an example.
In the Oxygen Developer's transformation scenario, I configure the FO processor to use the method "at", which will result in an Area Tree XML file, as described in the Apache FOP website as one of the intermediate formats:

Image

I think I need to use / manipulate this area tree, because I want to do some index processing that can only be done after the page-flow has been arranged by FOP. That's because the XSL-FO 1.1 properties for indexing (http://xmlgraphics.apache.org/fop/compl ... ng-section) are not supported by FOP. Let me give an example:

If I use normal <fo:page-number-citation> elements for every indexed term in the text flow, I might end up with an index entry like this:
pragmatic 29, 30, 30, 35, 36, 37, 49, 59, 59, 59, 59, 109
But normally we would expect an index entry to look something like this:
[quuote]pragmatic 29, 30, 35-37, 49, 59, 109[/quote]

To eliminate duplicate page numbers can only be done in the area tree of FOP, as far as I know, because pagination information isn't available in the FO file. So far things seemed clear to me. My problem began when I recognized that the page numbers differ from the PDF output when I use the "at" method in the Oxygen transformation scenario's FO configuration. Which is then making the whole area tree useless, because I cannot be sure that the page numbers in the area tree's index are identical with the page numbers in the PDF. And that's where the info from http://xmlgraphics.apache.org/fop/1.1/i ... html#usage comes in: to ensure that the area trees makes the same page breaking decisions as the pdf renderer, the area tree renderer has to mimic the pdf renderer.

Hope I'm writing in an intelligible enough way to make the problem clear. If not, don't hesitate to ask further for specifics.

Best regards,
Kai Weber
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Mimic renderer with FOP called from Oxygen XML Editor

Post by sorin_ristache »

Hi,

Now I understand, thank you for the details. In Oxygen you do not have access to the internal code of the FOP processor, so you cannot call an internal method like mimicRenderer(). In Oxygen you can only call the FOP processor as you would from a command line, that is pass the input file, set the processing method (at, pdf, etc), so I am afraid you cannot modify the default at output of FOP by setting a different renderer (the PDF renderer) as parameter for the at transformation.


Regards,
Sorin
sermo_de_arboribus
Posts: 3
Joined: Thu May 02, 2013 6:18 pm

Re: Mimic renderer with FOP called from Oxygen XML Editor

Post by sermo_de_arboribus »

I've reread the "Intermediate format" info in the FOP documentation and found that there's a command line option for mimicing a renderer. (How could I have overlooked that in the first place?)
So it's easily possible to set up Oxygen in a way that it calls FOP with the right command line option. Just go to the transformation scenario's "FO-processor" tab. In the "method" line just write
at application/pdf
Pagination in the area tree output will then be identical with the pagination in the PDF output. Hope this information will save others some time...
Kai Weber
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Mimic renderer with FOP called from Oxygen XML Editor

Post by sorin_ristache »

Hello Kai,

Thank you for letting us know. For other users: the FO method can be specified by editing the Method value in the FO Processor tab of the dialog box for editing the transformation.


Thank you Kai,
Sorin
Post Reply