diff --git a/src/epdfinfo.c b/src/epdfinfo.c
index 01001ff5..4a0547e6 100644
--- a/src/epdfinfo.c
+++ b/src/epdfinfo.c
@@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+#include
#include
#include
#include
@@ -32,6 +33,10 @@
#include "epdfinfo.h"
#include "config.h"
+#ifdef __APPLE__
+# define error printf
+#endif
+
/* declarations */
static arg_t *parse_args(const ctxt_t *ctx, const char *args, size_t len,
diff --git a/src/error.h b/src/error.h
new file mode 100644
index 00000000..980af6c8
--- /dev/null
+++ b/src/error.h
@@ -0,0 +1,59 @@
+//========================================================================
+//
+// Error.h
+//
+// Copyright 1996-2003 Glyph & Cog, LLC
+//
+//========================================================================
+
+//========================================================================
+//
+// Modified under the Poppler project - http://poppler.freedesktop.org
+//
+// All changes made under the Poppler project to this file are licensed
+// under GPL version 2 or later
+//
+// Copyright (C) 2005, 2007 Jeff Muizelaar
+// Copyright (C) 2005 Albert Astals Cid
+// Copyright (C) 2005 Kristian Høgsberg
+// Copyright (C) 2013 Adrian Johnson
+//
+// To see a description of the changes please see the Changelog file that
+// came with your tarball or type make ChangeLog if you are building from git
+//
+//========================================================================
+
+#ifndef ERROR_H
+#define ERROR_H
+
+#ifdef USE_GCC_PRAGMAS
+#pragma interface
+#endif
+
+#include
+#include "poppler-config.h"
+#include "goo/gtypes.h"
+
+enum ErrorCategory {
+ errSyntaxWarning, // PDF syntax error which can be worked around;
+ // output will probably be correct
+ errSyntaxError, // PDF syntax error which can be worked around;
+ // output will probably be incorrect
+ errConfig, // error in Xpdf config info (xpdfrc file, etc.)
+ errCommandLine, // error in user-supplied parameters, action not
+ // allowed, etc. (only used by command-line tools)
+ errIO, // error in file I/O
+ errNotAllowed, // action not allowed by PDF permission bits
+ errUnimplemented, // unimplemented PDF feature - display will be
+ // incorrect
+ errInternal // internal error - malfunction within the Xpdf code
+};
+
+typedef enum ErrorCategory ErrorCategory;
+extern void setErrorCallback(void (*cbk)(void *data, ErrorCategory category,
+ Goffset pos, char *msg),
+ void *data);
+
+extern void CDECL error(ErrorCategory category, Goffset pos, const char *msg, ...);
+
+#endif