【问题标题】:How to display fixed image height and width using xsl-fo with apache fop 0.95如何使用 xsl-fo 和 apache fop 0.95 显示固定的图像高度和宽度
【发布时间】:2010-12-29 19:03:48
【问题描述】:

我正在尝试修复使用 fop 0.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 保持纵横比。有人知道吗?

【问题讨论】:

    标签: image pdf size xsl-fo apache-fop


    【解决方案1】:

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

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

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多