【问题标题】:How to write text diagonally on a image using XSL FO如何使用 XSL FO 在图像上对角书写文本
【发布时间】:2020-02-11 09:28:09
【问题描述】:

我在一张图片的证书文件上写了一段文字,但我试图在图像上斜着写文字。即使更改了文本所在容器的参考方向,我也无法更改它。

<xsl:template match="graphicBack">
        <fo:block absolute-position="absolute">
            <fo:block-container position="absolute">
                <fo:external-graphic xmlns:fo="http://www.w3.org/1999/XSL/Format" scaling="uniform" content-width="210mm" content-height="296.99mm">
                    <xsl:attribute name="src" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
                        <xsl:value-of select="var" />
                    </xsl:attribute>
                </fo:external-graphic>
            </fo:block-container>
            <fo:block-container absolute-position="absolute" left="20mm" top="200mm">
                <fo:block color="#CC6133" font-family="Courier" font-style="normal" display-align="center" font-size="300px">
             COPY
                </fo:block>
            </fo:block-container>
        </fo:block>
    </xsl:template>

【问题讨论】:

  • 你把fo:reference-orientation="45"属性放在哪里了?

标签: xslt xslt-2.0 document xsl-fo


【解决方案1】:

如果您使用的是 AH Formatter,那么您可以使用axf:transformaxf:transform-origin(请参阅https://www.antennahouse.com/product/ahf66/ahf-ext.html#transformation)将块旋转到任意角度。

请参阅https://www.antennahouse.com/comprehensive-xsl-fo-tutorials-and-samples-collection/“综合 XSL-FO 教程和示例集合”中的“块转换”示例。

【讨论】:

  • PO 使用 formatting output (fo),而不是 AH formatter (axf)。
  • AH Formatter 实现了 XSL-FO,可以说比任何其他格式化程序都要多:antennahouse.com/product/ahf66/ahf-fo11.html。带有axf 前缀的属性是超出XSL 1.1 推荐标准的扩展。旋转文本不在 XSL 1.1 中,但在 XSL 2.0 要求文档中确实有一行:w3.org/TR/xslfo20-req/#N67162
  • 我使用的是文档管理系统,它不允许使用 axf:transform 命令。有没有其他方法可以对角对齐文本
  • 为旋转文本生成 SVG 为 fo:instream-foreign-object
  • 我刚刚发现 FOP 有一个 fox:transform 属性来做同样的事情。见xmlgraphics.apache.org/fop/2.4/extensions.html#transform
猜你喜欢
  • 1970-01-01
  • 2013-12-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-01-08
  • 2012-05-14
相关资源
最近更新 更多