diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/mupdf/pdf/interpret.h | 80 |
1 files changed, 79 insertions, 1 deletions
diff --git a/include/mupdf/pdf/interpret.h b/include/mupdf/pdf/interpret.h index b7b85fff..ad4807ec 100644 --- a/include/mupdf/pdf/interpret.h +++ b/include/mupdf/pdf/interpret.h @@ -155,9 +155,87 @@ struct pdf_csi_s }; /* Functions to set up pdf_process structures */ + +/* + pdf_new_run_processor: Create a new "run" processor. This maps + from PDF operators to fz_device level calls. + + dev: The device to which the resulting device calls are to be + sent. + + ctm: The initial transformation matrix to use. + + usage: A NULL terminated string that describes the 'usage' of + this interpretation. Typically 'View', though 'Print' is also + defined within the PDF reference manual, and others are possible. + + gstate: The initial graphics state. + + nested: The nested depth of this interpreter. This should be + 0 for an initial call, and will be incremented in nested calls + due to Type 3 fonts. +*/ pdf_processor *pdf_new_run_processor(fz_context *ctx, fz_device *dev, const fz_matrix *ctm, const char *usage, pdf_gstate *gstate, int nested); + +/* + pdf_new_buffer_processor: Create a buffer processor. This + collects the incoming PDF operator stream into an fz_buffer. + + buffer: The (possibly empty) buffer to which operators will be + appended. + + ahxencode: If 0, then image streams will be send as binary, + otherwise they will be asciihexencoded. +*/ pdf_processor *pdf_new_buffer_processor(fz_context *ctx, fz_buffer *buffer, int ahxencode); -pdf_processor *pdf_new_filter_processor(fz_context *ctx, pdf_processor *chain, pdf_document *doc, pdf_obj *old_res, pdf_obj *new_res); + +/* + pdf_new_output_processor: Create an output processor. This + sends the incoming PDF operator stream to an fz_output stream. + + out: The output stream to which operators will be sent. + + ahxencode: If 0, then image streams will be send as binary, + otherwise they will be asciihexencoded. +*/ +pdf_processor *pdf_new_output_processor(fz_context *ctx, fz_output *out, int ahxencode); + +/* + pdf_new_filter_processor: Create a filter processor. This + filters the PDF operators it is fed, and passes them down + (with some changes) to the child filter. + + The changes made by the filter are: + + * No operations are allowed to change the top level gstate. + Additional q/Q operators are inserted to prevent this. + + * Repeated/unnecessary colour operators are removed (so, + for example, "0 0 0 rg 0 1 rg 0.5 g" would be sanitised to + "0.5 g") + + The intention of these changes is to provide a simpler, + but equivalent stream, repairing problems with mismatched + operators, maintaining structure (such as BMC, EMC calls) + and leaving the graphics state in an known (default) state + so that subsequent operations (such as synthesising new + operators to be appended to the stream) are easier. + + The net graphical effect of the filtered operator stream + should be identical to the incoming operator stream. + + chain: The child processor to which the filtered operators + will be fed. + + old_res: The incoming resource dictionary. + + new_res: An (initially empty) resource dictionary that will + be populated by copying entries from the old dictionary to + the new one as they are used. At the end therefore, this + contains exactly those resource objects actually required. + +*/ +pdf_processor *pdf_new_filter_processor(fz_context *ctx, pdf_processor *chain, pdf_obj *old_res, pdf_obj *new_res); /* Functions to actually process annotations, glyphs and general stream objects */ void pdf_process_contents(fz_context *ctx, pdf_processor *proc, pdf_document *doc, pdf_obj *obj, pdf_obj *res, fz_cookie *cookie); |