Set

IptcRecordSet.Set method

Adds or updates the specified dataSet in the appropriate record.

public void Set(IptcDataSet dataSet)
Parameter Type Description
dataSet IptcDataSet The IPTC dataSet to add/update.

Examples

This example shows how to add or update custom IPTC datasets in a file.

using (Metadata metadata = new Metadata(Constants.PsdWithIptc))
{
    IIptc root = metadata.GetRootPackage() as IIptc;
    if (root != null)
    {
        // Set the IPTC package if it's missing
        if (root.IptcPackage == null)
        {
            root.IptcPackage = new IptcRecordSet();
        }

        // Add a know property using the DataSet API
        root.IptcPackage.Set(new IptcDataSet((byte) IptcRecordType.ApplicationRecord, (byte) IptcApplicationRecordDataSet.BylineTitle, "test code sample"));

        // Add a custom IPTC DataSet
        root.IptcPackage.Set(new IptcDataSet(255, 255, new byte[] { 1, 2, 3 }));

        metadata.Save(Constants.OutputPsd);
    }
}

See Also