如何使用xsl-fo和apache fop 0.95显示固定图像的高度和宽度 [英] How to display fixed image height and width using xsl-fo with apache fop 0.95

查看:390
本文介绍了如何使用xsl-fo和apache fop 0.95显示固定图像的高度和宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用fop 0.95生成的pdf中修复图像的高度和宽度。
以下是用于它的代码

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

以下也不起作用

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

这些为我们提供了由宽度控制的图像。
总之,我试图拉伸图像,而不是使用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.Does any one have idea for it?

推荐答案


这些给我们的图像是由宽度控制的
。总之,我是
试图拉伸图像而不是
比保持宽高比使用
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,

这篇关于如何使用xsl-fo和apache fop 0.95显示固定图像的高度和宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆