A PDF viewer can put a signature in the wrong place even when the pointer coordinates look correct. The page might be rotated, zoomed, or displayed at a different size from its canvas bitmap. An overlay that happens to line up at 100% zoom can drift as soon as the user changes the view.
The fix starts with keeping two coordinate systems separate. Store an annotation in PDF page coordinates. Convert it to viewport coordinates when displaying it, and convert a pointer position back when the user edits it. PDF.js exposes both conversions on its page viewport.
Reproduce the offset
Use a page with a visible corner mark. Place an annotation near that mark, zoom in, then rotate the page by 90 degrees. Reopen the saved file in another viewer. If the annotation moves away from the mark, inspect how the placement was converted before blaming the export.
PDF page coordinates traditionally have their origin at the lower left and increase upward.…