Some test text!

Loading...
Guides
Customize default styles

Customizing default annotation styles

An annotation's default style is often governed by a tool associated with it. For example, a tool will set stroke color, stroke thickness, fill color, text color, font size and opacity of the annotation, which becomes their 'default' style. To change these properties, you can use the setStyles function on the tool objects.

WebViewer({ ... }, viewerElement)
  .then(instance => {
    const { documentViewer, Annotations } = instance.Core;

    documentViewer.getTool('AnnotationCreateTextHighlight').setStyles(currentStyle => ({
      StrokeColor: new Annotations.Color(0, 221, 255)
    }));

    documentViewer.getTool('AnnotationCreateFreeText').setStyles(currentStyle => ({
      StrokeThickness: 5,
      StrokeColor: new Annotations.Color(0, 0, 255),
      TextColor: new Annotations.Color(0, 0, 0),
      FontSize: '20pt'
    }));
  });

Get the answers you need: Support

Upcoming Webinar: PDFTron SDK Tech Review | Nov 29, 2022 at 2 pm ET

PDFTron SDK

The Platform

NEW

© 2022 PDFTron Systems Inc. All rights reserved.

Privacy

Terms of Use