PDF.js Express Version
- Build: “Ni8yOS8yMDIwfDZhZDkzMGE=”
- Core version: “6.3.4”
- Full API: false
- UI version: “6.3.3”
- WebViewer Server: false
Detailed description of issue
I’ve showing PDFJs into Modal Component where we will set the our Custom annotation controls to our Pdf document but the problem is that when we check on different resolution its drop point location have changed.
Expected behaviour
Drop annotation point should be the same.
Does your issue happen with every document, or just one?
Every document
Code snippet
dropPoint ={};
instance.iframeWindow.document.body.ondrop = (e) => {
const scrollElement = instance.docViewer.getScrollViewElement();
const scrollLeft = scrollElement.scrollLeft || 0;
const scrollTop = scrollElement.scrollTop || 0;
this.dropPoint = { x: e.pageX + scrollLeft, y: e.pageY + scrollTop };
this.addanotation(instance,this.dropPoint.x,this.dropPoint.y,customData);
e.preventDefault();
return false;
addanotation(viewer,X,Y,Data)
{
let point = this.dropPoint || { x: layerX, y: layerY };
const { Annotations, docViewer, annotManager } = instanceRef;
const pageNumber = docViewer.getCurrentPage();
const freeText = new Annotations.FreeTextAnnotation();
freeText.PageNumber = pageNumber;
freeText.X = point.x;
freeText.Y = point.y;
annotManager.deselectAllAnnotations();
annotManager.addAnnotation(freeText);
annotManager.redrawAnnotation(freeText);
annotManager.selectAnnotation(freeText);
}