Export jsf page to PDF

拈花ヽ惹草 提交于 2019-12-25 16:39:07

问题


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>             

回答1:


I'm afraid this just is not possible. Exports are basic. For complex exports, try a real reporting tool




回答2:


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



来源:https://stackoverflow.com/questions/31839034/export-jsf-page-to-pdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!