Method SyncMetadata
- Namespace
- BitMiracle.Docotic.Pdf
- Assembly
- BitMiracle.Docotic.Pdf.dll
SyncMetadata(bool)
Synchronizes values in XMP Metadata and Document Info.
public void SyncMetadata(bool preferXmp)
Parameters
preferXmp
boolWhether to treat XMP metadata as the primary source of the information.
Remarks
This method updates both XMP metadata and Document Info values. The goal is to have both as close to having the same values as possible.
This method adds XMP metadata to the document if there are no XMP metadata before the call.
You can skip metadata synchronization if there are no XMP metadata to embed when saving the document. You can check whether XMP metadata should be embedded when saving the document using the ShouldBeEmbedded() method.
This method checks two or more corresponding properties from PdfInfo and XmpMetadata, takes the first non-null and not empty value, and then applies the value to all the corresponding properties.
When the preferXmp
is true
, the method starts checking from
XMP metadata. Therefore, when all corresponding Document Info and XMP Metadata
properties contain non-null and not empty values, the value from XMP will be applied to
all the properties. When the preferXmp
is false
, the method
starts checking from Document Info.
Here are the corresponding properties:
- Title and Title
- Author and Author
- Subject and Subject
- Keywords and Keywords
- Creator and Creator
- Producer and Producer
- CreationDate, CreateDate, and CreationDate
- ModifiedDate, ModifyDate, and ModifiedDate
- custom properties in PdfInfo and Custom schema
This method also updates the following properties with the synced values:
- CreatorTool with Creator
- MetadataDate with ModifiedDate
- Creators with Author
- Descriptions with Subject
- Titles with Title