views:

599

answers:

1

I am trying to fix the height and width of image in pdf generated using fop 0.95. Here is the code used for it

<fo:external-graphic src="s\image.png" height="2.00in" width="2.00in"/>

Following also does not work

<fo:external-graphic src="s\image.png"  content-height="scale-to-fit" height="2.00in"  content-width="2.00in"/>

These gives us the image that is governed by width . In summary I am trying to stretch the image rather than keeping the aspect ratio using fop 0.95.Does any one have idea for it?

+1  A: 

These gives us the image that is governed by width . In summary I am trying to stretch the image rather than keeping the aspect ratio using fop 0.95.

By default fop keeps the aspect ratio regardless of the image height and width specified. This means fop does uniform scaling by default.

To have rather stretched image according to your specification, you should use non-uniform scaling. This way:

<fo:external-graphic src="s\image.png"  content-height="scale-to-fit" height="2.00in"  content-width="2.00in" scaling="non-uniform"/>

This will display your image.png image with height 2.00in and width 2.00in.

Hope this helps. Thank you,

sangam