Multiple overlapping RectangleAnnotation objects make text invisible — how to prevent opacity stacking?

Environment:

  • Apryse WebViewer (JavaScript/TypeScript)

  • Version: @pdftron/webviewer ^11.x

Problem:

We use RectangleAnnotation to highlight geo-tagged bounding box regions on a PDF page. Each annotation is created with Opacity = 0.5. When multiple bounding boxes overlap spatially on the same page, the overlapping regions visually darken progressively — more overlaps = darker — eventually making the underlying PDF text completely invisible.

Steps to Reproduce:

  1. Initialize WebViewer and load any PDF document.

  2. Programmatically create two Annotations.RectangleAnnotation objects.

  3. Position them so that they partially overlap each other.

  4. Set the Opacity for both annotations to 0.5 (or any value below 1.0).

  5. Set a FillColor (e.g., Yellow) for both.

  6. Add both to the AnnotationManager and call drawAnnotations().

  7. Observed Result: The area where the two rectangles overlap is significantly darker than the non-overlapping areas, and the text underneath becomes hard to read.

Question:

We need to stick with RectangleAnnotation due to the geo-tagged coordinate data we receive. What is the correct WebViewer JS API or configuration to render multiple overlapping RectangleAnnotation objects with a uniform flat opacity, so the overlap area looks identical to non-overlapping areas (i.e. no opacity compounding between annotations)?

cc: @saibalakrishna7799

Hello @ravi.priyadarshi ,

Thank you for posting on our forum.

We noticed that an acquaintance of yours has posted a duplicate forum post and has tagged you here: https://community.apryse.com/t/multiple-overlapping-rectangleannotation-objects-make-text-invisible-how-to-prevent-opacity-stacking/12508

To keep all information in the same location for any users facing similar issues, we will move forward on that forum post to investigate the reported issue.

We will reach out shortly on that forum post.

Best Regards,
Jacob Romano Carlsen
Web Development Support Engineer
Apryse Software Inc.