summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-xref.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/pdf/pdf-xref.c')
-rw-r--r--source/pdf/pdf-xref.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c
index d7c5cd1b..2afe4de8 100644
--- a/source/pdf/pdf-xref.c
+++ b/source/pdf/pdf-xref.c
@@ -1,4 +1,5 @@
#include "mupdf/pdf.h"
+#include "mupdf/fitz/document.h"
#undef DEBUG_PROGESSIVE_ADVANCE
@@ -2417,3 +2418,26 @@ pdf_document *pdf_create_document(fz_context *ctx)
}
return doc;
}
+
+int
+pdf_recognize(fz_context *doc, const char *magic)
+{
+ char *ext = strrchr(magic, '.');
+
+ if (ext)
+ {
+ if (!fz_strcasecmp(ext, ".pdf"))
+ return 100;
+ }
+ if (!strcmp(magic, "pdf") || !strcmp(magic, "application/pdf"))
+ return 100;
+
+ return 1;
+}
+
+fz_document_handler pdf_no_run_document_handler =
+{
+ (fz_document_recognize_fn *)&pdf_recognize,
+ (fz_document_open_fn *)&pdf_open_document_no_run,
+ (fz_document_open_with_stream_fn *)&pdf_open_document_no_run_with_stream
+};