summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-04-25 20:40:29 +0100
committerRobin Watts <robin.watts@artifex.com>2012-04-28 09:44:49 +0100
commit4e3d351910f0927283fdc6911574ffe982ca678b (patch)
tree854e8367ae8906f957c3bb766ae578188e38cd61 /fitz
parent463e9b6c69cf9232da5ae9659eaad6e7050b594d (diff)
downloadmupdf-4e3d351910f0927283fdc6911574ffe982ca678b.tar.xz
Move guts of pdfclean into new pdf_write function.
Expose pdf_write function through the document interface.
Diffstat (limited to 'fitz')
-rw-r--r--fitz/doc_document.c7
-rw-r--r--fitz/fitz-internal.h1
-rw-r--r--fitz/fitz.h46
3 files changed, 54 insertions, 0 deletions
diff --git a/fitz/doc_document.c b/fitz/doc_document.c
index 22229892..83dbe53f 100644
--- a/fitz/doc_document.c
+++ b/fitz/doc_document.c
@@ -129,3 +129,10 @@ fz_meta(fz_document *doc, int key, void *ptr, int size)
return doc->meta(doc, key, ptr, size);
return FZ_META_UNKNOWN_KEY;
}
+
+void
+fz_write(fz_document *doc, char *filename, fz_write_opts *opts)
+{
+ if (doc && doc->write)
+ doc->write(doc, filename, opts);
+} \ No newline at end of file
diff --git a/fitz/fitz-internal.h b/fitz/fitz-internal.h
index bd19886c..1e54c900 100644
--- a/fitz/fitz-internal.h
+++ b/fitz/fitz-internal.h
@@ -1080,6 +1080,7 @@ struct fz_document_s
void (*run_page)(fz_document *doc, fz_page *page, fz_device *dev, fz_matrix transform, fz_cookie *cookie);
void (*free_page)(fz_document *doc, fz_page *page);
int (*meta)(fz_document *doc, int key, void *ptr, int size);
+ void (*write)(fz_document *doc, char *filename, fz_write_options *opts);
};
#endif
diff --git a/fitz/fitz.h b/fitz/fitz.h
index 04215c71..61f80756 100644
--- a/fitz/fitz.h
+++ b/fitz/fitz.h
@@ -2231,4 +2231,50 @@ enum
FZ_META_INFO = 4,
};
+typedef struct fz_write_options_s fz_write_options;
+
+/*
+ In calls to fz_write, the following options structure can be used
+ to control aspects of the writing process. This structure may grow
+ in future, and should be zero-filled to allow forwards compatiblity.
+*/
+struct fz_write_options_s
+{
+ int doascii; /* If non-zero then attempt (where possible) to
+ make the output ascii. */
+ int doexpand; /* Bitflags; each non zero bit indicates an aspect
+ of the file that should be 'expanded' on
+ writing. */
+ int dogarbage; /* If non-zero then attempt (where possible) to
+ garbage collect the file before writing. */
+};
+
+/* An enumeration of bitflags to use in the above 'doexpand' field of
+ fz_write_options.
+*/
+enum
+{
+ fz_expand_images = 1,
+ fz_expand_fonts = 2,
+ fz_expand_all = -1
+};
+
+/*
+ fz_write: Write a document out.
+
+ (In development - Subject to change in future versions)
+
+ Save a copy of the current document in its original format.
+ Internally the document may change.
+
+ doc: The document to save.
+
+ filename: The filename to save to.
+
+ opts: NULL, or a pointer to an options structure.
+
+ May throw exceptions.
+*/
+void fz_write(fz_document *doc, char *filename, fz_write_options *opts);
+
#endif