Declaration

procedure Abort;

The Abort procedure terminates the printing of a print job, dropping all unprinted data. The device is then set for the next print job. Use Abort to terminate the print job before it completes; otherwise, use the EndDoc method.

To use the Abort method, you must add the Printers unit to the uses clause of your unit. Example

The following code aborts a print job if the user presses Esc. Note that you should set KeyPreview to True to ensure that the OnKeyDown event handler of Forml is called.

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;

Shift: TShiftState); begin if (Key=VK_ESCAPE) and Printer.Printing then begin

Printer.Abort;

MessageDlg('Printing aborted', mtlnformation, [mbOK],0); end; end;

0 0

Post a comment