将jsf页面导出为PDF [英] Export jsf page to PDF
本文介绍了将jsf页面导出为PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包含线和饼图的页面,我想使用这些图表生成PDF报告。我该如何实现呢?我尝试用< p:dataExporter>
,但它只适用于表。这是我的代码
I have a page with line and pie charts and I would like to generate a PDF report with those charts. How can I achieve this? I tried with <p:dataExporter>
, but it works only on tables. Here is my code
<p:layoutUnit position="west" size="70%" >
<p:chart type="line" model="#{reportMscBean.model}" id="chart" style="width:700px;height:280px"/>
<p:separator></p:separator>
<p:chart type="line" model="#{reportMscBean.model2}" style="width:700px;height:280px" id="graphe2"/>
</p:layoutUnit>
<p:layoutUnit position="center" size="30%" style="border:0px;">
<p:chart type="pie" model="#{reportMscBean.pieModel2}" style="width:250px;height:280px" id="pie2" >
</p:chart>
<p:separator></p:separator>
<p:chart type="pie" model="#{reportMscBean.pieModel1}" style="width:250px;height:280px" id="pie1" >
</p:chart>
</p:layoutUnit>
推荐答案
< p: dataExporter>
组件仅使用表中结构化的数据,因此无法在整个页面上工作。你可以使用一些外部库来实现这一点。看看 iText ,例如,这是一个常见的选择: iText示例
The <p:dataExporter>
component you are using does only take data structured in a table, thus cannot work on an entire page. You could instead use some external libraries to achieve this. Take a look at iText for example, which is a common choice: iText example
这篇关于将jsf页面导出为PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文