将jsf页面导出为PDF

时间:2015-08-05 17:25:37

标签: jsf pdf charts export reporting

我有一个包含折线和饼图的页面,我想用这些图表生成PDF报告。我怎样才能做到这一点?我尝试使用<p:dataExporter>,但它仅适用于表格。这是我的代码

<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>             

2 个答案:

答案 0 :(得分:0)

我担心这是不可能的。出口是基本的。对于复杂的出口,请尝试使用真实的报告工具

答案 1 :(得分:0)

您使用的<p:dataExporter>组件仅采用表格中的结构数据,因此无法在整个页面上运行。您可以使用一些外部库来实现此目的。例如,看一下 iText ,这是一个常见的选择:iText example

相关问题