On Dec 9, 2005, at 23:19, [EMAIL PROTECTED] wrote:

Hi Jay,

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 -->

Try 396 (= 5.5in at 72dpi), unless you're overriding the default resolution of course...

<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.

See above: If you're not overriding the default resolution, this is caused by the fact that 528px is 7.33in in the default resolution.

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?

Most logical explanation would be that the file isn't finished due to the RuntimeException (?)


HTH!

Andreas

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

Reply via email to