This repository contains an example of exporting pdf from ionic
- start with a blank new app and install two Cordova Plugins and install npm packages
ionic cordova plugin add cordova-plugin-file-opener2
ionic cordova plugin add cordova-plugin-file
npm install pdfmake @ionic-native/file-opener @ionic-native/file
- Once your installation is finished, head over to your src/app.module.ts and add our two Plugins like this:
import { File } from '@ionic-native/file'
;import { FileOpener } from '@ionic-native/file-opener'
;
- Add two providers in Provider section of app.module.ts.
- File
- FileOpener
- Then create your view.
- Go ahead and open your
src/pages/home/home.html
and insert input field and two buttons.One button for creating the pdf and another for downloading the pdf.
- Create PDFs, Store Files and Display the Viewer
- Go ahead and open your
src/pages/home/home.ts
and insert the code for crating and downloading the pdf.