title: Generate a designed PDF report from a web application
body: <p>I want to generate a PDF report from a web application. The PDF should contain charts (pie, bar), tables, different fonts and colors.</p>
  
  <p>The server-side of the application is Java, the client-side is AngularJS (and of course CSS3 and HTML).</p>
  
  <p>Two main options:</p>
  
  <ul>
  <li>The client side will pass some parameters to the server, and the server will generate the PDF report, using a Java package. Then the report will be sent back to the client as a downloaded file.</li>
  <li>The client will generate the report, using a JS package that converts HTML and CSS to PDF.</li>
  </ul>
  
  <p>In the Java world, I've found for example iText and JFreeChart, like <a href="http://viralpatel.net/blogs/generate-pie-chart-bar-graph-in-pdf-using-itext-jfreechart/" rel="nofollow noreferrer">here</a>. The problem here is that the design of charts look bad in the example, and I don't know if it can be changed to be designed by the style-guide I have (a design that can be done easily with CSS).</p>
  
  <p>In the JS world, I've found for example html2canvas and pdfMake, like <a href="https://stackoverflow.com/questions/34049956/generate-pdf-from-html-using-pdfmake-in-angularjs">here</a>. The problem here is that I'm not sure the conversion from HTML to canvas and then to PDF will work good in an Angular application. And I'm not sure it converts well complicated DOM elements, like charts in svg or canvas elements.</p>
  
  <p>Do you have any experience with these packages? Do you know other recommended packages for this task, client or server?</p>