GroupDocsGists
10/19/2017 - 11:38 AM

UpdateXMPPropertiesGifImage.vb

' For complete examples and data files, please go to https://github.com/groupdocsmetadata/GroupDocs_Metadata_NET
' initialize GifFormat
Dim gifFormat As New GifFormat(Common.MapSourceFilePath(filePath))

' get xmp wrapper
Dim xmpPacket As XmpPacketWrapper = gifFormat.GetXmpData()

' create xmp wrapper if not exists
If xmpPacket Is Nothing Then
    xmpPacket = New XmpPacketWrapper()
End If

' check if DublinCore schema exists
If Not xmpPacket.ContainsPackage(Namespaces.DublinCore) Then
    ' if not - add DublinCore schema
    xmpPacket.AddPackage(New DublinCorePackage())
End If

' get DublinCore package
Dim dublinCorePackage As DublinCorePackage = DirectCast(xmpPacket.GetPackage(Namespaces.DublinCore), DublinCorePackage)

Dim authorName As String = "New author"
Dim description As String = "New description"
Dim subject As String = "New subject"
Dim publisher As String = "New publisher"
Dim title As String = "New title"

' set author
dublinCorePackage.SetAuthor(authorName)
' set description
dublinCorePackage.SetDescription(description)
' set subject
dublinCorePackage.SetSubject(subject)
' set publisher
dublinCorePackage.SetPublisher(publisher)
' set title
dublinCorePackage.SetTitle(title)
' update XMP package
gifFormat.SetXmpData(xmpPacket)

' commit changes
gifFormat.Save(Common.MapDestinationFilePath(filePath))