The GdPicturePDF object that handles a required PDF document. This object must be properly initialized before it can be sent into this method and it must be disposed of by the user as well.
Example





In This Topic
GdPicture14 Namespace / AnnotationManager Class / InitFromGdPicturePDF Method

InitFromGdPicturePDF Method (AnnotationManager)

In This Topic
Initializes the current AnnotationManager object from a PDF document handled by a specified GdPicturePDF object. The document previously handled by this AnnotationManager object will automatically close.

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

Syntax
'Declaration
 
Public Function InitFromGdPicturePDF( _
   ByVal PDF As GdPicturePDF _
) As GdPictureStatus
public GdPictureStatus InitFromGdPicturePDF( 
   GdPicturePDF PDF
)
public function InitFromGdPicturePDF( 
    PDF: GdPicturePDF
): GdPictureStatus; 
public function InitFromGdPicturePDF( 
   PDF : GdPicturePDF
) : GdPictureStatus;
public: GdPictureStatus InitFromGdPicturePDF( 
   GdPicturePDF* PDF
) 
public:
GdPictureStatus InitFromGdPicturePDF( 
   GdPicturePDF^ PDF
) 

Parameters

PDF
The GdPicturePDF object that handles a required PDF document. This object must be properly initialized before it can be sent into this method and it must be disposed of by the user as well.

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 already initialized GdPicturePDF object.
Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
Dim annotationManager As AnnotationManager = New AnnotationManager()
If (gdpicturePDF.LoadFromFile("annots.pdf", False) = GdPictureStatus.OK) AndAlso
   (annotationManager.InitFromGdPicturePDF(gdpicturePDF) = GdPictureStatus.OK) Then
    For p As Integer = 1 To gdpicturePDF.GetPageCount()
        If annotationManager.SelectPage(p) = GdPictureStatus.OK Then
            Dim annot As GdPicture14.Annotations.Annotation = Nothing
            Dim annotCount As Integer = annotationManager.GetAnnotationCount()
            For i As Integer = 0 To annotCount - 1
                annot = annotationManager.GetAnnotationFromIdx(i)
                If (annotationManager.GetStat() = GdPictureStatus.OK) AndAlso (annot IsNot Nothing) Then
                    annot.Tag = "changed by GdPicture"
                Else
                    Exit For
                End If
            Next
            If annotationManager.GetStat() = GdPictureStatus.OK Then
                If annotationManager.SaveAnnotationsToPage() <> GdPictureStatus.OK Then Exit For
            End If
        Else
            Exit For
        End If
    Next
    If (annotationManager.GetStat() = GdPictureStatus.OK) AndAlso
       (annotationManager.SaveDocumentToPDF("annots_changed.pdf") = GdPictureStatus.OK) Then MessageBox.Show("Finished successfully!", "AnnotationManager.InitFromGdPicturePDF")
    If annotationManager.GetStat() <> GdPictureStatus.OK Then MessageBox.Show("The example has failed. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.InitFromGdPicturePDF")
    annotationManager.Close()
Else
    MessageBox.Show("Objects can't be initialized properly.", "AnnotationManager.InitFromGdPicturePDF")
End If
annotationManager.Dispose()
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
AnnotationManager annotationManager = new AnnotationManager();
if ((gdpicturePDF.LoadFromFile("annots.pdf", false) == GdPictureStatus.OK) &&
    (annotationManager.InitFromGdPicturePDF(gdpicturePDF) == GdPictureStatus.OK))
{
    for (int p = 1; p <= gdpicturePDF.GetPageCount(); p++)
    {
        if (annotationManager.SelectPage(p) == GdPictureStatus.OK)
        {
            GdPicture14.Annotations.Annotation annot = null;
            int annotCount = annotationManager.GetAnnotationCount();
            for (int i = 0; i < annotCount; i++)
            {
                annot = annotationManager.GetAnnotationFromIdx(i);
                if ((annotationManager.GetStat() == GdPictureStatus.OK) && (annot != null))
                {
                    annot.Tag = "changed by GdPicture";
                }
                else break;
            }
            if (annotationManager.GetStat() == GdPictureStatus.OK)
                if (annotationManager.SaveAnnotationsToPage() != GdPictureStatus.OK) break;
        }
        else break;
    }
    if ((annotationManager.GetStat() == GdPictureStatus.OK) &&
        (annotationManager.SaveDocumentToPDF("annots_changed.pdf") == GdPictureStatus.OK))
            MessageBox.Show("Finished successfully!", "AnnotationManager.GetAnnotationFromIdx");
    if (annotationManager.GetStat() != GdPictureStatus.OK)
        MessageBox.Show("The example has failed. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationFromIdx");
    annotationManager.Close();
}
else
    MessageBox.Show("Objects can't be initialized properly.", "AnnotationManager.GetAnnotationFromIdx");
annotationManager.Dispose();
gdpicturePDF.Dispose();
See Also