Caption for Area - Measurement Module

Hi guys,

After you create a ruler PDFTron renders a caption with the length of the line, but for the area annotations (Free Shape, Circle or Rectangle ) I cannot find a way to show that value, I mean to keep visible the calculated area as a text over the annotation.

The image below shows an example of the ruler, with the caption visible, and an area, where you cannot see the caption.

Screenshot 2021-05-27 at 16.31.55

Thanks a lot!

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hi Ron,

Circle measurement annotation does not have labels or caption by default.

Hi Daniel,

I replied to our bot named Ron by accident. I gathered more information about labels for these measurement tools.

You can try using this API setCustomDrawHandler on Annotations.EllipseAnnotation
Here is the callback function that is passed to it CustomAnnotationDrawHandler

Here is a possible way for rendering label in circle annotation

Annotations.setCustomDrawHandler(Annotations.EllipseAnnotation, function(ctx, pageMatrix, rotation, options) {
  if (options.annotation.Measure) {
    ctx.fillText(options.annotation.popupComment, options.annotation.X, options.annotation.Y);
  }
  options.originalDraw(ctx, pageMatrix);
});

The reason circle measurement annotation does not have a label is that PDF specification guidelines do not require a label for this annotation type.