How to convert between WebViewer Annot Rect (Coordinates) to PDFNet Rect

You can convert from WebViewer Annotation Rect to PDFNet Rect like this:

const currentDocument = docViewer.getDocument();
const annotRect = await annotation.getRect();
const setTopLeft = currentDocument.getPDFCoordinates(annot.getPageNumber(), annotRect.x1, annotRect.y1);
const setBottomRight = currentDocument.getPDFCoordinates(annot.getPageNumber(), annotRect.x2, annotRect.y2);
const pdfNetRect = await PDFNet.Rect.init(setTopLeft.x, setTopLeft.y, setBottomRight.x, setBottomRight.y);
1 Like