This function terminates the current print job.
Parameters
Name | Explanation |
---|---|
hDC | The device context retrieved by the IKPrintCreateDC or the IKPrintDlg |
Return Value
Returns True (nonzero) if successful. Returns False (0) if unsuccessful.
Explanation
The IKPrintAbortDoc function terminates the current print job and erases everything the application has written to the device since the last call of the IKPrintStartDoc function. The IKPrintAbortDoc function should be used with the IKPrintStartDoc, IKPrintStartPage, IKPrintEndPage, and the IKPrintEndDoc functions and is written between IKPrintStartPage and IKPrintEndPage. Note: when ButtonName, Caption, and Message are set and the Cancel Printing dialog box is displayed, the ImageKit calls the IKPrintAbortDoc function internally so it is not necessary to use this function in such cases.
Example for terminating a print job:
In C++Builder
HDC hDC;
int i;
BOOL bAbort = TRUE;
hDC = IKPrintCreateDC(NULL, "Default",
NULL, 1);
if (hDC == NULL) return;
if (IKPrintStartDoc(hDC, Form1->Handle,
"", "", "", "ImageKit Print Sample") != FALSE) {
for (i = 0; i <
100; i++) {
IKPrintStartPage(hDC);
//code
for drawing image text etc
if
(i == 50) {
IKPrintAbortDoc(hDC);
bAbort
= TRUE;
}
IKPrintEndPage(hDC);
if
(bAbort) break;
}
IKPrintEndDoc(hDC);
}
IKPrintDeleteDC(hDC);
In Delphi
DC: HDC;
i: Integer;
bAbort: Boolean;
DC := IKPrintCreateDC(nil, 'Default', 0,
1);
if DC = 0 then Exit;
if (IKPrintStartDoc(DC, Form1.Handle, '',
'', '', 'ImageKit Print Sample') <> False) then
begin
bAbort :=
False;
for i := 0 to 99
do
begin
IKPrintStartPage(DC);
//code
for drawing image text etc
if
i = 50 then
begin
IKPrintAbortDoc(DC);
bAbort
:= True;
end;
IKPrintEndPage(DC);
if
bAbort then Break;
end;
IKPrintEndDoc(DC);
end;
IKPrintDeleteDC(DC);