使用页面段或页面叠加层将图像包含在通过apache fop生成的AFP文件中

时间:2019-01-09 11:05:21

标签: image apache-fop graphical-logo afp

我一直在尝试生成一个带有我们公司徽标的 AFP文件。该文档需要发送给某些第三方供应商。我正在使用 apache fop 从xml生成AFP文件。我尝试将图像作为资源,并使用包含对象( IOB )来解决打印期间的图像资源。但是事实证明我们的供应商不了解IOB格式的图像。因此,他们建议我使用 IPS 包括页面细分)或 IPO 包括页面覆盖)。

现在,我已经尝试创建页面段很长时间了,但是无法实现。通过使用<afp:include-page-segment>标签可以显示IPS标签,但是没有显示IPS应该参考的实际页面段。我已经搜索了很多次,但没有找到/理解哪个标签可以创建 IPS 也可以引用的页面段(例如 IOB ,它引用了一些资源对象) )。

这是我的代码的片段。

<fo:simple-page-master margin-bottom="36pt" margin-left="34pt" margin-right="34pt" margin-top="24pt"
                       master-name="section1-first-page" page-height="11in" page-width="8.5in">
  <afp:include-page-segment name="our-logo" src="../resources/our_logo.png" afp:resource-file="our_logo.png"/>
  <fo:region-body/>
  <fo:region-before extent="11in" region-name="header"/>
  <fo:region-after display-align="after" extent="11in" region-name="first-page-footer"/>
</fo:simple-page-master>

在那之后,在正文中,我指的是同名"our-logo"的段,如下所示。

<fo:block border-style="solid" border-width="2pt" border-color="red">
    <fo:external-graphic src="../resources/our_logo.png" content-height="scale-down-to-fit" height="21pt" width="123pt" scaling="non-uniform"/>
  </fo:block>

0 个答案:

没有答案