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 or url), and the number of button in the footer bar ( 0 to 3 buttons ).
PdfReader.openPdf: function(title,url,buttonsArray,successCallback, errorCallback){ exec(successCallback, errorCallback, "PDFViewer", "openPdf", [title,url,buttonsArray,subject,description]); }<strong>title</strong> -> String <strong>url</strong> -> base64 <strong>buttonsArray</strong> -> JsonArray | | |------> 0 buttons -> buttonsArray = [ ] |------> 1 button -> buttonsArray = [{"id":1,"name":"btnName","isDefault":"true"}] |------> 2 buttons -> buttonsArray = [{"id":1,"name":"btnName","isDefault":"true"}, {"id":2,"name":"btnName2","isDefault":"false", "needScrollToEnd":"true"}] <strong>id</strong> -> int (unique) <strong>name</strong> -> String <strong>isDefault</strong> -> "true"/"false" ("true" if button backgroung blue | "false" if button backgroung white</pre> <strong>needScrollToEnd</strong> -> If button is active only if scroll reaches bottom <strong>subject</strong> -> email subject for sharing <strong>description</strong> -> Description that appears before buttons
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,"Email subject", "Description before buttons.");
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.