<!--
{
  "availability" : [
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSAttributedStringDocumentAttributeKey",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:@T@NSAttributedStringDocumentAttributeKey"
  },
  "title" : "NSAttributedStringDocumentAttributeKey"
}
-->

# NSAttributedStringDocumentAttributeKey

The attributes you apply to an entire document.

```
typedef NSString * NSAttributedStringDocumentAttributeKey;
```

## Discussion

The [`NSAttributedStringDocumentAttributeKey`](/documentation/AppKit/NSAttributedStringDocumentAttributeKey) type defines attributes that apply to an entire attributed string, and not to specific ranges of characters. You specify these attributes when writing an attributed string to disk, or reading text from a file on disk. Use these attributes to specify metadata about the overall document, including its author or title, page margin details, font-scaling options for cross-platform interchange, and more.

## Topics

### Getting document type keys

[`extern NSAttributedStringDocumentAttributeKey NSDocumentTypeDocumentAttribute;`](/documentation/AppKit/NSDocumentTypeDocumentAttribute)

The document type.

[`extern NSAttributedStringDocumentAttributeKey NSFileTypeDocumentAttribute;`](/documentation/AppKit/NSFileTypeDocumentAttribute)

The document type for interpreting the document.

[`extern NSAttributedStringDocumentAttributeKey NSTextEncodingNameDocumentAttribute;`](/documentation/AppKit/NSTextEncodingNameDocumentAttribute)

The name of the text encoding to use.

### Getting document metadata keys

[`extern NSAttributedStringDocumentAttributeKey NSAuthorDocumentAttribute;`](/documentation/AppKit/NSAuthorDocumentAttribute)

The author of the document.

[`extern NSAttributedStringDocumentAttributeKey NSCategoryDocumentAttribute;`](/documentation/AppKit/NSCategoryDocumentAttribute)

The document’s category.

[`extern NSAttributedStringDocumentAttributeKey NSCharacterEncodingDocumentAttribute;`](/documentation/AppKit/NSCharacterEncodingDocumentAttribute)

The string encoding for the document.

[`extern NSAttributedStringDocumentAttributeKey NSCocoaVersionDocumentAttribute;`](/documentation/AppKit/NSCocoaVersionDocumentAttribute)

The version of Cocoa that created the file.

[`extern NSAttributedStringDocumentAttributeKey NSCommentDocumentAttribute;`](/documentation/AppKit/NSCommentDocumentAttribute)

The document comments.

[`extern NSAttributedStringDocumentAttributeKey NSCompanyDocumentAttribute;`](/documentation/AppKit/NSCompanyDocumentAttribute)

The company or organization name associated with the document.

[`extern NSAttributedStringDocumentAttributeKey NSConvertedDocumentAttribute;`](/documentation/AppKit/NSConvertedDocumentAttribute)

A value that indicates whether a filter service converted the file.

[`extern NSAttributedStringDocumentAttributeKey NSCopyrightDocumentAttribute;`](/documentation/AppKit/NSCopyrightDocumentAttribute)

The document’s copyright information.

[`extern NSAttributedStringDocumentAttributeKey NSCreationTimeDocumentAttribute;`](/documentation/AppKit/NSCreationTimeDocumentAttribute)

The creation date of the document.

[`extern NSAttributedStringDocumentAttributeKey NSEditorDocumentAttribute;`](/documentation/AppKit/NSEditorDocumentAttribute)

The name of person who last edited the document.

[`extern NSAttributedStringDocumentAttributeKey NSKeywordsDocumentAttribute;`](/documentation/AppKit/NSKeywordsDocumentAttribute)

The document keywords.

[`extern NSAttributedStringDocumentAttributeKey NSManagerDocumentAttribute;`](/documentation/AppKit/NSManagerDocumentAttribute)

The name of the author’s manager.

[`extern NSAttributedStringDocumentAttributeKey NSModificationTimeDocumentAttribute;`](/documentation/AppKit/NSModificationTimeDocumentAttribute)

The modification date of the document.

[`extern NSAttributedStringDocumentAttributeKey NSReadOnlyDocumentAttribute;`](/documentation/AppKit/NSReadOnlyDocumentAttribute)

An indication of whether the document is read-only.

[`extern NSAttributedStringDocumentAttributeKey NSSubjectDocumentAttribute;`](/documentation/AppKit/NSSubjectDocumentAttribute)

The subject of the document.

[`extern NSAttributedStringDocumentAttributeKey NSTitleDocumentAttribute;`](/documentation/AppKit/NSTitleDocumentAttribute)

The document title.

### Getting document appearance keys

[`extern NSAttributedStringDocumentAttributeKey NSAppearanceDocumentAttribute;`](/documentation/AppKit/NSAppearanceDocumentAttribute)

The appearance of the document.

[`extern NSAttributedStringDocumentAttributeKey NSBackgroundColorDocumentAttribute;`](/documentation/AppKit/NSBackgroundColorDocumentAttribute)

The background color of the document.

[`extern NSAttributedStringDocumentAttributeKey NSBottomMarginDocumentAttribute;`](/documentation/AppKit/NSBottomMarginDocumentAttribute)

The bottom margin of the document.

[`extern NSAttributedStringDocumentAttributeKey const NSDefaultFontExcludedDocumentAttribute;`](/documentation/AppKit/NSDefaultFontExcludedDocumentAttribute)

[`extern NSAttributedStringDocumentAttributeKey NSDefaultTabIntervalDocumentAttribute;`](/documentation/AppKit/NSDefaultTabIntervalDocumentAttribute)

The default tab stop interval for the document.

[`extern NSAttributedStringDocumentAttributeKey NSExcludedElementsDocumentAttribute;`](/documentation/AppKit/NSExcludedElementsDocumentAttribute)

The HTML elements to exclude in generated HTML.

[`extern NSAttributedStringDocumentAttributeKey NSHyphenationFactorDocumentAttribute;`](/documentation/AppKit/NSHyphenationFactorDocumentAttribute)

The hyphenation factor of the document.

[`extern NSAttributedStringDocumentAttributeKey NSLeftMarginDocumentAttribute;`](/documentation/AppKit/NSLeftMarginDocumentAttribute)

The left margin of the document.

[`extern NSAttributedStringDocumentAttributeKey NSPaperMarginDocumentAttribute;`](/documentation/AppKit/NSPaperMarginDocumentAttribute)

[`extern NSAttributedStringDocumentAttributeKey NSPaperSizeDocumentAttribute;`](/documentation/AppKit/NSPaperSizeDocumentAttribute)

The paper size for the document.

[`extern NSAttributedStringDocumentAttributeKey NSPrefixSpacesDocumentAttribute;`](/documentation/AppKit/NSPrefixSpacesDocumentAttribute)

The number of spaces for indenting nested HTML elements.

[`extern NSAttributedStringDocumentAttributeKey NSRightMarginDocumentAttribute;`](/documentation/AppKit/NSRightMarginDocumentAttribute)

The right margin of the document.

[`extern NSAttributedStringDocumentAttributeKey NSTextLayoutSectionsAttribute;`](/documentation/AppKit/NSTextLayoutSectionsAttribute)

The layout orientations for each section.

[`extern NSAttributedStringDocumentAttributeKey NSTopMarginDocumentAttribute;`](/documentation/AppKit/NSTopMarginDocumentAttribute)

The top margin of the document.

[`extern NSAttributedStringDocumentAttributeKey NSViewModeDocumentAttribute;`](/documentation/AppKit/NSViewModeDocumentAttribute)

The view mode.

[`extern NSAttributedStringDocumentAttributeKey NSViewSizeDocumentAttribute;`](/documentation/AppKit/NSViewSizeDocumentAttribute)

The view size.

[`extern NSAttributedStringDocumentAttributeKey NSViewZoomDocumentAttribute;`](/documentation/AppKit/NSViewZoomDocumentAttribute)

The view zoom.

### Getting the font-scaling options

[`extern NSAttributedStringDocumentAttributeKey const NSSourceTextScalingDocumentAttribute;`](/documentation/AppKit/NSSourceTextScalingDocumentAttribute)

The text-scaling mode you used when creating the text.

[`extern NSAttributedStringDocumentAttributeKey const NSTextScalingDocumentAttribute;`](/documentation/AppKit/NSTextScalingDocumentAttribute)

The text-scaling mode to use when displaying the text.

### Getting the default attributes

[`extern NSAttributedStringDocumentAttributeKey NSDefaultAttributesDocumentAttribute;`](/documentation/AppKit/NSDefaultAttributesDocumentAttribute)

The default document attributes.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)