From 3cc28e9828a1ce1ba69955a68c7e71ef7cd5f0d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20B=C3=BCnzli?= Date: Sun, 18 Aug 2013 13:54:14 +0200 Subject: take /Version in /Root into account --- source/pdf/pdf-xref.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source/pdf/pdf-xref.c') diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c index 743cf452..97433fa3 100644 --- a/source/pdf/pdf-xref.c +++ b/source/pdf/pdf-xref.c @@ -1162,6 +1162,21 @@ pdf_init_document(pdf_document *doc) { fz_warn(ctx, "Ignoring Broken Optional Content"); } + + fz_try(ctx) + { + char *version_str; + obj = pdf_dict_getp(pdf_trailer(doc), "Root/Version"); + version_str = pdf_to_name(obj); + if (*version_str) + { + /* TODO: use fz_atof for parsing instead? */ + int version = atoi(version_str) * 10 + atoi(version_str + 2); + if (version > doc->version) + doc->version = version; + } + } + fz_catch(ctx) { } } void -- cgit v1.2.3