Metadata
-
Common PDF metadata keys.
Declaration
Objective-C
typedef NSString *PSPDFMetadataName
-
This class allows you to modify a PDF document’s metadata. Metadata is defined in two ways in the PDF spec (§ 14.3):
- The Info PDF dictionary. This class is handling this.
- A metadata stream containing XMP data. See
PSPDFDocumentXMPMetadata
for that. (https://en.wikipedia.org/wiki/Extensible_Metadata_Platform)
Info dictionary support
All values specified in the Info dictionary are represented by the following types:
NSString
NSNumber
NSDate
NSArray<id>
: can include any of the types mentioned.NSDictionary<NSString*, id>
: value can be any of the types mentioned.
These types can be combined in any way you see fit and it will be converted into the proper PDF types.
Note
The PDF stream type is not yet supported.Declaration
Objective-C
@interface PSPDFDocumentPDFMetadata : NSObject
Swift
class PDFMetadata : NSObject
-
This class allows you to modify a PDF document’s metadata. Metadata is defined in two ways in the PDF spec (§ 14.3):
- A metadata stream containing XMP data. This class is handling this. (https://en.wikipedia.org/wiki/Extensible_Metadata_Platform)
- The Info PDF dictionary. See
PSPDFDocumentPDFMetadata
.
XMP support
This class implements limited XMP support. You can only set and retrieve simple strings.
Namespaces
Each key in the XMP metadata stream has to have a namespace set. You can define your own namespace or use one of the already existing ones. PSPDFKit exposes two constants for common namespaces:
PSPDFXMPPDFNamespace
/PSPDFXMPPDFNamespacePrefix
: The XMP PDF namespace created by Adobe: https://www.adobe.com/content/dam/Adobe/en/devnet/xmp/pdfs/XMPSpecificationPart2.pdf §3.1PSPDFXMPDCNamespace
/PSPDFXMPDCNamespacePrefix
: The Dublin Core namespace: https://en.wikipedia.org/wiki/Dublin_Core
When setting a value, you also have to pass along a suggested namespace prefix, as this can’t be automatically generated.
See moreDeclaration
Objective-C
@interface PSPDFDocumentXMPMetadata : NSObject
Swift
class XMPMetadata : NSObject