I am using following code to print the current page but I am unable to catch the error when Cancel button is clicked on Print Dialog. The contol never reaches to ErrorHandler.
I am using PDFCreator Active X.
Please help me out as i don't want to application to crash
With PDFCreactiveX1
On Error GoTo ErrorHandler
.StartPrint "", True
.PrintPage .CurrentPage
.ClearPage .CurrentPage
.EndPrint
End With
Exit Sub
ErrorHandler:
Err.Raise Err.Number, Err.Source, Err.Description
Unable to catch error when cancel is clicked on Print Dialog
-
- Posts: 21
- Joined: Mon Feb 12 2007
- Contact:
Hello,
I tried your below sample using version 3.01 of the PDF Creator and the control reached the error handler if I click on Cancel instead of OK on the printer selection page.
Which version of the PDF Creator are you using?
Where precisely are you clicking on 'Cancel', when selecting the printer or after printing starts?
I tried your below sample using version 3.01 of the PDF Creator and the control reached the error handler if I click on Cancel instead of OK on the printer selection page.
Which version of the PDF Creator are you using?
Where precisely are you clicking on 'Cancel', when selecting the printer or after printing starts?
Hello,
If the user clicks on “Cancel†there is an exception that is thrown by the control. It is up to the developer to handle this exception with example: “Try/Catch†or “On Errorâ€
try
{
axPDF.Open (txtFileName.Text , "");
axPDF.CurrentPage = 1;
axPDF.PrintPage (1);
axPDF.EndPrint();
}
catch(Exception ex)
{
MessageBox.Show (ex.Message);
}
Hope this helps?
If the user clicks on “Cancel†there is an exception that is thrown by the control. It is up to the developer to handle this exception with example: “Try/Catch†or “On Errorâ€
try
{
axPDF.Open (txtFileName.Text , "");
axPDF.CurrentPage = 1;
axPDF.PrintPage (1);
axPDF.EndPrint();
}
catch(Exception ex)
{
MessageBox.Show (ex.Message);
}
Hope this helps?
-
- Posts: 21
- Joined: Mon Feb 12 2007
- Contact: