我正在寻找一个很好的选择,可以使用 Angular 在我的应用程序的每个页面上导出到 pdf 功能。有没有人对可以实现此目的的 Angular 模块有任何建议,因为我无法找到任何基于 Angular 模块。
最佳答案
你应该使用这个angular-save-html-to-pdf
//Here goes your script in html file
<script src="../bower_components/angular/angular.js"></script>
<script src="../bower_components/jquery/dist/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/niklasvh/html2canvas/0.5.0-alpha2/dist/html2canvas.min.js"></script>
<script src="../bower_components/jsPDF/dist/jspdf.debug.js"></script>
<script src="../dist/saveHtmlToPdf.min.js"></script>
//Add this module to your angular app :
var app = angular.module('app' , ['htmlToPdfSave']) ;
//This is your html file
<button pdf-save-button="idOneGraph" pdf-name="hello.pdf" class="btn">Hello World</button>
<!-- below block will be saved as pdf -->
<div pdf-save-content="idOneGraph" >
Hello World
</div>
关于javascript - 在 Angular 应用程序中将页面导出为 pdf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30561422/