I wrote an extension function in Java for Saxon that gives me the width 
(and height, but that's less relevant) of an image. Then, if the width is 
greater than 5.5 inches (the space I have available for screen shots in 
this document format), the XSLT adds the content-width="scale-to-fit" 
attribute to the external-graphic instruction, thus:

      <fo:external-graphic src="[EMAIL PROTECTED]" content-width="scale-to-fit">
        <xsl:if test="ext:getImageWidth(@source) &gt; 528">
          <!-- 528 = 5.5 inches at 96 dpi -->
          <xsl:attribute name="content-width" select="'scale-to-fit'"/>
        </xsl:if>
      </fo:external-graphic>

That all works fine and produces lines such as the following:

<fo:external-graphic src="login.gif" content-width="scale-to-fit">

But when I run FOP against the resulting FO file, I get the following 
error message:

java.lang.RuntimeException: Some content could not fit into a line/page 
after 50
 attempts. Giving up to avoid an endless loop.

I also get a PDF file that is "damaged and could not be repaired."

I've tested the extension function on several images by having it print 
the width in xsl:message instructions, so I know that works. Also, the 
transform is properly creating external-graphic instructions with 
content-width="scale-to-fit" attributes. So I'm a bit stumped at this 
point.

Any idea why <fo:external-graphic src="login.gif" 
content-width="scale-to-fit"> makes a PDF file that goes boom?

Thanks.

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to