Hello
I sent a print job through PrintJob.Print method.
Then I try to cancel the printing manually through the printer window of the OS, by right clicking on the printing job and choosing Cancel.
The job was canceled, but I get a AccessViolationException from the PrintJob.Print method.
1. It seems to be a bug.
2. Is it possible to cancel a job programmatically?
Assembly Version: 1.0.1.18760
OS: Windows XP
Cancel a print job raise error
Re: Cancel a print job raise error
Forum member · Oct 4, 2011Maby this will help (Stack trace):
at a(p* , Void* , Int32 , Int32 , Int32 , Int32 , Int32 , Int32 )
at ceTe.DynamicPDF.Printing.InputPdf.a(p* , Void* , Int32 , Int32 , Int32 , Int32 , Int32 , Int32 )
at ceTe.DynamicPDF.Printing.ActualSizePageScaling.a(PrintJobPage , Int32 , Int32 )
at ceTe.DynamicPDF.Printing.ActualSizePageScaling.Print(PrintJobPage printJobPage)
at ceTe.DynamicPDF.Printing.PrintJobPage.e()
at ceTe.DynamicPDF.Printing.PrintJobPageList.a()
at ceTe.DynamicPDF.Printing.PrintJob.Print()
at WindowsFormsApplication3.Form1.print(PrintSettings settings)
Re: Cancel a print job raise error
Support · Oct 4, 2011Hello,
Thanks for reporting the error. we were unable to reproduce this error using a test console application. Is the Print function being invoked from a web application?
It is not possible to cancel the print job programmatically using the PrintManager.
Thanks,
ceTe Software Support Team.
Re: Cancel a print job raise error
Forum member · Oct 5, 2011Thank you very much for your reply.
I checked it again and found that it is occurred because I call PrintJob.Dispose() method inside of the PrintJob.Succeeded event.
But, I have to call Dispose() somewhere, other ways the file will still locked, even when the printing is finished.
On the other hand, when I call Dispose after the PrintJob.Print(), then the PrintJob.Updated event stop working.
So, when I have to call dispose?
Should I supposed to call dispose?
Or there is another way to release the file locking?
Re: Cancel a print job raise error
Support · Oct 5, 2011Hello,
Yes, once you dispose the PrintJob object then it is not available for the further process. You can use another class called InputPdf to load the PDF and build an object of it. Then you can use this InputPdf object for creating the PrintJob object. Once you send the PDF for printing using PrintJob.Print method you can dispose the InputPdf object and this will unlock the file.
InputPdf pdf = new InputPdf(@"C:\Temp\Test.pdf");
PrintJob job = new PrintJob(Printer.Default, pdf);
job.Print();
pdf.Dispose();
Thanks,
ceTe Software Support Team.