Unable to save the transparency to fillColor

I want to save the area annotation with fill-color and transparent as in below fig.
Also adding this line in tool.setStyles will make entire annotation transparent but I just want only filled color transparent

Opacity: 0.2

I have used this -

const tool = this.viewerInstance.docViewer.getTool(‘AnnotationCreateAreaMeasurement’);
tool.setStyles(() => ({
FillColor: new this.viewerInstance.Annotations.Color(92, 142, 184, 0.2)

Using this method, I am getting the xfdf of the annotation and saving it in database. But on page refresh, when I reload xfdf on webviewer, the transparency is gone. Area’s filled color becomes solid colored without transparency.

exportAnnotations() and importAnnotations()

So I want to save that fillColor transparency. How to do that ?

Hi Kiran,

Unfortunately, there is no way to export/import annotations that will keep the fill opacity different from the border opacity that will persist across different PDF viewers. You can however have an annotation with no fill, that still has a border. If you are looking to set the fill opacity just on your own webviewer instance you can however customize the draw function for the annotations you want to change the fill opacity for. But again these changes won’t be applied in other viewers.

Hopefully, that helps.