This project was generated with angular-cli version 1.0.0-beta.26.
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
$ npm install jspdf --save
$ npm install @types/jspdf --save
"scripts": [
"../node_modules/jspdf/dist/jspdf.min.js"
],
declare let jsPDF;
let doc = new jsPDF();
doc.text(20, 20, 'Hello world.');
doc.save('Test.pdf');
$ npm install jsp
82C1
df --save
$ npm install @types/jspdf --save
$ npm install rasterizehtml --save
"scripts": [
"../node_modules/jspdf/dist/jspdf.min.js",
"../node_modules/rasterizehtml/dist/rasterizeHTML.allinone.js"
],
declare let jsPDF;
import { Component, ElementRef, AfterViewInit} from '@angular/core';
constructor(private elementRef: ElementRef) {
super()
}
let doc = new jsPDF('p', 'px', 'a4');
let options = {
pagesplit: true
};
doc.fromHTML(this.elementRef.nativeElement, 0, 0, options, () => {
doc.save('Test.pdf');
});
}