我正在为一个文档项目做一个构建系统,在生成PDF输出时,我需要帮助限制图像的宽度。
我使用a2x --fop来生成工作良好的PDF输出,但我需要为所有图像启用scale-down-to-fit选项(Scale down to fit an image in FOP)。
如何在使用a2x --fop时启用此功能
发布于 2015-05-26 21:51:56
值得注意的是,即使XSL(T)对我来说都是烟雾和镜子,我还是设法解决了这个问题!
为了实现这一点,我设法从http://www.renderx.com/usecasestest.html获得了一个XSL示例,并获得了由a2x生成的XML来创建以下片段,我目前已将其添加到asciidoc/a2x包含的默认fo.xsl中:
<xsl:template match="imagedata">
<fo:block line-height="1pt">
<fo:external-graphic content-width="scale-down-to-fit" content-height="100%" width="100%" scaling="uniform">
<xsl:attribute name="src">
url(
<xsl:value-of select="@fileref"/>
)
</xsl:attribute>
</fo:external-graphic>
</fo:block>
</xsl:template>https://stackoverflow.com/questions/30468864
复制相似问题