The file path of the source document.
Example





In This Topic

InitFromFile Method (AnnotationManager)

In This Topic
Initializes the current AnnotationManager object from a file according to a file path you have specified. The document previously handled by this AnnotationManager object will automatically close.

All document formats currently supported by the toolkit are listed here.

Be aware that the AnnotationManager object only handles GdPicture/XMP annotations contained in the source document.

Syntax
'Declaration
 
Public Function InitFromFile( _
   ByVal Path As String _
) As GdPictureStatus
public GdPictureStatus InitFromFile( 
   string Path
)
public function InitFromFile( 
    Path: String
): GdPictureStatus; 
public function InitFromFile( 
   Path : String
) : GdPictureStatus;
public: GdPictureStatus InitFromFile( 
   string* Path
) 
public:
GdPictureStatus InitFromFile( 
   String^ Path
) 

Parameters

Path
The file path of the source document.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK. We strongly recommend always checking this status first.
Remarks

This method requires the Annotations component to run.

Example
How to initialize the AnnotationManager object from a JPEG file.
Dim annotationManager As AnnotationManager = New AnnotationManager()
If (annotationManager.InitFromFile("test.jpeg") = GdPictureStatus.OK) AndAlso
   (annotationManager.PageCount > 0) AndAlso (annotationManager.SelectPage(1) = GdPictureStatus.OK) Then
    Dim stamp As GdPicture14.Annotations.AnnotationRubberStamp = annotationManager.AddRubberStampAnnot(Color.Red, 0.5F, 0.5F, 2, 1, "APPROVED")
    If stamp IsNot Nothing Then
        stamp.Rotation = 20
        If (annotationManager.SaveAnnotationsToPage() = GdPictureStatus.OK) AndAlso
           (annotationManager.SaveDocumentToJPEG("test_approved.jpeg") = GdPictureStatus.OK) Then
            MessageBox.Show("Finished successfully!", "AnnotationManager.InitFromFile")
        Else
            MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.InitFromFile")
        End If
        stamp.Dispose()
    Else
        MessageBox.Show("The rubber stamp annotation can't be created. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.InitFromFile")
    End If
    annotationManager.Close()
Else
    MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.InitFromFile")
End If
annotationManager.Dispose()
AnnotationManager annotationManager = new AnnotationManager();
if ((annotationManager.InitFromFile("test.jpeg") == GdPictureStatus.OK) &&
    (annotationManager.PageCount > 0) && (annotationManager.SelectPage(1) == GdPictureStatus.OK))
{
    GdPicture14.Annotations.AnnotationRubberStamp stamp = annotationManager.AddRubberStampAnnot(Color.Red, 0.5f, 0.5f, 2, 1, "APPROVED");
    if (stamp != null)
    {
        stamp.Rotation = 20;
        if ((annotationManager.SaveAnnotationsToPage() == GdPictureStatus.OK) &&
            (annotationManager.SaveDocumentToJPEG("test_approved.jpeg") == GdPictureStatus.OK))
            MessageBox.Show("Finished successfully!", "AnnotationManager.InitFromFile");
        else
            MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.InitFromFile");
        stamp.Dispose();
    }
    else
        MessageBox.Show("The rubber stamp annotation can't be created. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.InitFromFile");
    annotationManager.Close();
}
else
    MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.InitFromFile");
annotationManager.Dispose();
See Also