Cause:
To process a project, you need to export the data (order, waybill) and so on the page to PDF. The first idea: think from the Java layer. But after a variety of data query and practice, the first idea is abandoned; Fortunately, the customer's request is that the exported PDF size is the same as the printed size. So change the idea to find information, produce a second idea, "JSP HTML export PDF" and other keywords search, found the use of Html2canvas and Jspdf export PDF case, through practice, basically meet the needs. As a developer, I really feel the strong HTML5, has been responsible for the development of the service layer, now found a lot of client development is also very interesting, but also reduce the pressure on the server and the network. For example, there was a case of generating two-dimensional code, at first it was generated in Java at the service layer, and then the JQuery barcode was able to solve the problem, greatly reducing the corresponding time of the page. The following is a collation of the relevant essence of the data, including I do not use the Java service layer to learn the meaning of the output PDF data. (In fact, the process of searching for information is very painful, a variety of, for Baidu and Google, fortunately solved the problem in a timely manner) The original author's words are: "Recently encountered a demand, the current page needs to be generated PDF, and download. For a few days, I tidied up, recorded, I think someone should need:) "thanks to the original author's selfless open source dedication. GitHub Open Source project "Javascript to convert HTML to PDF, download, support multi-page Oh (Html2canvas and jspdf)" Https://github.com/linwalker/render-html-to-pdf The first to find the author blog 1190000009211079http://www.zhimengzhe.com/javascriptjiaocheng/288576.html "jspdf: Convert HTML elements to the same wide PDF" http://blog.csdn.net/zhanggl94/article/details/52672051 "Spring MVC learning Note pdf/excel format output" http://www.cnblogs.com/ crazy-fox/archive/2012/02/18/2357705.html "itext implement URL page to PDF" http://www.cnblogs.com/hutuchong/articles/5725913. Htmlitext implement URL page to pdfhttp://www.micmiu.com/opensource/expdoc/itext-url-pdf/
Old rookie learning: Javascript turns HTML into PDF