GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / DisplayFromGdPicturePDF Method
A GdPicturePDF object. This object must be properly initialized and it must be disposed of by the user as well.
Example





In This Topic
DisplayFromGdPicturePDF Method (GdViewer)
In This Topic
Loads a PDF document from the instantiated GdPicturePDF object and subsequently displays it in the GdViewer control. The document previously displayed in the control will automatically close.

The BeforeDocumentChange and the AfterDocumentChange events are raised just before and right after the document is displayed in the GdViewer control. Both events are only raised if the document has been successfully loaded.

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

Parameters

PDF
A GdPicturePDF object. This object must be properly initialized 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
Just to remind you that both the BeforeDocumentChange and the AfterDocumentChange events are raised using this method.
Example
How to display your PDF document using a GdPicturePDF class.
'We assume that the GdViewer1 control has been properly integrated.
Dim pdf As GdPicturePDF = New GdPicturePDF()
If pdf.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
    If GdViewer1.DisplayFromGdPicturePDF(pdf) <> GdPictureStatus.OK Then
        MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromGdPicturePDF")
    End If
Else
    MessageBox.Show("The PDF document can't be loaded. Status: " + pdf.GetStat().ToString(), "GdViewer.DisplayFromGdPicturePDF")
End If
//We assume that the GdViewer1 control has been properly integrated.
GdPicturePDF pdf = new GdPicturePDF();
if (pdf.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
{
    if (GdViewer1.DisplayFromGdPicturePDF(pdf) != GdPictureStatus.OK)
    {
        MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromGdPicturePDF");
    }
}
else
{
    MessageBox.Show("The PDF document can't be loaded. Status: " + pdf.GetStat().ToString(), "GdViewer.DisplayFromGdPicturePDF");
}
See Also