In This Topic
Programming / Document Printing / How to print documents using GdPictureImaging

How to print documents using GdPictureImaging

In This Topic

The GdPictureImaging class has numerous print functions. Print functions with dialogs prompt the standard windows PrintDialog.

Here is an example how to load an image file and then print it using the GdPictureImaging class.

Copy Code
'We assume that GdPicture has been correctly installed and unlocked.

'Initializing the GdPictureImaging object.

Dim oGdPictureImaging As New GdPictureImaging()

'Loading the image from a file.

Dim imageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("")

'Checking if the image resource has been loaded correctly.

If oGdPictureImaging.GetStat() = GdPictureStatus.OK Then

    'Setting the print orientation.

    oGdPictureImaging.PrintSetOrientation(PrinterOrientation.PrinterOrientationLandscape)

    'Printing the image.

    oGdPictureImaging.Print(imageID)

    'Releasing the image resource.

    oGdPictureImaging.ReleaseGdPictureImage(imageID)

Else

    'Displaying an error.

    MessageBox.Show("The image can't be created. Error: " + oGdPictureImaging.GetStat().ToString(), "Printing Example", MessageBoxButtons.OK, MessageBoxIcon.Error)

End If

oGdPictureImaging.Dispose()
Copy Code
//We assume that GdPicture has been correctly installed and unlocked.

//Initializing the GdPictureImaging object.

GdPictureImaging oGdPictureImaging = new GdPictureImaging();

//Loading the image from a file.

int imageID = oGdPictureImaging.CreateGdPictureImageFromFile("");

//Checking if the image resource has been loaded correctly.

if (oGdPictureImaging.GetStat() == GdPictureStatus.OK)

{

    //Setting the print orientation.

    oGdPictureImaging.PrintSetOrientation(PrinterOrientation.PrinterOrientationLandscape);

    //Printing the image.

    oGdPictureImaging.Print(imageID);

    //Releasing the image resource.

    oGdPictureImaging.ReleaseGdPictureImage(imageID);

}

else

{

    //Displaying an error.

    MessageBox.Show("The image can't be created. Error: " + oGdPictureImaging.GetStat().ToString(), "Printing Example", MessageBoxButtons.OK, MessageBoxIcon.Error);

}

oGdPictureImaging.Dispose();