Skip to content

Knotes/nativescript-generate-pdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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) {
    const 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

About

Generate pdf file with a webview and html.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published