diff options
-rw-r--r-- | include/mupdf/pdf/document.h | 1 | ||||
-rw-r--r-- | source/pdf/pdf-write.c | 5 | ||||
-rw-r--r-- | source/pdf/pdf-xref.c | 2 |
3 files changed, 8 insertions, 0 deletions
diff --git a/include/mupdf/pdf/document.h b/include/mupdf/pdf/document.h index f73cf5f3..24e3aaed 100644 --- a/include/mupdf/pdf/document.h +++ b/include/mupdf/pdf/document.h @@ -635,6 +635,7 @@ struct pdf_document_s int *xref_index; int freeze_updates; int has_xref_streams; + int has_old_style_xrefs; int rev_page_count; pdf_rev_page_map *rev_page_map; diff --git a/source/pdf/pdf-write.c b/source/pdf/pdf-write.c index 53a63cfc..26fcd9d1 100644 --- a/source/pdf/pdf-write.c +++ b/source/pdf/pdf-write.c @@ -2177,6 +2177,8 @@ static void writexrefstream(fz_context *ctx, pdf_document *doc, pdf_write_state { fz_rethrow(ctx); } + + doc->has_old_style_xrefs = 0; } static void @@ -2865,6 +2867,9 @@ int pdf_can_be_saved_incrementally(fz_context *ctx, pdf_document *doc) return 0; if (doc->crypt != NULL) return 0; + if (doc->has_xref_streams && doc->has_old_style_xrefs) + return 0; + return 1; } diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c index d60eb089..682a3ddb 100644 --- a/source/pdf/pdf-xref.c +++ b/source/pdf/pdf-xref.c @@ -933,6 +933,8 @@ pdf_read_old_xref(fz_context *ctx, pdf_document *doc, pdf_lexbuf *buf) if (tok != PDF_TOK_OPEN_DICT) fz_throw(ctx, FZ_ERROR_GENERIC, "expected trailer dictionary"); + doc->has_old_style_xrefs = 1; + return pdf_parse_dict(ctx, doc, file, buf); } |