cordova-plugin-pdf-viewer-ios
Version:
cordova pdf viewer plugin
160 lines (105 loc) • 3.43 kB
Markdown
This plugin allows you to view pdf file base64 using ios native library PDFKit and it has print, digital signature and share functionality also.
* iOS 13+
* Cordova/Phonegap >=10.0.0
```bash
cordova plugin add cordova-plugin-pdf-viewer-ios
```
```bash
cordova plugin rm cordova-plugin-pdf-viewer-ios
```
The plugin creates the global object ```PDFViewer``` in the window scope.
```js
const options = {
fileName: "dummy.pdf"
};
PDFViewer.viewPDF(base64, options);
```
```js
const options = {
page: 1,
mode: 0,
direction: "vertical",
fileName: "dummy.pdf",
toolbarColour: "#ababab",
doneBtnColour: "#ababab",
doneBtnText: "done",
titleColour: "#000000",
titleText: "dummy",
shareBtnColour: "#000000",
shareBtnText: "share",
printBtnColour: "#000000",
printBtnText: "print",
showShareBtn: "true",
showPrintBtn: "true",
pdfBackgroundColour: "#ababab",
disableCopy: "true",
shareText: "Hello, World",
signPDF: "false",
signaturePlaceHolders: []
};
```
- Its take ```0, 1, 2``` this specify the index of the document page need to be visible
- Its take ```0, 1, 2``` this specify the display mode of the document.
- kPDFDisplaySinglePage = 0,
- kPDFDisplaySinglePageContinuous = 1,
- kPDFDisplayTwoUp = 2,
- kPDFDisplayTwoUpContinuous = 3
- Its take ```vertical or horizontal``` this specify the display direction of the document.
- Its take name of the file with extension like this ```dummy.pdf```
- Its take toolbar colour code in hexadecimal format
- Its take done button colour code in hexadecimal format
- Its take done button text which is visible to user instead of button
- Its take title text colour code in hexadecimal format
- Its take title text which is visible in toolbar center
- Its take share button colour code in hexadecimal format
- Its take share button text which is visible to user instead of button
- Its take print button colour code in hexadecimal format
- Its take print button text which is visible to user instead of button
- Its take background colour code in hexadecimal format
- Its take values as ```"true" or "false"``` to disable or enable copy text from pdf
- Its take values to share with pdf file like title or description
- Its take values as ```"true" or "false"``` to show or hide share button
- Its take values as ```"true" or "false"``` to show or hide print button
- Its take values as ```"true" or "false"``` to enable or disable digital signature in pdf
- Its take values as
```js
[{
sid: "Signature1",
page: 4, //page no
x: 420.0, // coordinate for placeholder box
y: 600.0, // coordinate for placeholder box
width: 100, // width for placeholder box and signature
height: 30, // height for placeholder box and signature
dx: 420.0, // coordinate for signature
dy: 150.0, // coordinate for signature
optional: "false",
signatureTitle: "Signature of Application"
}]
```