Change style for sticky annotation

PDF.js Express Version

Detailed description of issue
Hello, I’m looking to change the color of the sticky annotation entirely. I am using the setCustomDrawHandler to change the fillStyle but that is changing the color of the entire annotation. I’m looking to change the border as well as the inside of the icon to different colors. See attached screenshot. Note: I have the numbering system complete, I am just asking about the styles. Appreciate the help!

Expected behaviour
Screen Shot 2021-07-29 at 11.59.55 AM

Does your issue happen with every document, or just one?
{Answer here}

Link to document
{Provide a link to the document in question if possible}

Code snippet
{Provide a relevant code snippet}

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:


This is the best I could do at the moment.

Screen Shot 2021-07-29 at 1.58.06 PM


Looking in to this now, the best I can do so far is what you have done as well lol. These nozoom annotations are a bit tricky when it comes to customizing.

Will get back to you once I find a solution.


Okay sounds good Logan. Appreciate the help!

Hey there,

Looked into the source code a bit and unfortunately this is not possible at the moment. We have a function that draws that comment bubble on the canvas and it has the stroke color hard coded to black, and unfortunately that function cannot be overridden/replaced due to our obfuscation techniques.

Our UI does not have the option to set the stroke color of these icons either (for the same reason).

For now you will have to make due with just setting StrokeColor to something that looks good with your number icon.

Edit: I was just informed that the PDF Specification does not let you set a border color, which is why we implemented it this way

Sorry about that.


No worries Logan. Thanks for the insight.

1 Like