summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-12-17 22:38:35 +0100
committerTor Andersson <tor.andersson@artifex.com>2015-12-18 15:32:14 +0100
commit80949d3d6b6320f5643a450c382f19370922e78f (patch)
tree7e3a6612d9c2985c3c3c493182d4171d017b4456 /include
parent02d5b2280db2846e4a683944819eb395ab15b8ce (diff)
downloadmupdf-80949d3d6b6320f5643a450c382f19370922e78f.tar.xz
Remove fz_save_document and use pdf_save_document directly instead.
In preparation of adding pdf_write_document that writes a document to a fz_output stream.
Diffstat (limited to 'include')
-rw-r--r--include/mupdf/fitz.h2
-rw-r--r--include/mupdf/fitz/document.h5
-rw-r--r--include/mupdf/fitz/write-document.h59
-rw-r--r--include/mupdf/pdf/clean.h2
-rw-r--r--include/mupdf/pdf/document.h38
-rw-r--r--include/mupdf/pdf/output-pdf.h5
6 files changed, 39 insertions, 72 deletions
diff --git a/include/mupdf/fitz.h b/include/mupdf/fitz.h
index 02f02dde..11accf6d 100644
--- a/include/mupdf/fitz.h
+++ b/include/mupdf/fitz.h
@@ -49,8 +49,6 @@
#include "mupdf/fitz/document.h"
#include "mupdf/fitz/annotation.h"
-#include "mupdf/fitz/write-document.h"
-
#include "mupdf/fitz/util.h"
/* Output formats */
diff --git a/include/mupdf/fitz/document.h b/include/mupdf/fitz/document.h
index 459a5fbd..32f5bba6 100644
--- a/include/mupdf/fitz/document.h
+++ b/include/mupdf/fitz/document.h
@@ -26,9 +26,6 @@ typedef enum
}
fz_permission;
-// TODO: move out of this interface (it's pdf specific)
-typedef struct fz_save_options_s fz_save_options;
-
typedef void (fz_document_close_fn)(fz_context *ctx, fz_document *doc);
typedef int (fz_document_needs_password_fn)(fz_context *ctx, fz_document *doc);
typedef int (fz_document_authenticate_password_fn)(fz_context *ctx, fz_document *doc, const char *password);
@@ -38,7 +35,6 @@ typedef void (fz_document_layout_fn)(fz_context *ctx, fz_document *doc, float w,
typedef int (fz_document_count_pages_fn)(fz_context *ctx, fz_document *doc);
typedef fz_page *(fz_document_load_page_fn)(fz_context *ctx, fz_document *doc, int number);
typedef int (fz_document_lookup_metadata_fn)(fz_context *ctx, fz_document *doc, const char *key, char *buf, int size);
-typedef void (fz_document_save_fn)(fz_context *ctx, fz_document *doc, char *filename, fz_save_options *opts);
typedef fz_link *(fz_page_load_links_fn)(fz_context *ctx, fz_page *page);
typedef fz_rect *(fz_page_bound_page_fn)(fz_context *ctx, fz_page *page, fz_rect *);
@@ -86,7 +82,6 @@ struct fz_document_s
fz_document_count_pages_fn *count_pages;
fz_document_load_page_fn *load_page;
fz_document_lookup_metadata_fn *lookup_metadata;
- fz_document_save_fn *save;
int did_layout;
};
diff --git a/include/mupdf/fitz/write-document.h b/include/mupdf/fitz/write-document.h
deleted file mode 100644
index f3974e71..00000000
--- a/include/mupdf/fitz/write-document.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef MUPDF_FITZ_WRITE_DOCUMENT_H
-#define MUPDF_FITZ_WRITE_DOCUMENT_H
-
-#include "mupdf/fitz/system.h"
-#include "mupdf/fitz/context.h"
-#include "mupdf/fitz/document.h"
-
-/*
- In calls to fz_save_document, 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_save_options_s
-{
- int do_incremental; /* Write just the changed objects */
- int do_ascii; /* If non-zero then attempt (where possible) to make
- the output ascii. */
- int do_deflate; /* If non-zero then attempt to compress streams. */
- int do_expand; /* Bitflags; each non zero bit indicates an aspect
- of the file that should be 'expanded' on
- writing. */
- int do_garbage; /* If non-zero then attempt (where possible) to
- garbage collect the file before writing. */
- int do_linear; /* If non-zero then write linearised. */
- int do_clean; /* If non-zero then clean contents */
- int continue_on_error; /* If non-zero, errors are (optionally)
- counted and writing continues. */
- int *errors; /* Pointer to a place to store a count of errors */
-};
-
-/* An enumeration of bitflags to use in the above 'do_expand' field of
- fz_save_options.
-*/
-enum
-{
- fz_expand_images = 1,
- fz_expand_fonts = 2,
- fz_expand_all = -1
-};
-
-/*
- fz_save_document: Write a document out to a file.
-
- (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_save_document(fz_context *ctx, fz_document *doc, char *filename, fz_save_options *opts);
-
-#endif
diff --git a/include/mupdf/pdf/clean.h b/include/mupdf/pdf/clean.h
index f1068cfb..397964f6 100644
--- a/include/mupdf/pdf/clean.h
+++ b/include/mupdf/pdf/clean.h
@@ -2,6 +2,6 @@
#define MUPDF_PDF_CLEAN_H
/* Read infile, and write selected pages to outfile with the given options. */
-void pdf_clean_file(fz_context *ctx, char *infile, char *outfile, char *password, fz_save_options *opts, char *retainlist[], int retainlen);
+void pdf_clean_file(fz_context *ctx, char *infile, char *outfile, char *password, pdf_write_options *opts, char *retainlist[], int retainlen);
#endif
diff --git a/include/mupdf/pdf/document.h b/include/mupdf/pdf/document.h
index e65a7590..f369bafe 100644
--- a/include/mupdf/pdf/document.h
+++ b/include/mupdf/pdf/document.h
@@ -280,4 +280,42 @@ void pdf_finish_edit(fz_context *ctx, pdf_document *doc);
int pdf_recognize(fz_context *doc, const char *magic);
+typedef struct pdf_write_options_s pdf_write_options;
+
+/* An enumeration of bitflags to use in the 'do_expand' field of the options struct. */
+enum
+{
+ PDF_EXPAND_IMAGES = 1,
+ PDF_EXPAND_FONTS = 2,
+ PDF_EXPAND_ALL = -1
+};
+
+/*
+ In calls to fz_save_document, 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 pdf_write_options_s
+{
+ int do_incremental; /* Write just the changed objects */
+ int do_ascii; /* If non-zero then attempt (where possible) to make
+ the output ascii. */
+ int do_deflate; /* If non-zero then attempt to compress streams. */
+ int do_expand; /* Bitflags; each non zero bit indicates an aspect
+ of the file that should be 'expanded' on
+ writing. */
+ int do_garbage; /* If non-zero then attempt (where possible) to
+ garbage collect the file before writing. */
+ int do_linear; /* If non-zero then write linearised. */
+ int do_clean; /* If non-zero then clean contents */
+ int continue_on_error; /* If non-zero, errors are (optionally)
+ counted and writing continues. */
+ int *errors; /* Pointer to a place to store a count of errors */
+};
+
+/*
+ pdf_save_document: Write out the document to a file with all changes finalised.
+*/
+void pdf_save_document(fz_context *ctx, pdf_document *doc, char *filename, pdf_write_options *opts);
+
#endif
diff --git a/include/mupdf/pdf/output-pdf.h b/include/mupdf/pdf/output-pdf.h
index a1506dfb..558209b0 100644
--- a/include/mupdf/pdf/output-pdf.h
+++ b/include/mupdf/pdf/output-pdf.h
@@ -12,11 +12,6 @@
*/
fz_device *pdf_new_pdf_device(fz_context *ctx, pdf_document *doc, pdf_obj *contents, pdf_obj *resources, const fz_matrix *ctm, fz_buffer *buf);
-/*
- pdf_save_document: Write out the document to a file with all changes finalised.
-*/
-void pdf_save_document(fz_context *ctx, pdf_document *doc, char *filename, fz_save_options *opts);
-
void pdf_localise_page_resources(fz_context *ctx, pdf_document *doc);
#endif