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 "Burton, Jeff" <je...@plantops.ubc.ca> on 2006/04/28 17:52:14 UTC

upgrade to fop 0.92 - image problem (no wrap)

I've just upgraded to FOP 0.92 (from 0.20.5)  to take advantage of the keep-together support, but I've encountered a new problem.

I have an xml file that contains image links (0-10 images) that is used to create a pdf (I'm using the oxygen editor which has xalan built in and I use fop 0.92 to create the pdf)

First problem was image scaling/size, that was fixed from information at this link http://issues.apache.org/bugzilla/show_bug.cgi?id=37136

next problem is that while images used to just be put on (wrap to) the next line when there are too many to fit in the width of the page, now they just run off the page to the right. I haven't been able to cure this one.

I've tried setting the width of the containing fo:block but that changes nothing. Text wraps nicely, but the images do not. I'm sure there is something that I need to specify, but I have been unable to find what it might be either from my friend google or the 'manual'. Possibly I don't know what I am looking for, I am very new with xsl:fo.

My code for the xsl:

<fo:block margin-left="2em" margin-right="2em">
                              <xsl:for-each select="pb/pic">
                                 <xsl:choose>
                                    <xsl:when test="@orientation='p'">
                                       <fo:external-graphic width="3cm" height="4cm" content-height="scale-to-fit" content-width="scale-to-fit"
                                          padding="0.3em"
                                          src="url('./pics/t_{@src}')'"/>
                                       <fo:leader leader-length="0.75em"
                                          leader-pattern="space"/>
                                    </xsl:when>
                                    <xsl:otherwise>
                                       <fo:external-graphic width="4cm" height="3cm" content-height="scale-to-fit" content-width="scale-to-fit"
                                          padding="0.3em"
                                          src="url('./pics/t_{@src}')"/>
                                       <fo:leader leader-length="0.75em"
                                          leader-pattern="space"/>
                                    </xsl:otherwise>
                                 </xsl:choose>
                              </xsl:for-each>
                           </fo:block>

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


Re: upgrade to fop 0.92 - image problem (no wrap)

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
With your snippet I can't reproduce the exception. You might want to
make a complete (but reduced) example available. Inserting
<fo:inline>&#x200B;</fo:inline> seems to do the job to allow line breaks
between images.

The exception below means that you've got content that is held together
but does not fit onto a page in vertical direction. If you have a keep
somewhere, it could explain the exception. Try removing any keeps to see
if it helps the situation.

On 01.05.2006 23:38:10 Burton, Jeff wrote:
> Thank you for your help... sorry for not including the fo code.
> 
> I've tried putting in that zero space width character... (Character
> entity for zero-width-space seems to be '&#x200b;' or '&#8203;'(<that
> one is the one suggested by my editor) rather than (&#200b;)the later
> isn't accepted by my editor)... When I add this i get the error below:
> Error Mssg:
> SEVERE: Exception
> java.lang.RuntimeException: Some content could not fit into a line/page
> after 50 attempts. Giving up to avoid an endless loop. (fo:block,
> location: 208/313)
> 
> If I take out that section (<fo:inline>&#x200b;</fo:inline>) from the
> xsl and use just the char ref, it still doesn't work.  If I take out
> either and leave it the way it was before, it works, but the photos
> don't line break as they were doing before (and as such, was expected)
> 
> the code is attached, the first chunk is when i include the
> <fo:inline>&#x200b;</fo:inline> and the second a chucnk from the same
> seciton with a little ore context as it was before I added the zero
> width spaces.
> 
> I had a look at the mailing list topic you mentioned
> (http://marc.theaimsgroup.com/?l=fop-dev&m=113151196116514&w=2) and it
> sounds like simply wrapping those e-g in the zero space width char
> should do the trick... but for some reason it is not... As I said, I am
> new at this...if you have any idea why this isn't working... thank you
> for your help.

<snip/>



Jeremias Maerki


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


Re: upgrade to fop 0.92 - image problem (no wrap)

Posted by Manuel Mall <ma...@apache.org>.
On Friday 28 April 2006 23:52, Burton, Jeff wrote:
> I've just upgraded to FOP 0.92 (from 0.20.5)  to take advantage of
> the keep-together support, but I've encountered a new problem.
>
> I have an xml file that contains image links (0-10 images) that is
> used to create a pdf (I'm using the oxygen editor which has xalan
> built in and I use fop 0.92 to create the pdf)
>
> First problem was image scaling/size, that was fixed from information
> at this link http://issues.apache.org/bugzilla/show_bug.cgi?id=37136
>
> next problem is that while images used to just be put on (wrap to)
> the next line when there are too many to fit in the width of the
> page, now they just run off the page to the right. I haven't been
> able to cure this one.
>
> I've tried setting the width of the containing fo:block but that
> changes nothing. Text wraps nicely, but the images do not. I'm sure
> there is something that I need to specify, but I have been unable to
> find what it might be either from my friend google or the 'manual'.
> Possibly I don't know what I am looking for, I am very new with
> xsl:fo.
>
<snip/>

Jeff,

with the XSL alone its difficult to tell whats going on. Can you post 
the actual .fo file produced, that is the XALAN output before it goes 
into FOP. And please cut that output down to the smallest possible file 
still exhibiting the problem.

I believe there is a difference in line breaking behaviour between 
0.20.5 and 0.92 when it comes to <fo:external-graphic> and 
<fo:instream-foreign-object> elements (See the fop-dev mailing list for 
a topic called 'Linebreaks around e-g and i-f-o'). If you have 
consecutive <fo:external-graphic> elements without any spaces between 
them 0.92 will not break between those elements while 0.20.5 will. 
However, without seeing the actual file you give to FOP its hard to say 
if this is the case here. You could try and put a zero-width-space 
(&#200b;) before and after each <fo:external-graphic> element in your 
XSL.

Manuel

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