Example





In This Topic

GetStat Method (GdPicturePDF)

In This Topic
Returns the status of the last executed operation with the current GdPicturePDF object.
Syntax
'Declaration

 

Public Function GetStat() As GdPictureStatus
public GdPictureStatus GetStat()
public function GetStat(): GdPictureStatus; 
public function GetStat() : GdPictureStatus;
public: GdPictureStatus GetStat(); 
public:

GdPictureStatus GetStat(); 

Return Value

A member of the GdPictureStatus enumeration. If the last executed GdPicturePDF method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
Use this method in the combination with all those, which return a value instead of a status, such as the PrintDialog method in the example below.
Example
How to find out if the PDF document has been printed successfully.
Using gdpicturePDF As New GdPicturePDF()

    If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then

        If gdpicturePDF.PrintDialog() Then

            MessageBox.Show("The PDF document has been successfully printed.", "Example: GetStat")

        Else

            'Use the GetStat() method here to find the reason for the failure.

            MessageBox.Show("The PDF document has not been printed. Status: " + gdpicturePDF.GetStat().ToString(), "Example: GetStat")

        End If

    Else

        MessageBox.Show("The file can't be opened.", "Example: GetStat")

    End If

End Using
using (GdPicturePDF gdpicturePDF = new GdPicturePDF())

{

    if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)

    {

        if (gdpicturePDF.PrintDialog())

        {

            MessageBox.Show("The PDF document has been successfully printed.", "Example: GetStat");

        }

        else

        {

            //Use the GetStat() method here to find the reason for the failure.

            MessageBox.Show("The PDF document has not been printed. Status: " + gdpicturePDF.GetStat().ToString(), "Example: GetStat");

        }

    }

    else

    {

        MessageBox.Show("The file can't be opened.", "Example: GetStat");

    }

}
See Also