# Default Settings

DsPdfViewer lets you define default settings for various properties in annotation and form editors. Learn more in DsPdfViewer Docs.

## Content

The values for annotation and form field properties can be set by using the properties panel of respective editors. However, you can also set the default value of any annotation or form field property by using the **editorDefaults** option.
For example, the below sample code sets default values of square annotation properties like border width and interior (fill) color:

```javascript
var viewer = new DsPdfViewer("#root", {
       editorDefaults: {
            squareAnnotation: {
                borderStyle: { width: 5, style: 1 },
                color: '#000000',
                interiorColor: '#ff0000',
            }
        },
        supportApi: "api/pdf-viewer"
});
```

The default values, as set above, will be used every time a square annotation is added to a PDF document as shown below:
![](https://cdn.mescius.io/document-site-files/images/884d2bfb-301b-49bc-8d90-656c5b910507/images/default-square-annotation-setting.png)

## Opacity

You can set the opacity property for all annotations. The valid value for the property can be within the range of 0.0 (fully transparent) to 1.0 (fully opaque). An annotation will appear as completely opaque if no opacity value is defined.
For example, the below sample code sets default values of square annotation properties along with opacity:

```javascript
var viewer = new DsPdfViewer("#root", {
        editorDefaults: {
             squareAnnotation: {
                 borderStyle: { width: 5, style: 1 },
                 color: '#000000',
                 opacity: 0.3,
                 interiorColor: '#ff0000',
             }
         },
         supportApi: "api/pdf-viewer"
 });
```

The default values of opacity and other properties will be used every time a square annotation is added to a PDF document as shown below:
![](https://cdn.mescius.io/document-site-files/images/884d2bfb-301b-49bc-8d90-656c5b910507/images/opacity-square-annotation-setting.png)

> !type=note
> **Note:** The opacity value applies to all visible markup annotations and not the popup annotations as shown below:
> 
> ![](https://cdn.mescius.io/document-site-files/images/884d2bfb-301b-49bc-8d90-656c5b910507/images/opacity_popup_annotation.png)

**Limitation**
The opacity property is only supported by annotations and not by form fields.

## Default Color for Sticky Notes

You can set the default color of a sticky note by using the **editorDefaults** option:

```javascript
var viewer = new DsPdfViewer("#root", {
     editorDefaults: {
       stickyNote: { color: "#ff0000" }
     },
     supportApi: 'api/pdf-viewer'
});
```

The sticky note will be displayed in red color, as set above, in the PDF document as shown below:
![](https://cdn.mescius.io/document-site-files/images/884d2bfb-301b-49bc-8d90-656c5b910507/images/sticky-note-default-setting.png)

## Handle Sizes

You can set the default values for resize, move or dot handle sizes by using **editorDefaults** options. The predefined value for resizeHandleSize and moveHandleSize setting is 8 and 14 pixels respectively. The below example code sets the default values for different handles:

```html
<script>
    var viewer = new DsPdfViewer("#host",
        {   editorDefaults: {
                resizeHandleSize: 20,
                moveHandleSize: 40,
                dotHandleSize: 20
            },
            supportApi: 'api/pdf-viewer'
        }
    );  
    viewer.addDefaultPanels();
    viewer.addAnnotationEditorPanel();
    viewer.addFormEditorPanel();
</script>
```

![](https://cdn.mescius.io/document-site-files/images/884d2bfb-301b-49bc-8d90-656c5b910507/images/handlesize.png)

## Font Family

The following fonts appear for all the text fields and FreeText annotation in DsPdfViewer, by default.
![](https://cdn.mescius.io/document-site-files/images/884d2bfb-301b-49bc-8d90-656c5b910507/images/font-family-default.png)
However, you can specify the default font names for the text fields and FreeText annotation by setting the **fontName** property in **editorDefaults** option.
The below example code changes the array of default font names and sets 'Courier' as default font for FreeText annotation:

```javascript
var viewer = new DsPdfViewer("#host", {
        editorDefaults: {
            fontNames: [{ value: 'Arial', name: 'Arial' }, { value: 'Verdana', name: 'Verdana' }],
            freeTextAnnotation: { fontName: 'Courier' }
            },
        supportApi: "api/pdf-viewer"
});
```

The output of above code will look like below for a FreeText annotation:
![](https://cdn.mescius.io/document-site-files/images/884d2bfb-301b-49bc-8d90-656c5b910507/images/font-name-defined-array.png)
If 'freeTextAnnotation' setting is skipped in the above code, the 'Helvetica' font will appear as the default font instead of 'Courier' font.

> !type=note
> **Note:** When a custom font is specified by using the fontNames setting, that font should be available in the web browser too.

For more information, refer [Editor Defaults](https://developer.mescius.com/documents-api-pdfviewer/demos/id/editor-defaults) in DsPdfViewer demos.