Handling fill color on freetextAnnotations

WebViewer Version: 8.7.0

Do you have an issue with a specific file(s)? no
Can you reproduce using one of our samples or online demos? yes
Are you using the WebViewer server? no
Does the issue only happen on certain browsers? no
Is your issue related to a front-end framework? no
Is your issue related to annotations? yes

Please give a brief summary of your issue:
(Think of this as an email subject)

i have a freeTextAnnotation i create using some code but need to specify alpha parameter when color is in hex format and also need to know how to change from color to no color programatically

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)

i create a freetextAnnotation usgin this code

const freeText = new this.annotations.FreeTextAnnotation();
            freeText.X = x;
            freeText.Y = y;
            freeText.PageNumber = page;
            freeText.Width = width;
            freeText.Height = height;
            freeText.Subject = subject;
            freeText.TextAlign = 'center';
            freeText.StrokeThickness = 0;
            freeText.IsHoverable = true;
            freeText.TextVerticalAlign = 'center';
            freeText.TextColor = new this.annotations.Color(0, 0, 0);
            freeText.setContents(contents);
            freeText.setPadding(new this.annotations.Rect(0, 0, 0, 0))
            freeText.FontSize = '14pt';
            freeText.setCustomData('uniqueId', this.uniqueId);
            freeText.FillColor = new that.annotations.Color(that.addedSignersList[that.selectedSigner].color, 0.25)

added signer list and selected signer are something i get from other places but my issue is the following, when i put a color in rgb format i’m able to specify a 4th parameter that allows me to make the color look pale, which is what i need so to not make it too dark, but if I pass the color in hex format and try to specify the alpha parameter it has no effect in how the color looks, so i was wondering if there is any chance to use alpha parameter when using hex format for color.

also i know i can use the same instruction to change the annotation color to another one but how do i tell the system to remove fill color? what should i pass or use to do that?

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:

Hello renkoha,

The Hex color format does not include alpha channel. There is only channels for Red, Green, and Blue. You can actually decode a Hex color by breaking it into its components, for example:

#6fa832
6F Red
A8 Green 
32 Blue

To remove fill colour from a FreeText annotation you can perform:

FreeTextAnnotInstance.FillColor = new instance.Core.Annotations.Color(0,0,0,0)

Best regards,
Tyler Gordon
Web Development Support Engineer
PDFTron