I'd like to hear if you have any suggestions regarding the problem of
inserting floating elements in general and textboxes in particular on a pdf
using Apache-Fop.

 I know this isn't a concrete nor easy question, but please bear with me, I
only want to hear your opinion based on your experience. I use Java with
XSLT stylesheets and Apache-Fop to transform a Wordml document into a PDF.

I try to obtain the data of a textbox in wordml and redraw it in the pdf
using SVG, but I can only insert the svg elements on the same order as they
appear in the original XML file. So, if a textbox that has to appear in the
top of a page is in the xml after another textbox that has to appear at the
bottom of the page, I read first the bottom one and insert it, and then the
top one and insert it, so they appear reversed in the resulting pdf. I know
that this could be solved using some kind of algorithm that takes every
textbox in the Wordml then orders them by their "margin-top" attribute, that
contains their position relative to the page wherein they appear, but this
isn't possible to me, both for complexity and performance reasons. Also, the
fact that I can only modify the dimensions of each SVG element but not its
position means that, if (for example) two textboxes overlap, I'll have to
create a SVG element big enough for the two of them and put the two
textboxes inside, otherwise if I create two SVG elements they would appear
first one then another, so they won't overlap. Same as before, an
algorhitmic solution would be very difficult and ridden with exceptions.

Is there something I am missing, or do you think I should change my approach
altogether, and use another mechanism for inserting textboxes or other
floating elements using Apache-Fop?

Thanks for reading this far, and please let me hear from you.

Reply via email to