Hi,
i am trying to implement mobile webviewer in Telerik Platform (previously known as PhongGap) using javascript. what i actually want to do is to display xod (xod is byte format in json) returned by my web service (conversion from PDF to XOD is done at server side). I did try in the following method, but end up in vain. has anyone done something like this before? if so, can share how it has been done?
var data = “data:application/octet-stream;base64,” + xodString; //xodstring contains the xod byte string returned by webservice
myWebViewer = new PDFTron.WebViewer({
type: type,
path: ‘WebViewer/lib’,
initialDoc: “GettingStarted.xod”,
documentType: docType,
documentId: “GettingStarted”,
enableAnnotations: true,
mobileRedirect: false,
streaming: false //set streaming to ‘true’ if your .xod server doesn’t acknowledge byte-ranges
}, viewerElement);
You should not be using base64 data if your xod file is hosted remotly on server. Base64 encoding is typcially only done when trying to view local xod file (no internet access).
initialDoc should be the url to your xod. Simply putting GettingStarted.xod is telling Webviewer to load that file in the same folder as the html file hosting this javascript. Instead, the url should be something like “http://myserver.domain/storate/file.xod”.
xod is byte format in json. Xod files are not json, and are actually binary data and therefore incompatible. I suppose you are base64 encoding the xod and putting into a json object. I would just put the url in the json and leave the xod alone.