diff options
Diffstat (limited to 'source/xps')
-rw-r--r-- | source/xps/xps-doc.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/xps/xps-doc.c b/source/xps/xps-doc.c index 86d67d4a..af5bfe5a 100644 --- a/source/xps/xps-doc.c +++ b/source/xps/xps-doc.c @@ -531,3 +531,28 @@ xps_free_page(xps_document *doc, xps_page *page) fz_free_xml(doc->ctx, page->root); page->root = NULL; } + +static int +xps_recognize(fz_context *doc, const char *magic) +{ + char *ext = strrchr(magic, '.'); + + if (ext) + { + if (!fz_strcasecmp(ext, ".xps") || !fz_strcasecmp(ext, ".rels") || !fz_strcasecmp(ext, ".oxps")) + return 100; + } + if (!strcmp(magic, "xps") || !strcmp(magic, "oxps") || + !strcmp(magic, "application/vnd.ms-xpsdocument") || + !strcmp(magic, "application/oxps")) + return 100; + + return 0; +} + +fz_document_handler xps_document_handler = +{ + (fz_document_recognize_fn *)&xps_recognize, + (fz_document_open_fn *)&xps_open_document, + (fz_document_open_with_stream_fn *)&xps_open_document_with_stream +}; |