Issue related to passing data to PDFTron.WebViewer

139 views
Skip to first unread message

Anish Jain

unread,
Mar 11, 2014, 9:22:38 AM3/11/14
to pdfnet-w...@googlegroups.com
Hi,
    We are facing issue related to passing data to PDFTron.WebViewer.

    For passing data to PDFTron.WebViewer we are using local storage,
 
    as it is not best practice we always have to pass data though function.

    Please give me possible function where we can pass data while opening WebViewer.

   
We are using .Net MVC4 HTML5 / HTML5 Mobile.

Thanks
Anish Jain

    

Matt Parizeau

unread,
Mar 11, 2014, 12:57:02 PM3/11/14
to pdfnet-w...@googlegroups.com
Hi Anish,

What kind of data are you passing and where are you trying to pass it to exactly?  Are you trying to have some data available in your config file or in ReaderControl/MobileReaderControl.js?

One way you could do this is to use the custom WebViewer option.  When creating the WebViewer object you would add the custom option like this:
new PDFTron.WebViewer({
    custom
: JSON.stringify({ someValue: 10 })
...
}, ele);

Then in your config file you would have:

var myData = JSON.parse(window.ControlUtils.getCustomData());
console
.log(myData.someValue);

Matt Parizeau
Software Developer
PDFTron Systems Inc.
Reply all
Reply to author
Forward
0 new messages