![]() | InDesign SDK 20.5 |
Public Member Functions | |
| SnpPerformXMPCommands () | |
| virtual | ~SnpPerformXMPCommands () |
| virtual ErrorCode | ReplaceMetaDataFromFile (IPMUnknown *targetObject, const IDFile &sysFile, bool16 stripForeignData=kFalse) |
| virtual ErrorCode | AppendMetaDataFromFile (IPMUnknown *targetObject, const IDFile &sysFile) |
| virtual ErrorCode | SaveMetaDataToFile (IPMUnknown *targetObject, const IDFile &sysFile) |
| IMetaDataAccess * | QueryMetaData (IPMUnknown *targetObject) |
A bit of background about XMP MetaData support in InDesign/InCopy:
In InDesign/InCopy, you can use the File >> File Info... menu item to open a dialog that gives you access to the MetaData related operations for your InDesign/InCopy document. In that dialog, you can do things such as:
Using XMP, you can attach metadata to your document, or information about the content of your document. For example, you can store these items as MetaData:
This codesnippet shows some of the API commands that do the same thing, so you can automate your workflow involving MetaData.
For more information about using MetaData in the InDesign/InCopy application, consult the InDesign/InCopy on-line help.
For general information about XMP, refer either to the XMP Overview Page (http://www.adobe.com/products/xmp/main.html).
To incorporate XMP into your custom application outside of InDesign, refer to the XMP Toolkit Download page (http://partners.adobe.com/asn/developer/xmp/download/).
How to use this snippet
First, 'save' the MetaData from the current document to a file. Then using a text editor, modify the data inside some of the existing XMP MetaData "paths", and then 'replace'. Make further changes, such as adding in new custom schemas, and then 'append'. Then view how the MetaData changed in the File Information dialog.
XMP Programming Use cases:
How do I save MetaData to file?
Query the IMetaDataAccess interface on the boss with the MetaData model, and call the SaveToStream() method. (See SnpPerformXMPCommands::SaveMetaDataToFile())
How do I load MetaData from file?
Process the kReplaceMetaDataCmdBoss (formerly known as kLoadMetaDataCmdBoss in 2.x). Specify the target boss (e.g. document) and the IDFile in the IReplaceMetaDataCmdData data interface (which used to be ILoadMetaDataCmdData in 2.x). Optionally, you can strip MetaData that is not part of the default InDesign MetaData set, by processing kStripForeignMetaDataCmdBoss. This corresponds to the OFF state of the "Preseve additional MetaData" checkbox in the File >> File Info... dialog. (See SnpPerformXMPCommands::ReplaceMetaDataFromFile())
How do I merge MetaData from file?
Process the kAppendMetaDataCmdBoss (formerly known as kMergeMetaDataCmdBoss in 2.x). Specify the target boss (e.g. document) and the IDFile in the IAppendMetaDataCmdData data interface (which used to be IMergeMetaDataCmdData in 2.x) (See SnpPerformXMPCommands::AppendMetaDataFromFile())
How do I get the value of a particular MetaData object?
Query the IMetaDataAccess interface on the boss with the MetaData model, and call the Enumerate() or Get() methods. (See SnpInspectXMPMetaData)
How do I count the number of data elements of a particular MetaData tag?
Query the IMetaDataAccess interface on the boss with the MetaData model, and call the Count() method.
Reference:
Related interfaces (in order of importance):
<UL>
<LI>IMetaDataAccess is a wrapper to IMetaData as well as the XMP
Toolkit API.</LI>
<LI>IMetaDataIterator is an iterator interface for MetaData
objects.</LI>
<LI>IAdobeBasicJobMetaData is a data interface to store and retrieve
Adobe Basic Job MetaData. </LI>
<LI>IAdobeCoreMetaData is a data interface to store and retrieve
Adobe Core MetaData.</LI>
<LI>IAdobeMediaMgmtMetaData is a data interface to store and retrieve
Adobe Media Management MetaData.</LI>
<LI>IAdobeRightsMgmtMetaData is a data interface to store and retrieve
Adobe Rights Management MetaData.</LI>
<LI>ICalculateMetaData is a helper interface used by the MetaDataResponder
to calculate Adobe core MetaData.</LI>
<LI>ILoadMetaData is a helper interface used by kLoadMetaDataCmdBoss and
kStripForeignMetaDataCmdBoss. (This interface was obsoleted in 3.0)</LI>
<LI>IMergeMetaData is a helper interface used by kMergeMetaDataCmdBoss.
(This interface was obsoleted in 3.0)</LI>
<LI>IMetaData is used for the MetaData model, and should only be used from
within a command.</LI>
</UL>
Other Includes to use:
<UL>
<LI>MetaDataID.h</LI>
<LI>MetaDataTypes.h (included by various MetaData interfaces)</LI>
</UL>
Boss classes that have a MetaData model (look for IMetaData):
<UL>
<LI>kDocBoss is the MetaData model associated with a document.
<LI>kMetaDataBoss is a generic MetaData model.
</UL>
High-level MetaData commands:
<UL>
<LI>kAppendMetaDataCmdBoss is in this codesnippet. Appends MetaData from a IDFile. Uses IAppendMetaDataCmdData.
<LI>kReplaceMetaDataCmdBoss is in this codesnippet. Loads MetaData from a IDFile and replaces the current document's metadata with it. Uses IReplaceMetaDataCmdData.
</UL>
Low-level MetaData commands:
<UL>
<LI>kSetAdobeCoreMetaDataCmdBoss sets the Adobe Core MetaData. Uses ISetAdobeCoreMDCmdData.
<LI>kSetAdobeRightsMgmtMDCmdBoss sets the Adobe Core MetaData. Uses ISetAdobeCoreMDCmdData.
<LI>kSetAdobeBasicJobMDCmdBoss sets the Adobe Core MetaData. Uses ISetAdobeCoreMDCmdData.
<LI>kSetAdobeMediaMgmtMDCmdBoss sets the Adobe Core MetaData. Uses ISetAdobeCoreMDCmdData.
<LI>kStripForeignMetaDataCmdBoss removes the non-Adobe MetaData. Uses IStripForeignMetaDataCmdData.
</UL>
| inline |
Constructor.
| inlinevirtual |
Destructor.
| virtual |
Appends the MetaData from a file into a boss class (e.g. document).
| targetObject | IN The target boss class (e.g. document) to merge MetaData into. |
| sysFile | IN sysfile to read from. |
| IMetaDataAccess * SnpPerformXMPCommands::QueryMetaData | ( | IPMUnknown * | targetObject | ) |
Obtains a pointer to the IMetaDataAccess interface in a boss class (e.g. kDocBoss).
| targetObject | The target boss class (e.g. document) to obtain MetaData from. |
| virtual |
Replaces the XMP MetaData from a file with that of a boss class (e.g. document).
| targetObject | IN The target boss class (e.g. document) to put MetaData into. |
| sysFile | IN sysfile to read from. |
| stripForeignData | IN kTrue if you want to remove MetaData that is not part of the InDesign default MetaData set. The default XMP data for InDesign consists of MetaData stored using the following interfaces. |
| virtual |
Saves the MetaData in the boss class (e.g. document) to the file.
| targetObject | The target boss class (e.g.: document) to obtain MetaData from. |
| sysFile | IN sysfile to read from. |