title: Primefaces chart in Export PDF
body: <p>First of all i have to tell you that I am not an English native speaker so I hope i will explain you correctly my issue.</p>
  
  <p>I have some problems with exporting my bar chart in PDF. I am working with PrimeFaces 3.5 and Tomcat v7.</p>
  
  <p>After some resarch, I learned that, it is not possible to export directly a chart in PDF. But it seem to be some way to save the chart in an image like png or jpeg.</p>
  
  <p>I found this : <a href="http://www.primefaces.org/showcase-labs/ui/chartExport.jsf" rel="nofollow">http://www.primefaces.org/showcase-labs/ui/chartExport.jsf</a> but it's only a print screen way and i want to save it for use it in my pdf report .</p>
  
  <p>I also see the JFreeChart solution but i really want to keep the same chart in my html page and in my PDF report.</p>
  
  <p>Here is my code :</p>
  
  <pre><code>&lt;h:form id="finalreport"&gt;
              &lt;c:if test="#{treeBean.finalPrintReport.create == 1}"&gt;
                  &lt;h1&gt;
                      &lt;h:outputText value="#{treeBean.finalPrintReport.namefinalreport}"
                          escape="false" /&gt;
                  &lt;/h1&gt;
                  &lt;p:dataTable id="dataTableReport" var="row"
                      value="#{treeBean.finalPrintReport.allData}" paginator="true"
                      rows="10"&gt;
                      &lt;p:columns value="#{treeBean.finalPrintReport.column}" var="column"
                          columnIndexVar="colIndex"&gt;
                          &lt;f:facet name="header"&gt;
                              &lt;h:outputText value="#{column}" /&gt;
                          &lt;/f:facet&gt;
  
              &lt;h:outputText value="#{row[colIndex]}" /&gt;
                      &lt;/p:columns&gt;
                  &lt;/p:dataTable&gt;
                  &lt;br /&gt;
  
                  &lt;h:commandLink&gt;
                      &lt;p:graphicImage value="/images/pdf.png" /&gt;
                      &lt;p:dataExporter type="pdf" target="dataTableReport"
                          fileName="Report" preProcessor="#{treeBean.createPDF}" /&gt;
                  &lt;/h:commandLink&gt;
              &lt;/c:if&gt;
          &lt;/h:form&gt;
          &lt;!-- Graph --&gt;
          &lt;h:form id="graph"&gt;
              &lt;c:if test="#{treeBean.finalPrintReport.create == 1}"&gt;
                  &lt;c:if test="#{treeBean.finalPrintReport.propertyOfFinalReport.graph == true}"&gt;
                      &lt;p:barChart id="basic" value="#{treeBean.chartbar2d}"
                          legendPosition="ne" title="Basic Bar Chart" 
                          style="height:300px" /&gt;
                  &lt;/c:if&gt; 
              &lt;/c:if&gt;
          &lt;/h:form&gt;
  </code></pre>
  
  <p>Thanks</p>