Image 如何在ApacheFop0.95中使用XSLFO显示固定的图像高度和宽度

Image 如何在ApacheFop0.95中使用XSLFO显示固定的图像高度和宽度,image,pdf,size,xsl-fo,apache-fop,Image,Pdf,Size,Xsl Fo,Apache Fop,我试图在使用FOP0.95生成的pdf中固定图像的高度和宽度。 下面是用于它的代码 <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"/>

我试图在使用FOP0.95生成的pdf中固定图像的高度和宽度。 下面是用于它的代码

<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保持纵横比。有人对此有想法吗

这给了我们一个 由宽度控制。总之,我很高兴 试图拉伸图像,而不是 而不是使用 fop 0.95

默认情况下,fop保持纵横比,而不考虑指定的图像高度和宽度。这意味着fop在默认情况下进行统一缩放

要使图像根据您的规格进行拉伸,应使用非均匀缩放。这样:

<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图像

希望这有帮助。谢谢,