0

I want to save the JSP page as a PDF format, the JSP page has a lot of Highcharts charts and a list of data, so you can not use iText tools to do. The way I can think of is to call the browser to save as PDF function, but how to call? If you can't call me how to solve this problem?

GaoHJ
  • 1
  • 1
  • 3
  • Possible duplicate of [Export Highcharts to PDF (using javascript and local server - no internet connection)](http://stackoverflow.com/questions/25630811/export-highcharts-to-pdf-using-javascript-and-local-server-no-internet-connec) – lamp76 May 04 '16 at 09:23

1 Answers1

0

You can actually use a combination of canvas drawing and JavaScript PDF generation to achieve this. Have a look at these libraries:

Thomas
  • 11,272
  • 2
  • 24
  • 40
  • I cannot directly invoke the browser print options in the save as the function of PDF? I think this function is very convenient. – GaoHJ May 04 '16 at 09:18
  • With the JavaScript you can provide a file for download or display in the browser. You can not directly command the browser to open the print dialog and apply custom options. – Thomas May 04 '16 at 09:20
  • 1
    html2canvas may not capture highcharts. – lamp76 May 04 '16 at 09:24
  • That is correct, see this stackoverflow answer for a possible work around: http://stackoverflow.com/questions/34042440/using-html2canvas-to-render-a-highcharts-chart-to-pdf-doesnt-work-on-ie-and-fir – Thomas May 04 '16 at 09:26
  • You give the example of "canvg" function is always shows undefined, I introduced the HTML in js, what reason is this? – GaoHJ May 05 '16 at 02:19