From 634d64e47f82f23bc8cd7a05464a9defc66fee08 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 1 Dec 2017 15:28:32 +0100 Subject: Add 'clean' option to pdfclean to clean (but not sanitize) content streams. This goes well with the 'mutool clean -d' decompression option to debug content streams, without doing the sanitize optimization pass. --- include/mupdf/pdf/document.h | 4 +++- include/mupdf/pdf/page.h | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/mupdf/pdf/document.h b/include/mupdf/pdf/document.h index 30cfba48..63f94bcd 100644 --- a/include/mupdf/pdf/document.h +++ b/include/mupdf/pdf/document.h @@ -844,7 +844,8 @@ struct pdf_write_options_s int do_decompress; /* Decompress streams (except when compressing images/fonts). */ int do_garbage; /* Garbage collect objects before saving; 1=gc, 2=re-number, 3=de-duplicate. */ int do_linear; /* Write linearised. */ - int do_clean; /* Sanitize content streams. */ + int do_clean; /* Clean content streams. */ + int do_sanitize; /* Sanitize content streams. */ int continue_on_error; /* If set, errors are (optionally) counted and writing continues. */ int *errors; /* Pointer to a place to store a count of errors */ }; @@ -857,6 +858,7 @@ struct pdf_write_options_s l: linearize a: ascii hex encode z: deflate + c: clean content streams s: sanitize content streams */ pdf_write_options *pdf_parse_write_options(fz_context *ctx, pdf_write_options *opts, const char *args); diff --git a/include/mupdf/pdf/page.h b/include/mupdf/pdf/page.h index f904a7c1..bd0cec9d 100644 --- a/include/mupdf/pdf/page.h +++ b/include/mupdf/pdf/page.h @@ -141,7 +141,7 @@ typedef void (pdf_page_contents_process_fn)(fz_context *ctx, fz_buffer *buffer, to track progress, collect errors etc. */ void pdf_clean_page_contents(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_cookie *cookie, - pdf_page_contents_process_fn *proc, void *proc_arg, int ascii); + pdf_page_contents_process_fn *proc, void *proc_arg, int sanitize, int ascii); /* pdf_clean_annot_contents: Clean a loaded annotations rendering operations, @@ -168,7 +168,7 @@ void pdf_clean_page_contents(fz_context *ctx, pdf_document *doc, pdf_page *page, to track progress, collect errors etc. */ void pdf_clean_annot_contents(fz_context *ctx, pdf_document *doc, pdf_annot *annot, fz_cookie *cookie, - pdf_page_contents_process_fn *proc, void *proc_arg, int ascii); + pdf_page_contents_process_fn *proc, void *proc_arg, int sanitize, int ascii); /* pdf_filter_page_contents: Performs the same task as @@ -184,7 +184,8 @@ void pdf_clean_annot_contents(fz_context *ctx, pdf_document *doc, pdf_annot *ann arg: Opaque value to be passed to callback functions. */ void pdf_filter_page_contents(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_cookie *cookie, - pdf_page_contents_process_fn *proc_fn, pdf_text_filter_fn *text_filter, pdf_after_text_object_fn *after_text, void *arg, int ascii); + pdf_page_contents_process_fn *proc_fn, pdf_text_filter_fn *text_filter, pdf_after_text_object_fn *after_text, void *arg, + int sanitize, int ascii); /* pdf_filter_annot_contents: Performs the same task as @@ -200,7 +201,8 @@ void pdf_filter_page_contents(fz_context *ctx, pdf_document *doc, pdf_page *page arg: Opaque value to be passed to callback functions. */ void pdf_filter_annot_contents(fz_context *ctx, pdf_document *doc, pdf_annot *annot, fz_cookie *cookie, - pdf_page_contents_process_fn *proc, pdf_text_filter_fn *text_filter, pdf_after_text_object_fn *after_text, void *arg, int ascii); + pdf_page_contents_process_fn *proc, pdf_text_filter_fn *text_filter, pdf_after_text_object_fn *after_text, void *arg, + int sanitize, int ascii); /* Presentation interface. -- cgit v1.2.3