Support

Knowledge Base - RadaeePDF-Cordova Plugin JS methods

Below you can find a list of the RadaeePDF-Cordova Plugin's Javascript exposed methods:

  • Activate License:
    • RadaeePDFPlugin.activateLicense(
      {
           licenseType: 2, //0: standard license, 1: professional license, 2: premium license.
           company: "radaee", //company name you entered during license activation, for iOS "Radaee"
           email: "This email address is being protected from spambots. You need JavaScript enabled to view it.", //the email you entered during license activation
           key: "LNJFDN-C89QFX-9ZOU9E-OQ31K2-FADG6Z-XEBCAO" //your license activation key, for iOS "89WG9I-HCL62K-H3CRUZ-WAJQ9H-FADG6Z-XEBCAO"
       },
       function(message) {
         console.log("Success: " + message);
       },
       function(err) {
        console.log("Failure: " + err);
      });
  • Open file local/remote:
    • RadaeePDFPlugin.open(
      {
         url: "file:///mnt/sdcard/Download/Test.pdf", //remote -> "http://www.radaeepdf.com/documentation/MRBrochoure.pdf"
         password: "", 
         readOnlyMode: false, //optional, if true, the document will be opened in read-only mode
         automaticSave: false, //optional, if true, the modifications will be saved automatically, else a requester to save will be shown
         gotoPage: 2 //optional, if greater than 0, the reader will render directly the passed page (0-index: from 0 to Document.GetPageCount - 1)
      },
      function(message) {
        console.log("Success: " + message);
      },
      function(err){
       console.log("Failure: " + err);
      });
  • Open file from Assets (read-only):
    • RadaeePDFPlugin.openFromAssets(
      {
        url: "Test.PDF",
        password: ""
      },
      function(message){
        console.log("Success: " + message);
      },
      function(err){
        console.log("Failure: " + err);
      });
  • Get current page number: (in case of dual it will return the page on the left)
    • RadaeePDFPlugin.getPageNumber(
      {
      },
      function(message){
        console.log("Success: " + message);
      },
      function(err){
        console.log("Failure: " + err);
      });
  • Get document's form fields in JSON stream: (Returns a json object that contains all the document form fields dictionary)
    • RadaeePDFPlugin.getJSONFormFields(
      {
      },
      function(message){
        console.log("Success: " + message);
      },
      function(err){
        console.log("Failure: " + err);
      });
  • Get specific page's form fields in JSON stream: (Returns a json object that contains a specific page's form fields dictionary)
    • RadaeePDFPlugin.getJSONFormFieldsAtPage(
      {
         page: 1
      },
      function(message){
        console.log("Success: " + message);
      },
      function(err){
        console.log("Failure: " + err);
      });
  • Set form fields' values using JSON stream: (Using the passed json, you can set the value of form fields like: Text fields, checkbox, combo, radio buttons.)
    • RadaeePDFPlugin.setFormFieldWithJSON(
      {
         json: "{\"Pages\": [{\"Page\": 0,\"Annots\": [{\"Index\": 0,\"Name\": \"\",\"Type\": 20,\"FieldName\": \"Fecha\",\"FieldNameWithNO\": \"Fecha\",\"FieldFullName\": \"Fecha\",\"FieldFullName2\": \"Fecha\",\"FieldFlag\": 0,\"FieldFormat\": \"AFDate_FormatEx(\\\"dd\\/mm\\/yyyy\\\");\",\"FieldType\": 2,\"CheckStatus\": -1,\"ComboItemSel\": -1,\"ComboItemCount\": -1,\"ListSels\": \"\",\"ListItemCount\": -1,\"EditText\": \"1\",\"EditType\": 1,\"EditTextFormat\": \"AFDate_FormatEx(\\\"dd\\/mm\\/yyyy\\\");\",\"SignStatus\": -1}]}]}"
      },
      function(message){
        console.log("Success: " + message);
      },
      function(err){
        console.log("Failure: " + err);
      });
  • Set the view mode: (Should be called before show, open methods)
    • RadaeePDFPlugin.setReaderViewMode(
      {
         mode: 3 //0:vertical 3:single 4:dual 6:Dual with cover(1st page single)
      },
      function(message){
        console.log("Success: " + message);
      },
      function(err){
        console.log("Failure: " + err);
      });
  • Set the viewer's background color (the grey color):
    • RadaeePDFPlugin.setReaderBGColor(
      {
         color: 0xffff0000
      },
      function(message){
        console.log("Success: " + message);
      },
      function(err){
        console.log("Failure: " + err);
      });
  • Set the Toolbar background color:
    • RadaeePDFPlugin.setTitleBGColor(
      {
         color: 0xffff0000
      },
      function(message){
        console.log("Success: " + message);
      },
      function(err){
        console.log("Failure: " + err);
      });
  • Set the Toolbar's icons color:
    • RadaeePDFPlugin.setIconsBGColor(
      {
         color: 0xffff0000
      },
      function(message){
        console.log("Success: " + message);
      },
      function(err){
        console.log("Failure: " + err);
      });
  • Set the thumbnails height: (Changes the height of the thumbnail view, Should be called before show, open methods)
    • RadaeePDFPlugin.setThumbHeight(
      {
         height: 150
      },
      function(message){
        console.log("Success: " + message);
      },
      function(err){
        console.log("Failure: " + err);
      });
  • Set the thumbnails background color:
    • RadaeePDFPlugin.setThumbnailBGColor(
      {
         color: 0xffff0000
      },
      function(message){
        console.log("Success: " + message);
      },
      function(err){
        console.log("Failure: " + err);
      });
  • Set if the first page is a cover: (Sets if the first page should be rendered as cover or dual, should be called before show, open methods)
    • RadaeePDFPlugin.setFirstPageCover(
      {
         cover: true
      },
      function(message){
        console.log("Success: " + message);
      },
      function(err){
        console.log("Failure: " + err);
      });
  • Get the total number of pages in the document:
    • RadaeePDFPlugin.getPageCount(
      {
      },
      function(message){
        console.log("Success: " + message);
      },
      function(err){
        console.log("Failure: " + err);
      });
  • Extract the text content of a given page:
    • RadaeePDFPlugin.extractTextFromPage(
      {
         page: 1
      },
      function(message){
        console.log("Success: " + message);
      },
      function(err){
        console.log("Failure: " + err);
      });
  • Encrypt a document and save into another file:
    • RadaeePDFPlugin.encryptDocAs(
      {
         dst: "/sdcard/test_enc.pdf", //path to save, same as path parameter of SaveAs.
         upswd: "user", //user password, can be null (is the public password (shared with authorized users). It's sufficient to open the file with applied permission mask set).
         opswd: "owner", //owner password, can be null (is the password that allow opening the file without any restriction from the permission mask).
         perm: 3, //permission to set, same as GetPermission() method.
           bit 1-2 reserved
           bit 3(0x4) print
           bit 4(0x8) modify
           bit 5(0x10) extract text or image
           others: see PDF reference
         method: 3, //set 3 means using AES 256bits encrypt(Acrobat X), V=5 and R = 6 mode, others AES with V=4 and R=4 mode.
         id: "123456789abcdefghijklmnopqrstuvw" //must be 32 bytes for file ID. it is divided to 2 array in native library, as each 16 bytes (something like the encryption seed or salt in some other encryption scheme. That id is a reserved code that make password stronger).

      },

      function(message){
        console.log("Success: " + message);
      },
      function(err){
        console.log("Failure: " + err);
      });
  • Add a page to bookmarks:
    • RadaeePDFPlugin.addToBookmarks(
      {
         pdfPath: "/mnt/sdcard/Download/Test.pdf", //path to pdf
         page: 1, //0-based page index (from 0 to Document.GetPageCount - 1)
         label: "label" //optional label for the bookmark (in iOS label is not supported)
       },
       function(message){
         console.log("Success: " + message);
       },
       function(err){
         console.log("Failure: " + err);
       });
  • Remove a page from bookmarks:
    • RadaeePDFPlugin.removeBookmark(
      {

         page: 1, //0-based page index (from 0 to Document.GetPageCount - 1)
        
      pdfPath: "/mnt/sdcard/Download/Test.pdf" //path to pdf
       },
       function(message){
         console.log("Success: " + message);
       },
       function(err){
         console.log("Failure: " + err);
       });
  • get bookmarks list in json format:
    • RadaeePDFPlugin.getBookmark(
      {

        
      pdfPath: "/mnt/sdcard/Download/Test.pdf" //path to pdf
       },
       function(message){
         console.log("Success: " + message);
       },
       function(err){
         console.log("Failure: " + err);
       });

The plugin provides the following Callbacks (index.js):

  • function registerCallbacks()
            {
                RadaeePDFPlugin.willShowReaderCallback(willShowReader);
                RadaeePDFPlugin.didShowReaderCallback(didShowReader);
                RadaeePDFPlugin.willCloseReaderCallback(willCloseReader);
                RadaeePDFPlugin.didCloseReaderCallback(didCloseReader);
                RadaeePDFPlugin.didChangePageCallback(function(message){didChangePage(message);});
                RadaeePDFPlugin.didSearchTermCallback(function(message){didSearchTerm(message);});
                RadaeePDFPlugin.didTapOnPageCallback(function(message){didTapOnPage(message);});
                RadaeePDFPlugin.didTapOnAnnotationOfTypeCallback(function(message){didTapOnAnnotationOfType(message);});

                RadaeePDFPlugin.didDoubleTapOnPageCallback(function(message){didDoubleTapOnPage(message);});
                RadaeePDFPlugin.didLongPressOnPageCallback(function(message){didLongPressOnPage(message);});
            }
           
            function willShowReader()
            {
                console.log("--- Callback: willShowReader");
            }
            function didShowReader()
            {
                console.log("--- Callback: didShowReader");
            }
            function willCloseReader()
            {
                console.log("--- Callback: willCloseReader");
            }
            function didCloseReader()
            {
                console.log("--- Callback: didCloseReader");
            }
            function didChangePage(page)
            {
                console.log("--- Callback: didChangePage: " + page);
            }
            function didSearchTerm(term)
            {
                console.log("--- Callback: didSearchTerm: " + term);
            }
            function didTapOnPage(page)
            {
                console.log("--- Callback: didTapOnPage: " + page);
            }
            function didTapOnAnnotationOfType(type)
            {
                console.log("--- Callback: didTapOnAnnotationOfType: " + type);
            }

            function didDoubleTapOnPage(page)
            {
                console.log("--- Callback: didDoubleTapOnPage: " + page);
            }
            function didLongPressOnPage(page)
            {
                console.log("--- Callback: didLongPressOnPage: " + page);
            }
Applies To

RadaeePDF SDK for Android, RadaeePDF SDK for iOS, RadaeePDF SDK for Cordova

Details

Created : 2017-03-02 09:22:49, Last Modified : 2017-11-17 09:28:28

Order history

Login to handle your order history.