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 "Puppala, Kumar (LNG-CON)" <ku...@lexisnexis.com> on 2007/11/09 20:08:14 UTC

Images not resized properly in fop 0.94

I am running into an issue with both gif and png images in fop 0.94. I
am trying to render a big GIF image in my PDF document. Since the image
does not fit in a single page, it should be resized. In FOP 0.20.5, I do
see the correct behavior and the image is rendered properly. However in
both 0.93 and 0.94 releases, the image is not truncated and hence only
rendered partially. I am hereby attaching the FO file and the outputs
from old and new fop. Are there any known issues here? I have not
included the GIF image but can do so if it's needed for troubleshooting.

 

Thanks,

Kumar Puppala


Re: Images not resized properly in fop 0.94

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Done: http://svn.apache.org/viewvc?rev=596100&view=rev

Thanks for the suggestion.

Jeremias Maerki



On 12.11.2007 17:22:06 Puppala, Kumar (LNG-CON) wrote:
> Thanks Jeremias for pointing me to the examples. From the examples, I
> could not find one that suits my testcase. However, I was able to find
> one from another website: 
>   http://www.renderx.net/lists/xep-support/0376.html
> 
> I tried this approach for my image and it worked. The trick is to
> specify the markup as shown below:
> 
>  <fo:external-graphic src="url(img/large-image.gif)" 
>     content-width="scale-to-fit" 
>     content-height="100%" 
>     width="100%"/>
> 
> Since we do not have this particular testcase in the images.fo file, can
> you please add this? It might be helpful for those who wish to scale
> only those images that do not fit in the page.
> 
> Appreciate your help.
> 
> Thanks!!
> 
> -----Original Message-----
> From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
> Sent: Friday, November 09, 2007 5:00 PM
> To: fop-users@xmlgraphics.apache.org
> Subject: Re: Images not resized properly in fop 0.94
> 
> May I suggest that you have a look at "examples/fo/basic/images.fo" in
> the FOP distribution? The example shows various ways to use
> fo:external-graphic. I'm sure you'll find the pattern you need there.
> 
> Good luck!
> 
> Jeremias Maerki
> 
> 
> 
> On 09.11.2007 22:50:23 Puppala, Kumar (LNG-CON) wrote:
> > Thanks for the information. I tried to use both content-height and
> > content-width (setting them to 'scale-to-fit') in my testcase and it
> > still did not work. I think there might be some issue here. Below is
> the
> > code snippet from AbstractGraphicsLayoutManager.java file:
> > 
> >  
> > 
> > In getInlineArea() function:
> > 
> >  
> > 
> > Line 72 onwards...
> > 
> >         int bpd = -1;
> > 
> >         int ipd = -1;
> > 
> >  
> > 
> > The bpd and ipd values are only overwritten if 
> > 
> > Line 129 onwards...
> > 
> >         if ((scaling == EN_UNIFORM) || (cwidth == -1) || cheight ==
> -1)
> > {
> > 
> >             if (cwidth == -1 && cheight == -1) {
> > 
> >                 cwidth = fobj.getIntrinsicWidth();
> > 
> >                 cheight = fobj.getIntrinsicHeight();
> > 
> >             }
> > 
> >  ....
> > 
> > Line 164 onwards...
> > 
> >         if (ipd == -1) {
> > 
> >             ipd = cwidth;
> > 
> >         }
> > 
> >         if (bpd == -1) {
> > 
> >             bpd = cheight;
> > 
> >         }
> > 
> >  
> > 
> > The ipd and bpd values are set as per this flow for my FO file. As
> such,
> > the values are not being scaled. We might be missing something here
> but
> > since I am not an expert in this area, any input to fix this issue
> will
> > be greatly appreciated.
> > 
> >  
> > 
> >  
> > 
> > Thanks,
> > 
> > Kumar Puppala
> > 
> >  
> > 
> > -----Original Message-----
> > From: Andreas L Delmelle [mailto:a_l.delmelle@pandora.be] 
> > Sent: Friday, November 09, 2007 2:21 PM
> > To: fop-users@xmlgraphics.apache.org
> > Subject: Re: Images not resized properly in fop 0.94
> > 
> >  
> > 
> > On Nov 9, 2007, at 20:08, Puppala, Kumar (LNG-CON) wrote:
> > 
> >  
> > 
> > Hi Kumar
> > 
> > > I am running into an issue with both gif and png images in fop  
> > 
> > > 0.94. I am trying to render a big GIF image in my PDF document.  
> > 
> > > Since the image does not fit in a single page, it should be  
> > 
> > > resized. In FOP 0.20.5, I do see the correct behavior and the image
> 
> > 
> > > is rendered properly. However in both 0.93 and 0.94 releases, the  
> > 
> > > image is not truncated and hence only rendered partially. I am  
> > 
> > > hereby attaching the FO file and the outputs from old and new fop.  
> > 
> > > Are there any known issues here?
> > 
> >  
> > 
> > Yes, the behavior in FOP 0.20.5 is non-compliant.
> > 
> >  
> > 
> > Take a look at the fo:external-graphic, and the XSL-FO Rec, more  
> > 
> > precisely:
> > 
> >  
> > 
> > http://www.w3.org/TR/xsl11/#d0e22982 (Area Dimension Properties)
> > 
> >  
> > 
> > You have no explicit (content-)width/height, so:
> > 
> >  
> > 
> > content-width="auto" => intrinsic image width
> > 
> > content-height="auto" => intrinsic image height
> > 
> > height="auto"
> > 
> > width="auto"
> > 
> >  
> > 
> > => the image should not be scaled to fit the viewport, but clipped.
> > 
> >  
> > 
> > The trick is to set content-height and/or content-width explicitly to
> 
> > 
> > "scale-to-fit". That should normally do it.
> > 
> >  
> > 
> > Hope this helps!
> > 
> >  
> > 
> >  
> > 
> > Andreas
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 


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


RE: Images not resized properly in fop 0.94

Posted by "Puppala, Kumar (LNG-CON)" <ku...@lexisnexis.com>.
Thanks Jeremias for pointing me to the examples. From the examples, I
could not find one that suits my testcase. However, I was able to find
one from another website: 
  http://www.renderx.net/lists/xep-support/0376.html

I tried this approach for my image and it worked. The trick is to
specify the markup as shown below:

 <fo:external-graphic src="url(img/large-image.gif)" 
    content-width="scale-to-fit" 
    content-height="100%" 
    width="100%"/>

Since we do not have this particular testcase in the images.fo file, can
you please add this? It might be helpful for those who wish to scale
only those images that do not fit in the page.

Appreciate your help.

Thanks!!

-----Original Message-----
From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
Sent: Friday, November 09, 2007 5:00 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: Images not resized properly in fop 0.94

May I suggest that you have a look at "examples/fo/basic/images.fo" in
the FOP distribution? The example shows various ways to use
fo:external-graphic. I'm sure you'll find the pattern you need there.

Good luck!

Jeremias Maerki



On 09.11.2007 22:50:23 Puppala, Kumar (LNG-CON) wrote:
> Thanks for the information. I tried to use both content-height and
> content-width (setting them to 'scale-to-fit') in my testcase and it
> still did not work. I think there might be some issue here. Below is
the
> code snippet from AbstractGraphicsLayoutManager.java file:
> 
>  
> 
> In getInlineArea() function:
> 
>  
> 
> Line 72 onwards...
> 
>         int bpd = -1;
> 
>         int ipd = -1;
> 
>  
> 
> The bpd and ipd values are only overwritten if 
> 
> Line 129 onwards...
> 
>         if ((scaling == EN_UNIFORM) || (cwidth == -1) || cheight ==
-1)
> {
> 
>             if (cwidth == -1 && cheight == -1) {
> 
>                 cwidth = fobj.getIntrinsicWidth();
> 
>                 cheight = fobj.getIntrinsicHeight();
> 
>             }
> 
>  ....
> 
> Line 164 onwards...
> 
>         if (ipd == -1) {
> 
>             ipd = cwidth;
> 
>         }
> 
>         if (bpd == -1) {
> 
>             bpd = cheight;
> 
>         }
> 
>  
> 
> The ipd and bpd values are set as per this flow for my FO file. As
such,
> the values are not being scaled. We might be missing something here
but
> since I am not an expert in this area, any input to fix this issue
will
> be greatly appreciated.
> 
>  
> 
>  
> 
> Thanks,
> 
> Kumar Puppala
> 
>  
> 
> -----Original Message-----
> From: Andreas L Delmelle [mailto:a_l.delmelle@pandora.be] 
> Sent: Friday, November 09, 2007 2:21 PM
> To: fop-users@xmlgraphics.apache.org
> Subject: Re: Images not resized properly in fop 0.94
> 
>  
> 
> On Nov 9, 2007, at 20:08, Puppala, Kumar (LNG-CON) wrote:
> 
>  
> 
> Hi Kumar
> 
> > I am running into an issue with both gif and png images in fop  
> 
> > 0.94. I am trying to render a big GIF image in my PDF document.  
> 
> > Since the image does not fit in a single page, it should be  
> 
> > resized. In FOP 0.20.5, I do see the correct behavior and the image

> 
> > is rendered properly. However in both 0.93 and 0.94 releases, the  
> 
> > image is not truncated and hence only rendered partially. I am  
> 
> > hereby attaching the FO file and the outputs from old and new fop.  
> 
> > Are there any known issues here?
> 
>  
> 
> Yes, the behavior in FOP 0.20.5 is non-compliant.
> 
>  
> 
> Take a look at the fo:external-graphic, and the XSL-FO Rec, more  
> 
> precisely:
> 
>  
> 
> http://www.w3.org/TR/xsl11/#d0e22982 (Area Dimension Properties)
> 
>  
> 
> You have no explicit (content-)width/height, so:
> 
>  
> 
> content-width="auto" => intrinsic image width
> 
> content-height="auto" => intrinsic image height
> 
> height="auto"
> 
> width="auto"
> 
>  
> 
> => the image should not be scaled to fit the viewport, but clipped.
> 
>  
> 
> The trick is to set content-height and/or content-width explicitly to

> 
> "scale-to-fit". That should normally do it.
> 
>  
> 
> Hope this helps!
> 
>  
> 
>  
> 
> Andreas


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


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


Re: Images not resized properly in fop 0.94

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
May I suggest that you have a look at "examples/fo/basic/images.fo" in
the FOP distribution? The example shows various ways to use
fo:external-graphic. I'm sure you'll find the pattern you need there.

Good luck!

Jeremias Maerki



On 09.11.2007 22:50:23 Puppala, Kumar (LNG-CON) wrote:
> Thanks for the information. I tried to use both content-height and
> content-width (setting them to 'scale-to-fit') in my testcase and it
> still did not work. I think there might be some issue here. Below is the
> code snippet from AbstractGraphicsLayoutManager.java file:
> 
>  
> 
> In getInlineArea() function:
> 
>  
> 
> Line 72 onwards...
> 
>         int bpd = -1;
> 
>         int ipd = -1;
> 
>  
> 
> The bpd and ipd values are only overwritten if 
> 
> Line 129 onwards...
> 
>         if ((scaling == EN_UNIFORM) || (cwidth == -1) || cheight == -1)
> {
> 
>             if (cwidth == -1 && cheight == -1) {
> 
>                 cwidth = fobj.getIntrinsicWidth();
> 
>                 cheight = fobj.getIntrinsicHeight();
> 
>             }
> 
>  ....
> 
> Line 164 onwards...
> 
>         if (ipd == -1) {
> 
>             ipd = cwidth;
> 
>         }
> 
>         if (bpd == -1) {
> 
>             bpd = cheight;
> 
>         }
> 
>  
> 
> The ipd and bpd values are set as per this flow for my FO file. As such,
> the values are not being scaled. We might be missing something here but
> since I am not an expert in this area, any input to fix this issue will
> be greatly appreciated.
> 
>  
> 
>  
> 
> Thanks,
> 
> Kumar Puppala
> 
>  
> 
> -----Original Message-----
> From: Andreas L Delmelle [mailto:a_l.delmelle@pandora.be] 
> Sent: Friday, November 09, 2007 2:21 PM
> To: fop-users@xmlgraphics.apache.org
> Subject: Re: Images not resized properly in fop 0.94
> 
>  
> 
> On Nov 9, 2007, at 20:08, Puppala, Kumar (LNG-CON) wrote:
> 
>  
> 
> Hi Kumar
> 
> > I am running into an issue with both gif and png images in fop  
> 
> > 0.94. I am trying to render a big GIF image in my PDF document.  
> 
> > Since the image does not fit in a single page, it should be  
> 
> > resized. In FOP 0.20.5, I do see the correct behavior and the image  
> 
> > is rendered properly. However in both 0.93 and 0.94 releases, the  
> 
> > image is not truncated and hence only rendered partially. I am  
> 
> > hereby attaching the FO file and the outputs from old and new fop.  
> 
> > Are there any known issues here?
> 
>  
> 
> Yes, the behavior in FOP 0.20.5 is non-compliant.
> 
>  
> 
> Take a look at the fo:external-graphic, and the XSL-FO Rec, more  
> 
> precisely:
> 
>  
> 
> http://www.w3.org/TR/xsl11/#d0e22982 (Area Dimension Properties)
> 
>  
> 
> You have no explicit (content-)width/height, so:
> 
>  
> 
> content-width="auto" => intrinsic image width
> 
> content-height="auto" => intrinsic image height
> 
> height="auto"
> 
> width="auto"
> 
>  
> 
> => the image should not be scaled to fit the viewport, but clipped.
> 
>  
> 
> The trick is to set content-height and/or content-width explicitly to  
> 
> "scale-to-fit". That should normally do it.
> 
>  
> 
> Hope this helps!
> 
>  
> 
>  
> 
> Andreas


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


RE: Images not resized properly in fop 0.94

Posted by "Puppala, Kumar (LNG-CON)" <ku...@lexisnexis.com>.
Thanks for the information. I tried to use both content-height and
content-width (setting them to 'scale-to-fit') in my testcase and it
still did not work. I think there might be some issue here. Below is the
code snippet from AbstractGraphicsLayoutManager.java file:

 

In getInlineArea() function:

 

Line 72 onwards...

        int bpd = -1;

        int ipd = -1;

 

The bpd and ipd values are only overwritten if 

Line 129 onwards...

        if ((scaling == EN_UNIFORM) || (cwidth == -1) || cheight == -1)
{

            if (cwidth == -1 && cheight == -1) {

                cwidth = fobj.getIntrinsicWidth();

                cheight = fobj.getIntrinsicHeight();

            }

 ....

Line 164 onwards...

        if (ipd == -1) {

            ipd = cwidth;

        }

        if (bpd == -1) {

            bpd = cheight;

        }

 

The ipd and bpd values are set as per this flow for my FO file. As such,
the values are not being scaled. We might be missing something here but
since I am not an expert in this area, any input to fix this issue will
be greatly appreciated.

 

 

Thanks,

Kumar Puppala

 

-----Original Message-----
From: Andreas L Delmelle [mailto:a_l.delmelle@pandora.be] 
Sent: Friday, November 09, 2007 2:21 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: Images not resized properly in fop 0.94

 

On Nov 9, 2007, at 20:08, Puppala, Kumar (LNG-CON) wrote:

 

Hi Kumar

> I am running into an issue with both gif and png images in fop  

> 0.94. I am trying to render a big GIF image in my PDF document.  

> Since the image does not fit in a single page, it should be  

> resized. In FOP 0.20.5, I do see the correct behavior and the image  

> is rendered properly. However in both 0.93 and 0.94 releases, the  

> image is not truncated and hence only rendered partially. I am  

> hereby attaching the FO file and the outputs from old and new fop.  

> Are there any known issues here?

 

Yes, the behavior in FOP 0.20.5 is non-compliant.

 

Take a look at the fo:external-graphic, and the XSL-FO Rec, more  

precisely:

 

http://www.w3.org/TR/xsl11/#d0e22982 (Area Dimension Properties)

 

You have no explicit (content-)width/height, so:

 

content-width="auto" => intrinsic image width

content-height="auto" => intrinsic image height

height="auto"

width="auto"

 

=> the image should not be scaled to fit the viewport, but clipped.

 

The trick is to set content-height and/or content-width explicitly to  

"scale-to-fit". That should normally do it.

 

Hope this helps!

 

 

Andreas

 

 

---------------------------------------------------------------------

To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org

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

 


Re: Images not resized properly in fop 0.94

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Nov 9, 2007, at 20:08, Puppala, Kumar (LNG-CON) wrote:

Hi Kumar
> I am running into an issue with both gif and png images in fop  
> 0.94. I am trying to render a big GIF image in my PDF document.  
> Since the image does not fit in a single page, it should be  
> resized. In FOP 0.20.5, I do see the correct behavior and the image  
> is rendered properly. However in both 0.93 and 0.94 releases, the  
> image is not truncated and hence only rendered partially. I am  
> hereby attaching the FO file and the outputs from old and new fop.  
> Are there any known issues here?

Yes, the behavior in FOP 0.20.5 is non-compliant.

Take a look at the fo:external-graphic, and the XSL-FO Rec, more  
precisely:

http://www.w3.org/TR/xsl11/#d0e22982 (Area Dimension Properties)

You have no explicit (content-)width/height, so:

content-width="auto" => intrinsic image width
content-height="auto" => intrinsic image height
height="auto"
width="auto"

=> the image should not be scaled to fit the viewport, but clipped.

The trick is to set content-height and/or content-width explicitly to  
"scale-to-fit". That should normally do it.

Hope this helps!


Andreas


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