You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by "David Crossley (JIRA)" <ji...@apache.org> on 2005/12/24 03:32:31 UTC

[jira] Updated: (FOR-413) PDF: rendering fails when graphics too big - workaround inside

     [ http://issues.apache.org/jira/browse/FOR-413?page=all ]

David Crossley updated FOR-413:
-------------------------------

     Other Info: [Patch available]
    Description: 
When "forresting" a document that has embedded images, the PDF rendering sometimes stops with this error message:

BROKEN: org.apache.fop.apps.FOPException: No meaningful layout in block after many attempts.  Infinite loop is assumed.  Processing halted.

I've found that this is caused by images that are too big to fit in the PDF page (took me some times :) )

(Moved workaround from Description to Comment - see 2005-12-24)


  was:
When "forresting" a document that has embedded images, the PDF rendering sometimes stops with this error message:

BROKEN: org.apache.fop.apps.FOPException: No meaningful layout in block after many attempts.  Infinite loop is assumed.  Processing halted.

I've found that this is caused by images that are too big to fit in the PDF page (took me some times :) )
I temporary "solved" it by modifying the document2fo.xsl. When I specify the "width" or "height" attribute to the img, then the value is taken and divided by 2. WARNING: the value has to be an integer and a "px" (pixels) size.

We should find a way to reduce the size automatically.

$ diff -bruN document2fo.xsl~ document2fo.xsl
--- document2fo.xsl~    2004-12-09 17:51:42.486185200 +0100
+++ document2fo.xsl     2004-12-09 22:03:32.465852800 +0100
@@ -755,10 +755,14 @@
       </xsl:variable>
       <fo:external-graphic src="{$imgpath}">
         <xsl:if test="@height">
-          <xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>
+          <xsl:variable name="reducedheight"
+                        select="number(@height)" />
+          <xsl:attribute name="height"><xsl:value-of select="concat(number($reducedheight) div 2,'px')"/></xsl:attribute>
         </xsl:if>
         <xsl:if test="@width">
-          <xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>
+          <xsl:variable name="reducedwidth"
+                        select="number(@width)" />
+          <xsl:attribute name="width"><xsl:value-of select="concat(number($reducedwidth) div 2,'px')"/></xsl:attribute>
         </xsl:if>
       </fo:external-graphic>
       <!-- alt text -->



I temporary "solved" it by modifying the document2fo.xsl. When I specify the "width" or "height" attribute to the img, then the value is taken and divided by 2. WARNING: the value has to be an integer and a "px" (pixels) size.

We should find a way to reduce the size automatically.

$ diff -bruN document2fo.xsl~ document2fo.xsl
--- document2fo.xsl~    2004-12-09 17:51:42.486185200 +0100
+++ document2fo.xsl     2004-12-09 22:03:32.465852800 +0100
@@ -755,10 +755,14 @@
       </xsl:variable>
       <fo:external-graphic src="{$imgpath}">
         <xsl:if test="@height">
-          <xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>
+          <xsl:variable name="reducedheight"
+                        select="number(@height)" />
+          <xsl:attribute name="height"><xsl:value-of select="concat(number($reducedheight) div 2,'px')"/></xsl:attribute>
         </xsl:if>
         <xsl:if test="@width">
-          <xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>
+          <xsl:variable name="reducedwidth"
+                        select="number(@width)" />
+          <xsl:attribute name="width"><xsl:value-of select="concat(number($reducedwidth) div 2,'px')"/></xsl:attribute>
         </xsl:if>
       </fo:external-graphic>
       <!-- alt text -->


> PDF: rendering fails when graphics too big - workaround inside
> --------------------------------------------------------------
>
>          Key: FOR-413
>          URL: http://issues.apache.org/jira/browse/FOR-413
>      Project: Forrest
>         Type: Bug
>   Components: Plugin: pdf-output
>     Versions: 0.6
>     Reporter: Olivier Jacques
>  Attachments: murks.fo, murks.fo, murks.zip
>
> When "forresting" a document that has embedded images, the PDF rendering sometimes stops with this error message:
> BROKEN: org.apache.fop.apps.FOPException: No meaningful layout in block after many attempts.  Infinite loop is assumed.  Processing halted.
> I've found that this is caused by images that are too big to fit in the PDF page (took me some times :) )
> (Moved workaround from Description to Comment - see 2005-12-24)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira