From ccf3a90c9764d7dca93e1cc06f2997371cba323a Mon Sep 17 00:00:00 2001
From: Michael R Sweet
The "error_cb" and "error_cbdata" arguments specify an error handler callback
and its data pointer - if NULL
then the default error handler is used that
-writes error messages to stderr
. The error handler callback should return
-true
to continue writing the PDF file or false
to stop.
stderr
. The error handler callback
+should return true
to continue writing the PDF file or false
to stop.
+For example:
+
++bool +my_error_cb(pdfio_file_t *pdf, const char *message, void *data) +{ + (void)data; /* Not using data pointer in this callback */ + + fprintf(stderr, "%s: %sn", pdfioFileGetName(pdf), message); + + /* Return true to continue on warning messages, false otherwise... */ + return (!strncmp(message, "WARNING:", 8)); +} ++
Create a new object in a PDF file containing an array.
@@ -4439,9 +4454,23 @@ of 8.27x11in (the intersection of US Letter and ISO A4) is used.
The "error_cb" and "error_cbdata" arguments specify an error handler callback
and its data pointer - if NULL
then the default error handler is used that
-writes error messages to stderr
. The error handler callback should return
-true
to continue writing the PDF file or false
to stop.
-
+writes error and warning messages to stderr
. The error handler callback
+should return true
to continue writing the PDF file or false
to stop.
+For example:
+
+
+bool +my_error_cb(pdfio_file_t *pdf, const char *message, void *data) +{ + (void)data; /* Not using data pointer in this callback */ + + fprintf(stderr, "%s: %sn", pdfioFileGetName(pdf), message); + + /* Return true to continue on warning messages, false otherwise... */ + return (!strncmp(message, "WARNING:", 8)); +} ++
Note: Files created using this API are slightly larger than those created using thepdfioFileCreate
function since stream lengths are @@ -4778,9 +4807,23 @@ PDF file requires a password, the open will always fail.
The "error_cb" and "error_cbdata" arguments specify an error handler callback and its data pointer - ifNULL
then the default error handler is used that -writes error messages tostderr
. The error handler callback should return -true
to continue reading the PDF file orfalse
to stop.
-
+writes error and warning messages tostderr
. The error handler callback +should returntrue
to continue reading the PDF file orfalse
to stop. +For example: + ++bool +my_error_cb(pdfio_file_t *pdf, const char *message, void *data) +{ + (void)data; /* Not using data pointer in this callback */ + + fprintf(stderr, "%s: %sn", pdfioFileGetName(pdf), message); + + /* Return true to continue on warning messages, false otherwise... */ + return (!strncmp(message, "WARNING:", 8)); +} ++Note: Error messages starting with "WARNING:" are actually warning messages - the callback should normally returntrue
to allow PDFio to diff --git a/pdfio-file.c b/pdfio-file.c index d4a5b36..0e52124 100644 --- a/pdfio-file.c +++ b/pdfio-file.c @@ -190,8 +190,22 @@ pdfioFileClose(pdfio_file_t *pdf) // I - PDF file // // The "error_cb" and "error_cbdata" arguments specify an error handler callback // and its data pointer - if `NULL` then the default error handler is used that -// writes error messages to `stderr`. The error handler callback should return -// `true` to continue writing the PDF file or `false` to stop. +// writes error and warning messages to `stderr`. The error handler callback +// should return `true` to continue writing the PDF file or `false` to stop. +// For example: +// +// ``` +// bool +// my_error_cb(pdfio_file_t *pdf, const char *message, void *data) +// { +// (void)data; /* Not using data pointer in this callback */ +// +// fprintf(stderr, "%s: %s\n", pdfioFileGetName(pdf), message); +// +// /* Return true to continue on warning messages, false otherwise... */ +// return (!strncmp(message, "WARNING:", 8)); +// } +// ``` // pdfio_file_t * // O - PDF file or `NULL` on error @@ -429,8 +443,22 @@ _pdfioFileCreateObj( // // The "error_cb" and "error_cbdata" arguments specify an error handler callback // and its data pointer - if `NULL` then the default error handler is used that -// writes error messages to `stderr`. The error handler callback should return -// `true` to continue writing the PDF file or `false` to stop. +// writes error and warning messages to `stderr`. The error handler callback +// should return `true` to continue writing the PDF file or `false` to stop. +// For example: +// +// ``` +// bool +// my_error_cb(pdfio_file_t *pdf, const char *message, void *data) +// { +// (void)data; /* Not using data pointer in this callback */ +// +// fprintf(stderr, "%s: %s\n", pdfioFileGetName(pdf), message); +// +// /* Return true to continue on warning messages, false otherwise... */ +// return (!strncmp(message, "WARNING:", 8)); +// } +// ``` // // > *Note*: Files created using this API are slightly larger than those // > created using the @link pdfioFileCreate@ function since stream lengths are @@ -1023,8 +1051,22 @@ pdfioFileGetVersion( // // The "error_cb" and "error_cbdata" arguments specify an error handler callback // and its data pointer - if `NULL` then the default error handler is used that -// writes error messages to `stderr`. The error handler callback should return -// `true` to continue reading the PDF file or `false` to stop. +// writes error and warning messages to `stderr`. The error handler callback +// should return `true` to continue reading the PDF file or `false` to stop. +// For example: +// +// ``` +// bool +// my_error_cb(pdfio_file_t *pdf, const char *message, void *data) +// { +// (void)data; /* Not using data pointer in this callback */ +// +// fprintf(stderr, "%s: %s\n", pdfioFileGetName(pdf), message); +// +// /* Return true to continue on warning messages, false otherwise... */ +// return (!strncmp(message, "WARNING:", 8)); +// } +// ``` // // > Note: Error messages starting with "WARNING:" are actually warning // > messages - the callback should normally return `true` to allow PDFio to