Abort an in-progress print job.
void pdfAbortPrint(PDFHandle pdf)
This function aborts the currently in-progress print job.

WARNING: pdfAbortPrint should only be called from within a print status callback (set by pdfSetPrintStatusCbk).

After pdfAbortPrint is called, the print job will be canceled, and the original printing function (pdfPrint4, for example) will return with an error.

void printStatusCbk(void *data, int nextPage, int firstPage, int lastPage) { if (nextPage <= lastPage) { /* about to print [nextPage] of [firstPage]..[lastPage] */ } else { /* all done printing */ } if (/* the user pressed the cancel button */) { pdfAbortPrint(pdf); } } ... pdfSetPrintStatusCbk(pdf, &printStatusCbk, NULL);