Skip to content

ManuelMouta/cordova-plugin-pdf-reader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cordova-plugin-pdf-reader

This plugin allows you to open a pdf in a native modal. The model has the following structure: header ( tite name, back button, share button ) and Footer (action buttons). You can define the header title (String), the pdf you want to show (base64), and the number of button in the footer bar ( 0 to 3 buttons ).

API Reference

PdfReader

PdfReader.openPdf: function(title,url,buttonsArray,successCallback, errorCallback){
		exec(successCallback, errorCallback, "PDFViewer", "openPdf", [title,url,buttonsArray]);
	}
<strong>title</strong> -&gt; String
<strong>url</strong> -&gt; base64
<strong>buttonsArray</strong> -&gt; JsonArray
	|
    |
    |------&gt; 0 buttons -&gt; buttonsArray = [ ]
    |------&gt; 1 button -&gt; buttonsArray = [{"id":1,"name":"btnName","isDefault":"true"}]
    |------&gt; 2 buttons -&gt; buttonsArray = [{"id":1,"name":"btnName","isDefault":"true"},
    				      {"id":2,"name":"btnName2","isDefault":"false"}]

    <strong>id</strong> -&gt; int (unique)
    <strong>name</strong> -&gt; String
    <strong>isDefault</strong> -&gt; "true"/"false" ("true" if button backgroung blue | "false" if button backgroung white</pre>

Example:

var onSuccess = function (res) {
        console.info(res);

    };

    var onError = function (err) {

        console.error(err);

    };

PdfReader.openPdf("Title Name","iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAmUlEQVR42u3X3QqAIAwFYKGg1/auF+rnzbo1hQIZImo6j7HBuf9Q2aYyxiikKAEJSEDh6CcQIAd5S/cG+RhXp83UCxTCLL1OiGKOGphSUDNMCYhi9pqYXFBzTA6IYrYWmFQQGyYFRDGXzep15i/JBlFM7RofBHdlkI+atQcN3RhZ5tgvhivk+gG5oMVQsyz56N8g+bkKSECx3F93twfcz7kPAAAAAElFTkSuQmCC",[{"id":1,"name":"btn1","isDefault":"true"},{"id":2,"name":"btn2","isDefault":"false"}], onSuccess, onError);

Expected Callbacks:

	onSuccess:
    		res = -1 -> When back Button is pressed.
           	res = x -> When Button with id x is pressed.
            res = y -> When Button with id y is pressed.
            res = z -> When Button with id z is pressed.
  

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 56.3%
  • Objective-C 43.7%