npm i --save nativescript-generate-pdf
- Version: 1.0.0
- GitHub: https://github.com/Knotes/nativescript-generate-pdf
- NPM: https://www.npmjs.com/package/nativescript-generate-pdf
- Downloads:
- Last Day: 0
- Last Week: 0
- Last Month: 0
nativescript-generate-pdf
Generate pdf file with a webview and html.
All you need to do is rendering your html with a webview and pass the webview to the plugin.
For iOS, plugin returns the path of the generated PDF.
For Android, it brings up the printer screen where you can save as PDF (Please note the printer screen does not work in simulator, you will need a real device).
Installation
tns plugin add nativescript-generate-pdf
Screenshot
>> Check out the generated pdf<<
Usage
Check out the demo folder.
import { GeneratePdf } from 'nativescript-generate-pdf';
function onWebViewLoaded(args: LoadEventData) {
webView = (<WebView>args.object).nativeView;
// For iOS, use the file path returned by createPdf.
new GeneratePdf().createPdf(webView, 'MyPdfFileName');
}
License
Apache License Version 2.0, January 2004