# Customizing PDF annotation appearance streams

An annotation or form element in a PDF can specify an appearance stream, which allows the annotation to be rendered differently than its default annotation rendering. Each appearance stream is a self-contained PDF object that will be rendered inside the annotation rectangle. (See also: [What Are Appearance Streams?](https://www.nutrient.io/blog/what-are-appearance-streams/))

Most appearance streams are _just a visual representation of an annotation’s properties_. This helps third-party PDF viewers that may be unable to directly generate a visual representation of those properties; these viewers can render the appearance stream instead. Appearance streams also ensure that the annotations in a document are displayed exactly as they were created in the source PDF editor, without subtle differences that could occur if the third-party PDF viewer had to recreate the annotations from raw annotation data.

However, sometimes appearance streams contain surprises. For example, square annotations may have an appearance stream with a photograph. There are a lot of edge cases out there, so one cannot disable appearance stream rendering and assume the annotation will look the same or even close to it.

If you’re using Document Engine, note that appearance stream rendering only works for documents uploaded after upgrading to 2020.3.0.

Changing an annotation will remove existing appearance streams and rerender them using the Nutrient drawing engine. Some exceptions apply, such as stamp annotations containing an image or signature form elements.

Nutrient allows you to define custom appearance streams on any annotation type by setting the [`Annotation`](https://www.nutrient.io/api/ios/documentation/pspdfkit/annotation)’s [`appearanceStreamGenerator`](https://www.nutrient.io/</api/ios/documentation/pspdfkit/annotation/appearancestreamgenerator/>) property.

## Checking if an annotation includes an appearance stream

The [`hasAppearanceStream`](https://www.nutrient.io/</api/ios/documentation/pspdfkit/annotation/hasappearancestream/>) property indicates if the annotation has an appearance stream attached.

To remove an appearance stream, set the [`dirty`](https://www.nutrient.io/</api/ios/documentation/pspdfkit/annotation/isdirty/>) property to `true`.

## Appearance stream generator

We provide basic implementations of the [`AppearanceStreamGenerating`](https://www.nutrient.io/api/ios/documentation/pspdfkit/appearancestreamgenerating) interface:

- [`FileAppearanceStreamGenerator`](https://www.nutrient.io/api/ios/documentation/pspdfkit/fileappearancestreamgenerator) is an appearance stream generator that takes an `NSURL` to any PDF file and returns it as the appearance stream.

- [`DrawingContextAppearanceStreamGenerator`](https://www.nutrient.io/api/ios/documentation/pspdfkit/drawingcontextappearancestreamgenerator) generates an appearance stream from the result of calling `Annotation.draw(context:options:)`. This is the default.

## Annotation with an appearance stream generator

It’s easy to set up an annotation to show a custom appearance stream. This is typically done with stamp annotations because they have few other properties. A stamp annotation used this way is usually called an image annotation. To learn more, see our guide on [image annotations](https://www.nutrient.io/../../annotations/image-annotations/).

Syncing appearance streams is currently not supported by Nutrient Instant.
---

## Related pages

- [Customizing color presets on iOS](/guides/ios/annotations/customizing-presets.md)
- [Creating a fixed-sized annotation on iOS](/guides/ios/annotations/fixed-size-annotations.md)
- [Hiding annotations on iOS](/guides/ios/annotations/disable-rendered-annotation-types.md)
- [Configure annotation presets on iOS](/guides/ios/annotations/changing-default-values-for-color-and-text-size-of-annotations.md)
- [Store custom data in iOS PDF annotations](/guides/ios/annotations/custom-data-in-annotations.md)
- [Customizing note icons on iOS](/guides/ios/annotations/customize-annotation-rendering.md)

