且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用xsl-fo和apache fop 0.95显示固定图像的高度和宽度

更新时间:2022-02-14 10:50:00


这些给我们的图像是由宽度控制的
。总之,我是
试图拉伸图像而不是
比保持宽高比使用
fop 0.95。

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.

默认情况下,无论指定的图像高度和宽度如何,fop都会保持纵横比。这意味着默认情况下fop会进行统一缩放。

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

这将显示高度为2.00英寸,宽度为2.00英寸的image.png图片。

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

希望这会有所帮助。谢谢,

Hope this helps. Thank you,