PrintSetPageSelection Method (GdViewer)
In This Topic
Sets up the required selection of pages you want to print during the next print process using the active printer.
The specified pages selection will not take into account if you will print using the PrintDialog method.
Syntax
Parameters
- CustomRange
- The custom page range to be set for printing, for example, "1;4;5" to process pages 1, 4 and 5 or "1-5;10" to process pages from 1 to 5 and page 10. Set this
parameter to "*" to process all pages of the current 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.
Example
How to specify the required selection of pages to print.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
GdViewer1.PrintSetPageSelection("2;6-8;10")
If GdViewer1.GetStat() = GdPictureStatus.OK Then
If GdViewer1.Print() = GdPictureStatus.OK Then
MessageBox.Show("The file has been printed successfully.", "GdViewer.PrintSetPageSelection")
Else
Dim message As String = "The file can't be printed." + vbCrLf + "Status: " + GdViewer1.GetStat().ToString()
If GdViewer1.PrintGetStat() = GdPictureStatus.PrintingException Then message = message + " Error: " + GdViewer1.PrintGetLastError()
MessageBox.Show(message, "GdViewer.PrintSetPageSelection")
End If
End If
GdViewer1.CloseDocument()
Else
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.PrintSetPageSelection")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
GdViewer1.PrintSetPageSelection("2;6-8;10");
if (GdViewer1.GetStat() == GdPictureStatus.OK)
{
if (GdViewer1.Print() == GdPictureStatus.OK)
{
MessageBox.Show("The file has been printed successfully.", "GdViewer.PrintSetPageSelection");
}
else
{
string message = "The file can't be printed.\nStatus: " + GdViewer1.GetStat().ToString();
if (GdViewer1.PrintGetStat() == GdPictureStatus.PrintingException)
message = message + " Error: " + GdViewer1.PrintGetLastError();
MessageBox.Show(message, "GdViewer.PrintSetPageSelection");
}
}
GdViewer1.CloseDocument();
}
else
{
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.PrintSetPageSelection");
}
Example
How to specify the required selection of pages to print.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
GdViewer1.PrintSetPageSelection("2;6-8;10")
If GdViewer1.GetStat() = GdPictureStatus.OK Then
If GdViewer1.Print() = GdPictureStatus.OK Then
MessageBox.Show("The file has been printed successfully.", "GdViewer.PrintSetPageSelection")
Else
Dim message As String = "The file can't be printed." + vbCrLf + "Status: " + GdViewer1.GetStat().ToString()
If GdViewer1.PrintGetStat() = GdPictureStatus.PrintingException Then message = message + " Error: " + GdViewer1.PrintGetLastError()
MessageBox.Show(message, "GdViewer.PrintSetPageSelection")
End If
End If
GdViewer1.CloseDocument()
Else
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.PrintSetPageSelection")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
GdViewer1.PrintSetPageSelection("2;6-8;10");
if (GdViewer1.GetStat() == GdPictureStatus.OK)
{
if (GdViewer1.Print() == GdPictureStatus.OK)
{
MessageBox.Show("The file has been printed successfully.", "GdViewer.PrintSetPageSelection");
}
else
{
string message = "The file can't be printed.\nStatus: " + GdViewer1.GetStat().ToString();
if (GdViewer1.PrintGetStat() == GdPictureStatus.PrintingException)
message = message + " Error: " + GdViewer1.PrintGetLastError();
MessageBox.Show(message, "GdViewer.PrintSetPageSelection");
}
}
GdViewer1.CloseDocument();
}
else
{
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.PrintSetPageSelection");
}
See Also