简体   繁体   中英

Export page to pdf in angular app

I'm looking for a good option to have an export to pdf functionality on each of my app's pages using angular. Does anyone have any recommendations on angular modules that can achieve this as I haven't been able to find any angular based ones.

You should use this 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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM