XMP File

Discussions about annotation support.
Post Reply
rpicilli
Posts: 50
Joined: Fri Nov 25, 2011 12:39 pm

XMP File

Post by rpicilli » Sun Jan 01, 2012 1:14 pm

Hello,

I'm load a XMP file with some annotation. Make some modification in the annotation. Try to save to the same XMP file and alway get error. Looks like the file after open is not closed that is the reason I'm not able to rewrite de file.

Is there a way to do this or I'm doing something wrong.

This is the code used to Open and to Read.

Code: Select all

    Private Sub SaveInXMPFormatToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveInXMPFormatToolStripMenuItem.Click
        Dim SaveFileDialog1 As New SaveFileDialog

        SaveFileDialog1.Title = "Save Annotations As XMP"
        SaveFileDialog1.CheckFileExists = False
        SaveFileDialog1.OverwritePrompt = False
        SaveFileDialog1.Filter = "XMP|*.xmp"
        If SaveFileDialog1.ShowDialog(Me) = DialogResult.OK Then
            Dim FilePath As String = SaveFileDialog1.FileName
            If GdViewer1.SaveAnnotationsToXMP(FilePath) = GdPictureStatus.OK Then
                MsgBox("Annotations succefully saved as XMP in " & FilePath)
            Else
                MsgBox("Can't save annotations in " & FilePath)
            End If
        End If

    End Sub

Code: Select all

    Private Sub LoadFromXMLFileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadFromXMLFileToolStripMenuItem.Click
        Dim OpenFileDialog1 As New OpenFileDialog

        OpenFileDialog1.Title = "Open Annotations As XMP"
        OpenFileDialog1.CheckFileExists = False
        OpenFileDialog1.Filter = "XMP|*.xmp"
        If OpenFileDialog1.ShowDialog(Me) = DialogResult.OK Then
            Dim FilePath As String = OpenFileDialog1.FileName
            If GdViewer1.LoadAnnotationsFromXMP(FilePath) <> GdPictureStatus.OK Then
                MsgBox("Can't load annotations from " & FilePath)
            End If
            OpenFileDialog1.Dispose()
        End If
    End Sub

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: XMP File

Post by Loïc » Tue Jan 03, 2012 2:55 pm

Hi,

This problem will be fixed for the next release.

Waiting for, you can use this workaround:

Dim Status As GdPictureStatus = GdPictureStatus.OK

Code: Select all

        If IO.File.Exists(FilePath) Then
            Try
                IO.File.Delete(FilePath)
            Catch ex As Exception
                Status = GdPictureStatus.CanNotCreateFile
            End Try

        End If

        If Status = GdPictureStatus.OK Then
            'Continue here
         Endif
Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest