nativescript-generate-pdf
by knotes | v1.0.0
Generate pdf file with a webview and html.
npm i --save nativescript-generate-pdf

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