【问题标题】:FOP Pdf genaration with graphs(Pie/Bar) CHarts [closed]带图表的 FOP Pdf 生成(饼图/条形图)[关闭]
【发布时间】:2015-12-19 15:22:01
【问题描述】:

我正在搜索近一个月的时间来使用 Apache-FOP Pdf Generation 生成图表。最后我问你们编码员。请帮助我。

<metrics>
    <duration>22s.531ms</duration>
    <failed>1</failed>
    <passed>2</passed>
    <skipped>6</skipped>
    <total>9</total>
</metrics>

【问题讨论】:

  • 到目前为止你有什么?我想有些xslt?还有一些xml?和图表为 png...?
  • @Jan 感谢您的回复。我不知道如何为那个写 xslt。 XML 我将编辑问题并添加它
  • 那么也许你根本不想开始 fop,而是选择了像 itext 这样更简单的方法来制作你的 pdf。
  • 感谢您的建议。但是我不允许使用itextpdf。
  • 不允许,因为这是一项任务或法律问题?可能仍然存在(旧)LGPL 版本的 itext

标签: java xslt charts apache-fop


【解决方案1】:

一旦您设法使用您喜欢的任何图表库(如 JFreeChart 或类似库)创建了一个漂亮的图表,请查看Apache FOP website 中的这些示例,了解如何将生成的图像嵌入到您的 pdf 中:

<fo:block>
The image (
  <fo:external-graphic content-width="100pt" content-height="50pt" scaling="non-uniform" src="images/fop.jpg"/>
) has non-uniform scaling.
</fo:block>

<fo:block>
The image (
<fo:external-graphic content-width="50pt" content-height="100pt" scaling="non-uniform" src="images/fop.jpg"/>
) has non-uniform scaling.
</fo:block>

<fo:block>
The image (
<fo:external-graphic content-width="100pt" content-height="75pt" scaling="uniform" src="images/fop.jpg"/>
) has uniform scaling.
</fo:block>

<fo:block>
The image (
<fo:external-graphic content-width="75pt" content-height="100pt" scaling="uniform" src="images/fop.jpg"/>
) has uniform scaling.
</fo:block>

<fo:block>
The image (
<fo:external-graphic width="75pt" height="100pt" content-width="scale-to-fit" content-height="scale-to-fit" src="images/fop.jpg"/>
) is scaled to fit the viewport.
</fo:block>

【讨论】:

  • 谢谢@Jan 我会尝试使用它并让你知道。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-23
  • 1970-01-01
  • 1970-01-01
  • 2016-01-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多