Customize annotation style presets on iOS

Overview

Annotation tools come with a set of four presets, accessible from the presets section:

Apryse Docs Image

Annotation tools can also be invoked via a long-press.

These presets are "sticky" in that changes made by the user to each preset will persist between runs of your app.

This guide explains how to customize the initial values of the presets.

Customizing Presets

Presets are customized using a custom plist (property list) that must be called PTAnnotationStyleDefaults.plist file included in your app's bundle. This can be done by including the file in your Xcode project and ensuring that it is copied into the app bundle as shown:

Apryse Docs Image

The plist contains an array of dictionaries. Each dictionary has two entries, one with the key types and the other with the key presets.

The value of the types entry is an array of strings, where each string value is the name of the annotation type for which the associated presets apply.

The value of the presets entry is an array of exactly four dictionaries, where each dictionary represents one preset. The dictionaries contain key/value pairs, where the key is the annotation property, and the value is its initial value.

This is an example .plist file, shown in Xcode's plist editor, and written as xml. A list of all possible keys follows the example. You can also download the example plist file.

Apryse Docs Image

XML

1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3<plist version="1.0">
4<array>
5 <dict>
6 <key>types</key>
7 <array>
8 <string>Ink</string>
9 </array>
10 <key>presets</key>
11 <array>
12 <dict>
13 <key>thickness</key>
14 <integer>2</integer>
15 <key>color</key>
16 <string>#00ff00</string>
17 </dict>
18 <dict>
19 <key>thickness</key>
20 <integer>4</integer>
21 <key>color</key>
22 <string>#00ff00</string>
23 </dict>
24 <dict>
25 <key>thickness</key>
26 <integer>8</integer>
27 <key>color</key>
28 <string>#ff0000</string>
29 </dict>
30 <dict>
31 <key>thickness</key>
32 <integer>16</integer>
33 <key>color</key>
34 <string>#ff0000</string>
35 </dict>
36 </array>
37 </dict>
38 <dict>
39 <key>types</key>
40 <array>
41 <string>Highlight</string>
42 </array>
43 <key>presets</key>
44 <array>
45 <dict>
46 <key>color</key>
47 <string>#123456</string>
48 <key>opacity</key>
49 <real>0.3</real>
50 </dict>
51 <dict>
52 <key>color</key>
53 <string>#00ff00</string>
54 </dict>
55 <dict>
56 <key>color</key>
57 <string>#00ffff</string>
58 </dict>
59 <dict>
60 <key>color</key>
61 <string>#ff00ff</string>
62 </dict>
63 </array>
64 </dict>
65 <dict>
66 <key>types</key>
67 <array>
68 <string>Underline</string>
69 <string>Squiggly</string>
70 <string>StrikeOut</string>
71 </array>
72 <key>presets</key>
73 <array>
74 <dict>
75 <key>color</key>
76 <string>#111111</string>
77 </dict>
78 <dict>
79 <key>color</key>
80 <string>#00cc63</string>
81 </dict>
82 <dict>
83 <key>color</key>
84 <string>#4e7de9</string>
85 </dict>
86 <dict>
87 <key>color</key>
88 <string>#000000</string>
89 </dict>
90 </array>
91 </dict>
92</array>
93</plist>

presets key

value

property

color

hex-formatted RRGGBB string, e.g. #ff0000

The color or stroke color of the annotation.

fillColor

hex-formatted RRGGBB string, e.g. #00ff00

The fill color of the annotation.

textColor

hex-formatted RRGGBB string, e.g. #0000ff

The color of the text of a PTFreeText annotation.

textSize

number, e.g. 16

The font size, in pts, of a PTFreeText annotation.

thickness

number, e.g. 2

The thickness, in pixels, of an annotation's stroke.

opacity

number between 0 and 1, e.g. 0.5

The opacity of an annotation.

types array (case sensitive)

Text

Link

FreeText

Line

Square

Circle

Polygon

Polyline

Highlight

Underline

Squiggly

StrikeOut

Stamp

Caret

Ink

Popup

FileAttachment

Sound

Movie

Widget

Screen

PrinterMark

TrapNet

Watermark

ThreeDimensional

Redact

Projection

RichMedia

Arrow

Signature

Cloudy

Ruler

Perimeter

Area

ImageStamp

PencilDrawing

FreehandHighlight

Callout

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales