[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Image overflow in FOP

Subject: Image overflow in FOP
From: Sebastien <kamui.rouch@xxxxxxxxx>
Date: Wed, 5 Nov 2008 16:45:57 +0100
 Image overflow in FOP
Hi !
I'm using FOP 0.95 to generate a PDF from an XML document.
I'm using XSL-FO to make the transformation and i'm having
difficulties with images, especially making them to fit within page or
to jump over the next one.
All these images are SVG (within instream-foreign-object). The SVG is
made of a large JPG background imported with <svg:image> and one or
several <svg:path> or other basic shapes.
The only constraint i want for the images is to fit the page width,
and conserve aspect ratio.
That i managed to achieve it. But the problem is that the image
overflow the page height whenever there isn't enough room left at the
end of the page. Here is a screenshot of what the problem is:
http://img444.imageshack.us/my.php?image=imageoverflowbj6.png

What i want to do is making FOP to do a page-break when the image
can't fit into the page.
I tried every combinations of keep constraints with no luck.
I even tried to fix (or remove) the width and the height on the
instream-foreign-object but FOP still doesn't want to jump to the next
page :'(
Here are some screenshots of the result:
 - without width
http://img241.imageshack.us/my.php?image=imageoverflowwidthaz5.png
 - with smaller height (but still big enough to make the image bigger
than the space left at the end of page)
http://img504.imageshack.us/my.php?image=imageoverflowheightjs7.png

We can see that the image is very well scaled up/down but i can't make
FOP to break-page :'(

Here is the incriminated piece of code (corresponding to the first screenshot)
<fo:block>
 <fo:instream-foreign-object width="100%" content-width="scale-to-fit"
content-height="scale-to-fit">
  <svg:svg viewBox="519025 -6702573 5363 4051" height="2430px" width="3219px">
   <svg:image height="4051" width="5363" y="-6702573" x="519025"
xlink:href="file:///C:\bdd\docs\cartes\Scan25_Georef.jpg" />
    [some paths, rects and texts]
  </svg:svg>
 </fo:instream-foreign-object>
</fo:block>

It seems like one of the FOP known issue in the LayoutEngine, but i'm
not quite sure because i use instream-foreign-object instead of
external-graphic:
http://xmlgraphics.apache.org/fop/knownissues.html#Layout+Engine
(external-graphic don't shrink)

My questions are:
 - is it possible to do what i want (having a page-break whenever it's
needed) with instream-foreign-object (and with FOP) ?
 - in case it's not, how could i calculate the space left at the end
of page to decide whether i put a break-before="page" on the
corresponding block or not ? I saw some xpath in FOP testcases which
tried to access some kind of "internal properties" like viewports
etc... and i wondered whether it's possible for me to use these path
to retrieve the remaining free space (and for my culture: are these
paths part of the standard or specific to FOP ?)

Thanks in advance for your help, i'm stuck with this issue for days...

Some ressources i found (and tried whenever it applied to my pb, but
with no luck):
http://www.nabble.com/Image-overflow-td5982795.html
http://www.nabble.com/0.94-AND-0.95b-Images-to17627201.html#a17629647

For those who can understand french, here is a more detailed
description of my problem:
http://forum.hardware.fr/hfr/Programmation/XML-XSL/debordement-image-generer-sujet_118855_1.htm

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.