pdfSetErrorCbk
Provide a function to be called whenever an error is reported.
void pdfSetErrorCbk(void (*cbk)(void *data, int category, int pos, char *msg),
void *cbkData)
This function sets a callback function to be called whenever Xpdf
reports an error (or warning).
The callback function receives four arguments:
data
is the same value that was passed topdfSetErrroCbk
in thecbkData
argumentcategory
is one of the following categories:pdfErrCatSyntaxWarning
: a PDF syntax error which can be worked around; the output will probably be correctpdfErrCatSyntaxError
: a PDF syntax error which will probably cause incorrect outputpdfErrCatConfig
: an error in the xpdfrc config file or string passed topdfSetConfig
pdfErrCatIO
: an error in file I/OpdfErrCatNotAllowed
: action not allowed by PDF permission settingspdfErrCatUnimplemented
: an unimplemented PDF feature; output may be incorrectpdfErrCatInternal
: an internal error, i.e., malfunction within the Xpdf code
pos
is a position (byte offset) within the PDF file (not available for all errors - in those cases, thepos
msg
is a descriptive error message
C:
void xpdfErrorFunc(void *data, int category, int pos, char *msg) {
printf("Xpdf error [%d]: %s\n", pos, msg);
}
...
// we're not using the 'data' argument, so just pass NULL
pdfSetErrorCbk(&xpdfErrorFunc, NULL);