not opening last note when I open my document, it is possible?

20 views
Skip to first unread message

Jorge Espinoza

unread,
Apr 23, 2014, 7:00:36 PM4/23/14
to pdfnet-w...@googlegroups.com

Hi

When I open any document with a note created, the webviewer is jumping to the last note created, can I stop do thats?


And other question... It's possible activate the note button for open the note when I'm not in the edit mode? because the only way to open a note is when I'm in edit mode, I want to open the note popup in any time and do content editing, If I'm not in edit mode I don't want to move the icon, but I want to open the note popup.

Thanks

Matt Parizeau

unread,
Apr 24, 2014, 6:02:38 PM4/24/14
to pdfnet-w...@googlegroups.com
Hi,

I'm not sure what you mean by WebViewer jumping to the last note automatically. Do you see the same thing if you try it in our samples? We don't do this by default in the mobile or desktop viewers so maybe a customization you've done is causing this.

Here is some sample code that I think should do what you want. You could put this in a config file.
var oldLeftUp = window.Tools.PanTool.prototype.mouseLeftUp;
window
.Tools.PanTool.prototype.mouseLeftUp = function(e) {
    oldLeftUp
.call(this, e);

   
var docViewer = readerControl.docViewer;
   
var annotationManager = docViewer.GetAnnotationManager();

   
var mousePoint = {
        x
: e.pageX,
        y
: e.pageY
   
};

    readerControl
.forEachPageInWrapper(docViewer.GetCurrentPage() - 1, function(pageIndex) {
       
var pageCoordinate = readerControl.displayMode.WindowToPage(mousePoint, pageIndex);
       
var annotations = annotationManager.GetAnnotationsList();

       
for (var i = 0; i < annotations.length; i++) {
           
var annot = annotations[i];
           
if (!(annot instanceof Annotations.StickyAnnotation)) {
               
continue;
           
}

           
if (annot.GetPageNumber() - 1 === pageCoordinate.pageIndex) {

               
var rect = {
                    x1
: annot.GetLeft(),
                    y1
: annot.GetTop(),
                    x2
: annot.GetRight(),
                    y2
: annot.GetBottom()
               
};
               
if (pageCoordinate.x >= rect.x1 && pageCoordinate.x <= rect.x2 && pageCoordinate.y >= rect.y1 && pageCoordinate.y <= rect.y2) {
                    annotationManager
.SelectAnnotation(annot);
                    readerControl
.showNotePopup(annot, true);
                   
break;
               
}
           
}
       
}
   
});
};

var oldLeftDown = window.Tools.PanTool.prototype.mouseLeftDown;
window
.Tools.PanTool.prototype.mouseLeftDown = function(e) {
    oldLeftDown
.call(this, e);

    readerControl
.annotationManager.DeselectAllAnnotations();
};

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