---
title: NSAttributedString.DocumentReadingOptionKey
framework: foundation
role: symbol
role_heading: Structure
path: foundation/nsattributedstring/documentreadingoptionkey
---

# NSAttributedString.DocumentReadingOptionKey

Options for constructing an attributed string from data you read from disk.

## Declaration

```swift
struct DocumentReadingOptionKey
```

## Overview

Overview The NSAttributedString.DocumentReadingOptionKey type defines attributes to use when creating an attributed string from data in a file. Use these strings with methods such as init(data:options:documentAttributes:), init(HTML:options:documentAttributes:), init(URL:options:documentAttributes:), read(from:options:documentAttributes:), and read(from:options:documentAttributes:) to specify expected details. For example, specify the documentType attribute to interpret the file data as a specific file format.

## Topics

### Getting the document options

- [baseURL](foundation/nsattributedstring/documentreadingoptionkey/baseurl.md)
- [characterEncoding](foundation/nsattributedstring/documentreadingoptionkey/characterencoding.md)
- [defaultAttributes](foundation/nsattributedstring/documentreadingoptionkey/defaultattributes.md)
- [documentType](foundation/nsattributedstring/documentreadingoptionkey/documenttype.md)
- [fileType](foundation/nsattributedstring/documentreadingoptionkey/filetype.md)
- [readAccessURL](foundation/nsattributedstring/documentreadingoptionkey/readaccessurl.md)
- [textEncodingName](foundation/nsattributedstring/documentreadingoptionkey/textencodingname.md)
- [textSizeMultiplier](foundation/nsattributedstring/documentreadingoptionkey/textsizemultiplier.md)
- [timeout](foundation/nsattributedstring/documentreadingoptionkey/timeout.md)
- [webPreferences](foundation/nsattributedstring/documentreadingoptionkey/webpreferences.md)
- [webResourceLoadDelegate](foundation/nsattributedstring/documentreadingoptionkey/webresourceloaddelegate.md)

### Getting the font-scaling options

- [sourceTextScaling](foundation/nsattributedstring/documentreadingoptionkey/sourcetextscaling.md)
- [targetTextScaling](foundation/nsattributedstring/documentreadingoptionkey/targettextscaling.md)

### Initializers

- [init(_:)](foundation/nsattributedstring/documentreadingoptionkey/init(_:).md)
- [init(rawValue:)](foundation/nsattributedstring/documentreadingoptionkey/init(rawvalue:).md)

### Type Properties

- [textKit1ListMarkerFormatDocumentOption](foundation/nsattributedstring/documentreadingoptionkey/textkit1listmarkerformatdocumentoption.md)

## Relationships

### Conforms To

- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [RawRepresentable](swift/rawrepresentable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Getting document-wide attributes

- [NSAttributedString.DocumentAttributeKey](foundation/nsattributedstring/documentattributekey.md)
- [HTML attributes](foundation/html-attributes.md)
- [NSAttributedString.DocumentType](foundation/nsattributedstring/documenttype.md)
- [NSAttributedString.TextLayoutSectionKey](foundation/nsattributedstring/textlayoutsectionkey.md)
- [NSTextScalingType](uikit/nstextscalingtype.md)
