Timothy Elliott
unread,Dec 9, 2014, 11:07:31 AM12/9/14Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pdfnet-w...@googlegroups.com
Hi,
I'm trying to programmatically highlight text in a xod document using code supplied here on the message board. The document is displayed but I keep receiving the message 'TypeError: docViewer is undefined'. This seems pretty basic, where am I going wrong?
Here is my code:
$(function() {
var viewerElement = document.getElementById("viewer");
var myWebViewer = new PDFTron.WebViewer({
path: "#webapp()/pdftron/lib",
type: "html5,silverlight,flash",
initialDoc: "#webapp()/pdftron/GettingStarted.xod"
}, viewerElement);
var docViewer = this.docViewer;
var am = docViewer.GetAnnotationManager();
var topLeft = { x: 200, y: 100, pageIndex: 0};
var bottomRight = { x: 300, y: 200, pageIndex: 0};
var annot = new Annotations.TextHighlightAnnotation();
annot.SetPageNumber(1);
annot.FillColor = new Annotations.Color(0, 255, 255);
am.AddAnnotation(annot);
var textHighlightTool = new docViewer.ToolModes.TextHighlightCreate(docViewer);
textHighlightTool.annotation = annot;
textHighlightTool.pageCoordinates[0] = topLeft;
textHighlightTool.select(topLeft, bottomRight);
});
Thanks in advance,
Tim