Board index » delphi » Printer.Printing after Printer.Abort problem

Printer.Printing after Printer.Abort problem

I call the following code in response to a cancel print button on a
dialog.

begin
 AbortDoc(Printer.Handle);{tryed without this line but printing not
                           aborted}
 Printer.Abort;
 Close;
end;

Back on the main form the printing is aborted, but when I try another
print job I get the error 'Printer is still printing'.

If I check Printer.Printing it returns true and if I check
Printer.Aborted it also returns true.

Any ideas what is going on?

 

Re:Printer.Printing after Printer.Abort problem


In article <31294D4F.7...@sunshine.net> Joe Nodeland wrote :

Quote
>> I call the following code in response to a cancel print button on a
>> dialog.

>> begin
>>  AbortDoc(Printer.Handle);{tryed without this line but printing not
>>                            aborted}
>>  Printer.Abort;
>>  Close;
>> end;

>> Back on the main form the printing is aborted, but when I try another
>> print job I get the error 'Printer is still printing'.

>> If I check Printer.Printing it returns true and if I check
>> Printer.Aborted it also returns true.

>> Any ideas what is going on?

I found that I needed a call to printer.endDoc after the call to Abort.

I just checked the vcl for the printer components, and abort just sets the
flag. EndDoc uses the flag to decide whether to call windows EndDoc.
In my copy of the vcl, windows AbortDoc never gets called, but endPage
does. However, I just use abort and EndDoc, and my print jobs abort
correctly.

Hope that helps.
Greg Defina
-----------------------------------------------------------------
gr...@hufest.tmx.com.au using
NETcetera II Lite v2.21
for Internet News....
-----------------------------------------------------------------

Re:Printer.Printing after Printer.Abort problem


Quote
Joe Nodeland <J_Nodel...@sunshine.net> wrote:
> I call the following code in response to a cancel print button on a
> dialog.

> begin
>  AbortDoc(Printer.Handle);{tryed without this line but printing not
>                            aborted}
>  Printer.Abort;
>  Close;
> end;

> Back on the main form the printing is aborted, but when I try another
> print job I get the error 'Printer is still printing'.

> If I check Printer.Printing it returns true and if I check
> Printer.Aborted it also returns true.

I still have some problems with the printer, but try

BeginDoc
..
Abort
EndDoc  < I seem to remember that this is still needed !

However, if you try to print again, too soon (maybe before Print
Manager has cleared the job ?) you still get your error message.
Wait a while and its okay. Yet to be resolved, if you get any further
advice, I'd like to know too

Ray Cramer
R...@pol.ac.uk

Other Threads