How to display fixed image height and width using xsl-fo with apache fop 0.95

后端 未结 1 1954
情书的邮戳
情书的邮戳 2021-02-13 03:33

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



        
相关标签:
1条回答
  • 2021-02-13 04:16

    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,

    0 讨论(0)
提交回复
热议问题