Detailed description of issue
Hi there. This is a follow up question to providing a number at the corner of an annotation using setCustomDrawHandler. StickyAnnotation works well in a sense with the number at the bottom right and it stays there when the note is moved. The issue I am running into is with shapes, specifically Ellipse, Rectangle and Cloud. The number does not start at the bottom right and resizing the shapes does not help either. In addition when I move the annotation the number does not follow. I figured that matching the same width and height as the annotation with the ctx.fillText would work but this is not the case. Appreciate the help!
The CTX passed in for the Rectangle and Ellipse annotations is a bit different than the one passed in for for sticky note (its hard to explain why but its for a good reason - has to do with zooming behaviour for sticky notes).
The CTX passed for shapes is the size of the entire page, instead of just the annotation, so you need to adjust accordingly.
Here’s some code to get you started (all im doing is using annot.X + width for my x pos instead of just width, and same for height):
When drawing the number icon on the Ellipse annotation, you will run into issues where the number is not on the actual circle, and its because of this:
Another question related to numbering annotations. The method above is achieved through redrawing the canvas but that does not actually modify the xfdf file, correct? So when we “merge”, we are taking the pdf file and the xfdf file and creating downloadable file. Will the numbered annotations be present in that file? If so, do you see a way to include these numbered annotations only when exporting the pdf?