mupdf
Loading...
Searching...
No Matches
interpret.h
Go to the documentation of this file.
1// Copyright (C) 2004-2025 Artifex Software, Inc.
2//
3// This file is part of MuPDF.
4//
5// MuPDF is free software: you can redistribute it and/or modify it under the
6// terms of the GNU Affero General Public License as published by the Free
7// Software Foundation, either version 3 of the License, or (at your option)
8// any later version.
9//
10// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
11// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
13// details.
14//
15// You should have received a copy of the GNU Affero General Public License
16// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
17//
18// Alternative licensing terms are available from the licensor.
19// For commercial licensing, see <https://www.artifex.com/> or contact
20// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
21// CA 94129, USA, for further information.
22
23#ifndef PDF_INTERPRET_H
24#define PDF_INTERPRET_H
25
26#include "mupdf/pdf/font.h"
27#include "mupdf/pdf/resource.h"
28#include "mupdf/pdf/document.h"
29
30typedef struct pdf_gstate pdf_gstate;
32
33void *pdf_new_processor(fz_context *ctx, int size);
37
38/*
39 * Stack of resources used during interpretation (holding page and
40 * xobject/font/type3 glyph resource dictionaries).
41 */
42
48
49pdf_obj *pdf_lookup_resource(fz_context *ctx, pdf_resource_stack *stack, pdf_obj *type, const char *name);
50
55
57{
58 int refs;
59
60 int closed;
61
62 /* close the processor. Also closes any chained processors. */
66
67 /* At any stage, we can have one set of resources in place.
68 * This function gives us a set of resources to use. We remember
69 * any previous set on a stack, so we can pop back to it later.
70 * Our responsibility (as well as remembering it for our own use)
71 * is to pass either it, or a filtered version of it onto any
72 * chained processor. */
73 void (*push_resources)(fz_context *ctx, pdf_processor *proc, pdf_obj *res);
74
75 /* Pop the resources stack. This must be passed on to any chained
76 * processors. This returns a pointer to the resource dict just
77 * popped by the deepest filter. The caller inherits this reference.
78 * NOTE: This must NOT throw as it may be called during cleanup!
79 */
80 pdf_obj *(*pop_resources)(fz_context *ctx, pdf_processor *proc);
81
82 /* general graphics state */
83 void (*op_w)(fz_context *ctx, pdf_processor *proc, float linewidth);
84 void (*op_j)(fz_context *ctx, pdf_processor *proc, int linejoin);
85 void (*op_J)(fz_context *ctx, pdf_processor *proc, int linecap);
86 void (*op_M)(fz_context *ctx, pdf_processor *proc, float miterlimit);
87 void (*op_d)(fz_context *ctx, pdf_processor *proc, pdf_obj *array, float phase);
88 void (*op_ri)(fz_context *ctx, pdf_processor *proc, const char *intent);
89 void (*op_i)(fz_context *ctx, pdf_processor *proc, float flatness);
90
91 void (*op_gs_begin)(fz_context *ctx, pdf_processor *proc, const char *name, pdf_obj *extgstate);
92 void (*op_gs_BM)(fz_context *ctx, pdf_processor *proc, const char *blendmode);
93 void (*op_gs_ca)(fz_context *ctx, pdf_processor *proc, float alpha);
94 void (*op_gs_CA)(fz_context *ctx, pdf_processor *proc, float alpha);
95 void (*op_gs_SMask)(fz_context *ctx, pdf_processor *proc, pdf_obj *smask, fz_colorspace *smask_cs, float *bc, int luminosity, pdf_obj *tr);
96 void (*op_gs_end)(fz_context *ctx, pdf_processor *proc);
97
98 /* special graphics state */
99 void (*op_q)(fz_context *ctx, pdf_processor *proc);
100 void (*op_Q)(fz_context *ctx, pdf_processor *proc);
101 void (*op_cm)(fz_context *ctx, pdf_processor *proc, float a, float b, float c, float d, float e, float f);
102
103 /* path construction */
104 void (*op_m)(fz_context *ctx, pdf_processor *proc, float x, float y);
105 void (*op_l)(fz_context *ctx, pdf_processor *proc, float x, float y);
106 void (*op_c)(fz_context *ctx, pdf_processor *proc, float x1, float y1, float x2, float y2, float x3, float y3);
107 void (*op_v)(fz_context *ctx, pdf_processor *proc, float x2, float y2, float x3, float y3);
108 void (*op_y)(fz_context *ctx, pdf_processor *proc, float x1, float y1, float x3, float y3);
109 void (*op_h)(fz_context *ctx, pdf_processor *proc);
110 void (*op_re)(fz_context *ctx, pdf_processor *proc, float x, float y, float w, float h);
111
112 /* path painting */
113 void (*op_S)(fz_context *ctx, pdf_processor *proc);
114 void (*op_s)(fz_context *ctx, pdf_processor *proc);
115 void (*op_F)(fz_context *ctx, pdf_processor *proc);
116 void (*op_f)(fz_context *ctx, pdf_processor *proc);
117 void (*op_fstar)(fz_context *ctx, pdf_processor *proc);
118 void (*op_B)(fz_context *ctx, pdf_processor *proc);
119 void (*op_Bstar)(fz_context *ctx, pdf_processor *proc);
120 void (*op_b)(fz_context *ctx, pdf_processor *proc);
121 void (*op_bstar)(fz_context *ctx, pdf_processor *proc);
122 void (*op_n)(fz_context *ctx, pdf_processor *proc);
123
124 /* clipping paths */
125 void (*op_W)(fz_context *ctx, pdf_processor *proc);
126 void (*op_Wstar)(fz_context *ctx, pdf_processor *proc);
127
128 /* text objects */
129 void (*op_BT)(fz_context *ctx, pdf_processor *proc);
130 void (*op_ET)(fz_context *ctx, pdf_processor *proc);
131
132 /* text state */
133 void (*op_Tc)(fz_context *ctx, pdf_processor *proc, float charspace);
134 void (*op_Tw)(fz_context *ctx, pdf_processor *proc, float wordspace);
135 void (*op_Tz)(fz_context *ctx, pdf_processor *proc, float scale);
136 void (*op_TL)(fz_context *ctx, pdf_processor *proc, float leading);
137 void (*op_Tf)(fz_context *ctx, pdf_processor *proc, const char *name, pdf_font_desc *font, float size);
138 void (*op_Tr)(fz_context *ctx, pdf_processor *proc, int render);
139 void (*op_Ts)(fz_context *ctx, pdf_processor *proc, float rise);
140
141 /* text positioning */
142 void (*op_Td)(fz_context *ctx, pdf_processor *proc, float tx, float ty);
143 void (*op_TD)(fz_context *ctx, pdf_processor *proc, float tx, float ty);
144 void (*op_Tm)(fz_context *ctx, pdf_processor *proc, float a, float b, float c, float d, float e, float f);
145 void (*op_Tstar)(fz_context *ctx, pdf_processor *proc);
146
147 /* text showing */
148 void (*op_TJ)(fz_context *ctx, pdf_processor *proc, pdf_obj *array);
149 void (*op_Tj)(fz_context *ctx, pdf_processor *proc, char *str, size_t len);
150 void (*op_squote)(fz_context *ctx, pdf_processor *proc, char *str, size_t len);
151 void (*op_dquote)(fz_context *ctx, pdf_processor *proc, float aw, float ac, char *str, size_t len);
152
153 /* type 3 fonts */
154 void (*op_d0)(fz_context *ctx, pdf_processor *proc, float wx, float wy);
155 void (*op_d1)(fz_context *ctx, pdf_processor *proc, float wx, float wy, float llx, float lly, float urx, float ury);
156
157 /* color */
158 void (*op_CS)(fz_context *ctx, pdf_processor *proc, const char *name, fz_colorspace *cs);
159 void (*op_cs)(fz_context *ctx, pdf_processor *proc, const char *name, fz_colorspace *cs);
160 void (*op_SC_pattern)(fz_context *ctx, pdf_processor *proc, const char *name, pdf_pattern *pat, int n, float *color);
161 void (*op_sc_pattern)(fz_context *ctx, pdf_processor *proc, const char *name, pdf_pattern *pat, int n, float *color);
162 void (*op_SC_shade)(fz_context *ctx, pdf_processor *proc, const char *name, fz_shade *shade);
163 void (*op_sc_shade)(fz_context *ctx, pdf_processor *proc, const char *name, fz_shade *shade);
164 void (*op_SC_color)(fz_context *ctx, pdf_processor *proc, int n, float *color);
165 void (*op_sc_color)(fz_context *ctx, pdf_processor *proc, int n, float *color);
166
167 void (*op_G)(fz_context *ctx, pdf_processor *proc, float g);
168 void (*op_g)(fz_context *ctx, pdf_processor *proc, float g);
169 void (*op_RG)(fz_context *ctx, pdf_processor *proc, float r, float g, float b);
170 void (*op_rg)(fz_context *ctx, pdf_processor *proc, float r, float g, float b);
171 void (*op_K)(fz_context *ctx, pdf_processor *proc, float c, float m, float y, float k);
172 void (*op_k)(fz_context *ctx, pdf_processor *proc, float c, float m, float y, float k);
173
174 /* shadings, images, xobjects */
175 void (*op_BI)(fz_context *ctx, pdf_processor *proc, fz_image *image, const char *colorspace_name);
176 void (*op_sh)(fz_context *ctx, pdf_processor *proc, const char *name, fz_shade *shade);
177 void (*op_Do_image)(fz_context *ctx, pdf_processor *proc, const char *name, fz_image *image);
178 void (*op_Do_form)(fz_context *ctx, pdf_processor *proc, const char *name, pdf_obj *form);
179
180 /* marked content */
181 void (*op_MP)(fz_context *ctx, pdf_processor *proc, const char *tag);
182 void (*op_DP)(fz_context *ctx, pdf_processor *proc, const char *tag, pdf_obj *raw, pdf_obj *cooked);
183 void (*op_BMC)(fz_context *ctx, pdf_processor *proc, const char *tag);
184 void (*op_BDC)(fz_context *ctx, pdf_processor *proc, const char *tag, pdf_obj *raw, pdf_obj *cooked);
185 void (*op_EMC)(fz_context *ctx, pdf_processor *proc);
186
187 /* compatibility */
188 void (*op_BX)(fz_context *ctx, pdf_processor *proc);
189 void (*op_EX)(fz_context *ctx, pdf_processor *proc);
190
191 /* Virtual ops for ExtGState entries */
192 void (*op_gs_OP)(fz_context *ctx, pdf_processor *proc, int b);
193 void (*op_gs_op)(fz_context *ctx, pdf_processor *proc, int b);
194 void (*op_gs_OPM)(fz_context *ctx, pdf_processor *proc, int i);
196
197 /* EOD is used to signify end of data (before any finalise/close down/
198 * automatically added gstate pops). */
199 void (*op_EOD)(fz_context *ctx, pdf_processor *proc);
200
201 /* END is used to signify end of stream (finalise and close down) */
202 void (*op_END)(fz_context *ctx, pdf_processor *proc);
203
204 /* interpreter state that persists across content streams */
205 const char *usage;
207
209
210 /* resource dictionary stack */
212
213 /* Unused, except when inited as chain processor */
215};
216
217typedef struct
218{
219 /* input */
223
224 /* state */
229
230 /* stack */
232 char name[256];
233 char string[256];
235 int top;
236 float stack[32];
237} pdf_csi;
238
239void pdf_count_q_balance(fz_context *ctx, pdf_document *doc, pdf_obj *res, pdf_obj *stm, int *prepend, int *append);
240
241/* Functions to set up pdf_process structures */
242
243pdf_processor *pdf_new_run_processor(fz_context *ctx, pdf_document *doc, fz_device *dev, fz_matrix ctm, int struct_parent, const char *usage, pdf_gstate *gstate, fz_default_colorspaces *default_cs, fz_cookie *cookie, pdf_gstate *fill_gstate, pdf_gstate *stroke_gstate);
244
245/*
246 Create a buffer processor.
247
248 This collects the incoming PDF operator stream into an fz_buffer.
249
250 buffer: The (possibly empty) buffer to which operators will be
251 appended.
252
253 ahxencode: If 0, then image streams will be send as binary,
254 otherwise they will be asciihexencoded.
255
256 newlines: If 0, then minimal spacing will be sent. If 1
257 then newlines will be sent after every operator.
258*/
259pdf_processor *pdf_new_buffer_processor(fz_context *ctx, fz_buffer *buffer, int ahxencode, int newlines);
260
261/*
262 Reopen a closed processor to be used again.
263
264 This brings a processor back to life after a close.
265 Not all processors may support this, so this may throw
266 an exception.
267*/
269
270
271/*
272 Create an output processor. This
273 sends the incoming PDF operator stream to an fz_output stream.
274
275 out: The output stream to which operators will be sent.
276
277 ahxencode: If 0, then image streams will be send as binary,
278 otherwise they will be asciihexencoded.
279
280 newlines: If 0, then minimal spacing will be sent. If 1
281 then newlines will be sent after every operator.
282*/
283pdf_processor *pdf_new_output_processor(fz_context *ctx, fz_output *out, int ahxencode, int newlines);
284
286
287/*
288 Create a filter processor. This filters the PDF operators
289 it is fed, and passes them down (with some changes) to the
290 child filter.
291
292 chain: The child processor to which the filtered operators
293 will be fed.
294
295 The options field contains a pointer to a structure with
296 filter specific options in.
297*/
298typedef pdf_processor *(pdf_filter_factory_fn)(fz_context *ctx, pdf_document *doc, pdf_processor *chain, int struct_parents, fz_matrix transform, pdf_filter_options *options, void *factory_options);
299
300/*
301 A pdf_filter_factory is a pdf_filter_factory_fn, plus the options
302 needed to instantiate it.
303*/
309
310/*
311 recurse: Filter resources recursively.
312
313 instance_forms: Always recurse on XObject Form resources, but will
314 create a new instance of each XObject Form that is used, filtered
315 individually.
316
317 ascii: If true, escape all binary data in the output.
318
319 no_update: If true, do not update the document at the end.
320
321 opaque: Opaque value that is passed to the complete function.
322
323 complete: A function called at the end of processing.
324 This allows the caller to insert some extra content after
325 all other content.
326
327 filters: Pointer to an array of filter factory/options.
328 The array is terminated by an entry with a NULL factory pointer.
329 Operators will be fed into the filter generated from the first
330 factory function in the list, and from there go to the filter
331 generated from the second factory in the list etc.
332
333 newlines: If 0, then minimal whitespace will be produced. If 1,
334 then a newline will be sent after every operator.
335*/
349
364
365/*
366 image_filter: A function called to assess whether a given
367 image should be removed or not.
368
369 text_filter: A function called to assess whether a given
370 character should be removed or not.
371
372 after_text_object: A function called after each text object.
373 This allows the caller to insert some extra content if
374 desired.
375
376 culler: A function called to see whether each object should
377 be culled or not.
378*/
379typedef struct
380{
381 void *opaque;
382 fz_image *(*image_filter)(fz_context *ctx, void *opaque, fz_matrix ctm, const char *name, fz_image *image, fz_rect scissor);
383 int (*text_filter)(fz_context *ctx, void *opaque, int *ucsbuf, int ucslen, fz_matrix trm, fz_matrix ctm, fz_rect bbox, int tr, float ca, float CA);
385 int (*culler)(fz_context *ctx, void *opaque, fz_rect bbox, fz_cull_type type);
386}
388
389/*
390 A sanitize filter factory.
391
392 sopts = pointer to pdf_sanitize_filter_options.
393
394 The changes made by a filter generated from this are:
395
396 * No operations are allowed to change the top level gstate.
397 Additional q/Q operators are inserted to prevent this.
398
399 * Repeated/unnecessary colour operators are removed (so,
400 for example, "0 0 0 rg 0 1 rg 0.5 g" would be sanitised to
401 "0.5 g")
402
403 The intention of these changes is to provide a simpler,
404 but equivalent stream, repairing problems with mismatched
405 operators, maintaining structure (such as BMC, EMC calls)
406 and leaving the graphics state in an known (default) state
407 so that subsequent operations (such as synthesising new
408 operators to be appended to the stream) are easier.
409
410 The net graphical effect of the filtered operator stream
411 should be identical to the incoming operator stream.
412*/
413pdf_processor *pdf_new_sanitize_filter(fz_context *ctx, pdf_document *doc, pdf_processor *chain, int struct_parents, fz_matrix transform, pdf_filter_options *options, void *sopts);
414
415typedef struct
416{
417 void *opaque;
418 /* To be expanded */
419}
421
422pdf_processor *pdf_new_vectorize_filter(fz_context *ctx, pdf_document *doc, pdf_processor *chain, int structparents, fz_matrix transform, pdf_filter_options *options, void *vopts);
423
425
427
429
430/*
431 opaque: Opaque value that is passed to all the filter functions.
432
433 color_rewrite: function pointer called to rewrite a color
434 On entry:
435 *cs = reference to a pdf object representing the colorspace.
436
437 *n = number of color components
438
439 color = *n color values.
440
441 On exit:
442 *cs either the same (for no change in colorspace) or
443 updated to be a new one. Reference must be dropped, and
444 a new kept reference returned!
445
446 *n = number of color components (maybe updated)
447
448 color = *n color values (maybe updated)
449
450 image_rewrite: function pointer called to rewrite an image
451 On entry:
452 *image = reference to an fz_image.
453
454 On exit:
455 *image either the same (for no change) or updated
456 to be a new one. Reference must be dropped, and a
457 new kept reference returned.
458
459 share_rewrite: function pointer called to rewrite a shade
460
461 repeated_image_rewrite: If 0, then each image is rewritten only once.
462 Otherwise, it is called for every instance (useful if gathering
463 information about the ctm).
464*/
465typedef struct
466{
467 void *opaque;
468 void (*color_rewrite)(fz_context *ctx, void *opaque, pdf_obj **cs, int *n, float color[FZ_MAX_COLORS]);
469 void (*image_rewrite)(fz_context *ctx, void *opaque, fz_image **image, fz_matrix ctm, pdf_obj *obj);
473
475pdf_new_color_filter(fz_context *ctx, pdf_document *doc, pdf_processor *chain, int struct_parents, fz_matrix transform, pdf_filter_options *options, void *copts);
476
477/*
478 Functions to actually process annotations, glyphs and general stream objects.
479*/
480void pdf_process_contents(fz_context *ctx, pdf_processor *proc, pdf_document *doc, pdf_obj *res, pdf_obj *stm, fz_cookie *cookie, pdf_obj **out_res);
482void pdf_process_glyph(fz_context *ctx, pdf_processor *proc, pdf_document *doc, pdf_obj *resources, fz_buffer *contents);
483
484/*
485 Function to process a contents stream without handling the resources.
486 The caller is responsible for pushing/popping the resources.
487*/
489
490/* Text handling helper functions */
503
520
525void pdf_tos_reset(fz_context *ctx, pdf_text_object_state *tos, int render);
527int pdf_tos_make_trm(fz_context *ctx, pdf_text_object_state *tos, pdf_text_state *text, pdf_font_desc *fontdesc, int cid, fz_matrix *trm, float *adv);
529void pdf_tos_translate(pdf_text_object_state *tos, float tx, float ty);
530void pdf_tos_set_matrix(pdf_text_object_state *tos, float a, float b, float c, float d, float e, float f);
531void pdf_tos_newline(pdf_text_object_state *tos, float leading);
532
533#endif
struct pdf_annot pdf_annot
Definition annot.h:32
@ FZ_MAX_COLORS
Definition color.h:102
pdf_processor * pdf_filter_factory_fn(fz_context *ctx, pdf_document *doc, pdf_processor *chain, int struct_parents, fz_matrix transform, pdf_filter_options *options, void *factory_options)
Definition interpret.h:298
pdf_obj * pdf_processor_pop_resources(fz_context *ctx, pdf_processor *proc)
void pdf_close_processor(fz_context *ctx, pdf_processor *proc)
void pdf_process_raw_contents(fz_context *ctx, pdf_processor *proc, pdf_document *doc, pdf_obj *stmobj, fz_cookie *cookie)
void pdf_tos_save(fz_context *ctx, pdf_text_object_state *tos, fz_matrix save[2])
fz_cull_type
Definition interpret.h:351
@ FZ_CULL_SHADING
Definition interpret.h:362
@ FZ_CULL_PATH_FILL
Definition interpret.h:353
@ FZ_CULL_PATH_STROKE
Definition interpret.h:354
@ FZ_CULL_CLIP_PATH_STROKE
Definition interpret.h:358
@ FZ_CULL_IMAGE
Definition interpret.h:361
@ FZ_CULL_CLIP_PATH_FILL
Definition interpret.h:357
@ FZ_CULL_GLYPH
Definition interpret.h:360
@ FZ_CULL_CLIP_PATH_FILL_STROKE
Definition interpret.h:359
@ FZ_CULL_PATH_FILL_STROKE
Definition interpret.h:355
@ FZ_CULL_PATH_DROP
Definition interpret.h:352
@ FZ_CULL_CLIP_PATH_DROP
Definition interpret.h:356
void pdf_tos_newline(pdf_text_object_state *tos, float leading)
pdf_processor * pdf_keep_processor(fz_context *ctx, pdf_processor *proc)
void pdf_processor_push_resources(fz_context *ctx, pdf_processor *proc, pdf_obj *res)
void pdf_process_glyph(fz_context *ctx, pdf_processor *proc, pdf_document *doc, pdf_obj *resources, fz_buffer *contents)
pdf_obj * pdf_filter_xobject_instance(fz_context *ctx, pdf_obj *old_xobj, pdf_obj *page_res, fz_matrix ctm, pdf_filter_options *options, pdf_cycle_list *cycle_up)
void pdf_tos_translate(pdf_text_object_state *tos, float tx, float ty)
void pdf_process_contents(fz_context *ctx, pdf_processor *proc, pdf_document *doc, pdf_obj *res, pdf_obj *stm, fz_cookie *cookie, pdf_obj **out_res)
void * pdf_new_processor(fz_context *ctx, int size)
void pdf_tos_reset(fz_context *ctx, pdf_text_object_state *tos, int render)
void pdf_tos_move_after_char(fz_context *ctx, pdf_text_object_state *tos)
fz_text * pdf_tos_get_text(fz_context *ctx, pdf_text_object_state *tos)
pdf_processor * pdf_new_vectorize_filter(fz_context *ctx, pdf_document *doc, pdf_processor *chain, int structparents, fz_matrix transform, pdf_filter_options *options, void *vopts)
pdf_processor_requirements
Definition interpret.h:52
@ PDF_PROCESSOR_REQUIRES_DECODED_IMAGES
Definition interpret.h:53
void pdf_tos_set_matrix(pdf_text_object_state *tos, float a, float b, float c, float d, float e, float f)
pdf_processor * pdf_new_output_processor(fz_context *ctx, fz_output *out, int ahxencode, int newlines)
void pdf_tos_accumulate_clip(fz_context *ctx, pdf_text_object_state *tos)
void pdf_tos_restore(fz_context *ctx, pdf_text_object_state *tos, fz_matrix save[2])
pdf_processor * pdf_new_run_processor(fz_context *ctx, pdf_document *doc, fz_device *dev, fz_matrix ctm, int struct_parent, const char *usage, pdf_gstate *gstate, fz_default_colorspaces *default_cs, fz_cookie *cookie, pdf_gstate *fill_gstate, pdf_gstate *stroke_gstate)
pdf_processor * pdf_new_sanitize_filter(fz_context *ctx, pdf_document *doc, pdf_processor *chain, int struct_parents, fz_matrix transform, pdf_filter_options *options, void *sopts)
void pdf_process_annot(fz_context *ctx, pdf_processor *proc, pdf_annot *annot, fz_cookie *cookie)
int pdf_tos_make_trm(fz_context *ctx, pdf_text_object_state *tos, pdf_text_state *text, pdf_font_desc *fontdesc, int cid, fz_matrix *trm, float *adv)
fz_text * pdf_tos_get_clip_text(fz_context *ctx, pdf_text_object_state *tos)
void pdf_reset_processor(fz_context *ctx, pdf_processor *proc)
pdf_processor * pdf_new_buffer_processor(fz_context *ctx, fz_buffer *buffer, int ahxencode, int newlines)
pdf_processor * pdf_new_color_filter(fz_context *ctx, pdf_document *doc, pdf_processor *chain, int struct_parents, fz_matrix transform, pdf_filter_options *options, void *copts)
struct pdf_gstate pdf_gstate
Definition interpret.h:30
void pdf_drop_processor(fz_context *ctx, pdf_processor *proc)
void pdf_count_q_balance(fz_context *ctx, pdf_document *doc, pdf_obj *res, pdf_obj *stm, int *prepend, int *append)
pdf_obj * pdf_lookup_resource(fz_context *ctx, pdf_resource_stack *stack, pdf_obj *type, const char *name)
struct pdf_obj pdf_obj
Definition object.h:44
pdf_recolor_vertex * pdf_shade_recolorer(fz_context *ctx, void *opaque, fz_colorspace *src_cs, fz_colorspace **dst_cs)
Definition resource.h:119
Definition buffer.h:41
Definition color.h:417
Definition context.h:886
Definition color.h:339
Definition device.h:290
Definition image.h:351
Definition geometry.h:388
Definition output.h:111
Definition geometry.h:231
Definition shade.h:53
Definition context.h:792
Definition text.h:82
Definition interpret.h:466
void * opaque
Definition interpret.h:467
void(* image_rewrite)(fz_context *ctx, void *opaque, fz_image **image, fz_matrix ctm, pdf_obj *obj)
Definition interpret.h:469
int repeated_image_rewrite
Definition interpret.h:471
pdf_shade_recolorer * shade_rewrite
Definition interpret.h:470
void(* color_rewrite)(fz_context *ctx, void *opaque, pdf_obj **cs, int *n, float color[FZ_MAX_COLORS])
Definition interpret.h:468
Definition interpret.h:218
int gstate
Definition interpret.h:225
fz_cookie * cookie
Definition interpret.h:222
size_t string_len
Definition interpret.h:234
int in_text
Definition interpret.h:227
int xbalance
Definition interpret.h:226
pdf_obj * obj
Definition interpret.h:231
pdf_document * doc
Definition interpret.h:220
pdf_lexbuf * buf
Definition interpret.h:221
fz_rect d1_rect
Definition interpret.h:228
char name[256]
Definition interpret.h:232
int top
Definition interpret.h:235
float stack[32]
Definition interpret.h:236
Definition object.h:113
Definition document.h:463
Definition interpret.h:305
pdf_filter_factory_fn * filter
Definition interpret.h:306
void * options
Definition interpret.h:307
Definition interpret.h:337
int newlines
Definition interpret.h:347
int instance_forms
Definition interpret.h:339
int recurse
Definition interpret.h:338
void(* complete)(fz_context *ctx, fz_buffer *buffer, void *opaque)
Definition interpret.h:344
pdf_filter_factory * filters
Definition interpret.h:346
int no_update
Definition interpret.h:341
void * opaque
Definition interpret.h:343
int ascii
Definition interpret.h:340
Definition font.h:62
Definition document.h:48
Definition resource.h:136
Definition interpret.h:57
void(* op_B)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:118
void(* op_d1)(fz_context *ctx, pdf_processor *proc, float wx, float wy, float llx, float lly, float urx, float ury)
Definition interpret.h:155
void(* op_M)(fz_context *ctx, pdf_processor *proc, float miterlimit)
Definition interpret.h:86
void(* op_i)(fz_context *ctx, pdf_processor *proc, float flatness)
Definition interpret.h:89
void(* op_SC_color)(fz_context *ctx, pdf_processor *proc, int n, float *color)
Definition interpret.h:164
void(* op_sc_color)(fz_context *ctx, pdf_processor *proc, int n, float *color)
Definition interpret.h:165
void(* op_d)(fz_context *ctx, pdf_processor *proc, pdf_obj *array, float phase)
Definition interpret.h:87
void(* op_f)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:116
void(* op_Ts)(fz_context *ctx, pdf_processor *proc, float rise)
Definition interpret.h:139
void(* op_RG)(fz_context *ctx, pdf_processor *proc, float r, float g, float b)
Definition interpret.h:169
void(* op_gs_OPM)(fz_context *ctx, pdf_processor *proc, int i)
Definition interpret.h:194
void(* op_Tw)(fz_context *ctx, pdf_processor *proc, float wordspace)
Definition interpret.h:134
void(* op_F)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:115
void(* op_BX)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:188
void(* op_S)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:113
void(* op_Wstar)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:126
pdf_resource_stack * rstack
Definition interpret.h:211
void(* op_sc_pattern)(fz_context *ctx, pdf_processor *proc, const char *name, pdf_pattern *pat, int n, float *color)
Definition interpret.h:161
void(* op_y)(fz_context *ctx, pdf_processor *proc, float x1, float y1, float x3, float y3)
Definition interpret.h:108
void(* op_gs_op)(fz_context *ctx, pdf_processor *proc, int b)
Definition interpret.h:193
void(* op_Do_form)(fz_context *ctx, pdf_processor *proc, const char *name, pdf_obj *form)
Definition interpret.h:178
void(* close_processor)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:63
void(* op_Bstar)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:119
void(* op_rg)(fz_context *ctx, pdf_processor *proc, float r, float g, float b)
Definition interpret.h:170
void(* op_BI)(fz_context *ctx, pdf_processor *proc, fz_image *image, const char *colorspace_name)
Definition interpret.h:175
void(* op_W)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:125
int refs
Definition interpret.h:58
void(* op_G)(fz_context *ctx, pdf_processor *proc, float g)
Definition interpret.h:167
void(* op_s)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:114
void(* op_gs_OP)(fz_context *ctx, pdf_processor *proc, int b)
Definition interpret.h:192
void(* op_MP)(fz_context *ctx, pdf_processor *proc, const char *tag)
Definition interpret.h:181
void(* op_gs_ca)(fz_context *ctx, pdf_processor *proc, float alpha)
Definition interpret.h:93
void(* op_w)(fz_context *ctx, pdf_processor *proc, float linewidth)
Definition interpret.h:83
void(* op_Q)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:100
void(* op_Tz)(fz_context *ctx, pdf_processor *proc, float scale)
Definition interpret.h:135
void(* op_BT)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:129
void(* op_dquote)(fz_context *ctx, pdf_processor *proc, float aw, float ac, char *str, size_t len)
Definition interpret.h:151
void(* op_gs_begin)(fz_context *ctx, pdf_processor *proc, const char *name, pdf_obj *extgstate)
Definition interpret.h:91
void(* op_cm)(fz_context *ctx, pdf_processor *proc, float a, float b, float c, float d, float e, float f)
Definition interpret.h:101
void(* op_gs_CA)(fz_context *ctx, pdf_processor *proc, float alpha)
Definition interpret.h:94
void(* op_sc_shade)(fz_context *ctx, pdf_processor *proc, const char *name, fz_shade *shade)
Definition interpret.h:163
void(* op_TL)(fz_context *ctx, pdf_processor *proc, float leading)
Definition interpret.h:136
void(* op_m)(fz_context *ctx, pdf_processor *proc, float x, float y)
Definition interpret.h:104
void(* op_g)(fz_context *ctx, pdf_processor *proc, float g)
Definition interpret.h:168
int hidden
Definition interpret.h:206
pdf_processor * chain
Definition interpret.h:214
void(* op_sh)(fz_context *ctx, pdf_processor *proc, const char *name, fz_shade *shade)
Definition interpret.h:176
void(* op_gs_UseBlackPtComp)(fz_context *ctx, pdf_processor *proc, pdf_obj *name)
Definition interpret.h:195
void(* push_resources)(fz_context *ctx, pdf_processor *proc, pdf_obj *res)
Definition interpret.h:73
void(* op_K)(fz_context *ctx, pdf_processor *proc, float c, float m, float y, float k)
Definition interpret.h:171
void(* op_k)(fz_context *ctx, pdf_processor *proc, float c, float m, float y, float k)
Definition interpret.h:172
void(* op_BDC)(fz_context *ctx, pdf_processor *proc, const char *tag, pdf_obj *raw, pdf_obj *cooked)
Definition interpret.h:184
pdf_processor_requirements requirements
Definition interpret.h:208
void(* op_gs_BM)(fz_context *ctx, pdf_processor *proc, const char *blendmode)
Definition interpret.h:92
void(* op_Tj)(fz_context *ctx, pdf_processor *proc, char *str, size_t len)
Definition interpret.h:149
int closed
Definition interpret.h:60
void(* op_b)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:120
void(* op_SC_shade)(fz_context *ctx, pdf_processor *proc, const char *name, fz_shade *shade)
Definition interpret.h:162
void(* op_Tc)(fz_context *ctx, pdf_processor *proc, float charspace)
Definition interpret.h:133
void(* op_h)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:109
const char * usage
Definition interpret.h:205
void(* op_j)(fz_context *ctx, pdf_processor *proc, int linejoin)
Definition interpret.h:84
void(* op_TJ)(fz_context *ctx, pdf_processor *proc, pdf_obj *array)
Definition interpret.h:148
void(* op_EX)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:189
void(* op_re)(fz_context *ctx, pdf_processor *proc, float x, float y, float w, float h)
Definition interpret.h:110
void(* op_EOD)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:199
void(* op_EMC)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:185
void(* drop_processor)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:64
void(* op_fstar)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:117
void(* op_ET)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:130
void(* op_Tr)(fz_context *ctx, pdf_processor *proc, int render)
Definition interpret.h:138
void(* op_ri)(fz_context *ctx, pdf_processor *proc, const char *intent)
Definition interpret.h:88
void(* op_Tm)(fz_context *ctx, pdf_processor *proc, float a, float b, float c, float d, float e, float f)
Definition interpret.h:144
void(* op_Tf)(fz_context *ctx, pdf_processor *proc, const char *name, pdf_font_desc *font, float size)
Definition interpret.h:137
void(* op_l)(fz_context *ctx, pdf_processor *proc, float x, float y)
Definition interpret.h:105
void(* op_DP)(fz_context *ctx, pdf_processor *proc, const char *tag, pdf_obj *raw, pdf_obj *cooked)
Definition interpret.h:182
void(* op_q)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:99
void(* op_v)(fz_context *ctx, pdf_processor *proc, float x2, float y2, float x3, float y3)
Definition interpret.h:107
void(* op_Td)(fz_context *ctx, pdf_processor *proc, float tx, float ty)
Definition interpret.h:142
void(* op_CS)(fz_context *ctx, pdf_processor *proc, const char *name, fz_colorspace *cs)
Definition interpret.h:158
void(* op_c)(fz_context *ctx, pdf_processor *proc, float x1, float y1, float x2, float y2, float x3, float y3)
Definition interpret.h:106
void(* reset_processor)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:65
void(* op_d0)(fz_context *ctx, pdf_processor *proc, float wx, float wy)
Definition interpret.h:154
void(* op_TD)(fz_context *ctx, pdf_processor *proc, float tx, float ty)
Definition interpret.h:143
void(* op_Do_image)(fz_context *ctx, pdf_processor *proc, const char *name, fz_image *image)
Definition interpret.h:177
void(* op_squote)(fz_context *ctx, pdf_processor *proc, char *str, size_t len)
Definition interpret.h:150
void(* op_cs)(fz_context *ctx, pdf_processor *proc, const char *name, fz_colorspace *cs)
Definition interpret.h:159
void(* op_bstar)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:121
void(* op_BMC)(fz_context *ctx, pdf_processor *proc, const char *tag)
Definition interpret.h:183
void(* op_gs_end)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:96
void(* op_n)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:122
void(* op_END)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:202
void(* op_J)(fz_context *ctx, pdf_processor *proc, int linecap)
Definition interpret.h:85
void(* op_SC_pattern)(fz_context *ctx, pdf_processor *proc, const char *name, pdf_pattern *pat, int n, float *color)
Definition interpret.h:160
void(* op_gs_SMask)(fz_context *ctx, pdf_processor *proc, pdf_obj *smask, fz_colorspace *smask_cs, float *bc, int luminosity, pdf_obj *tr)
Definition interpret.h:95
void(* op_Tstar)(fz_context *ctx, pdf_processor *proc)
Definition interpret.h:145
Definition interpret.h:44
pdf_resource_stack * next
Definition interpret.h:45
pdf_obj * resources
Definition interpret.h:46
Definition interpret.h:380
int(* text_filter)(fz_context *ctx, void *opaque, int *ucsbuf, int ucslen, fz_matrix trm, fz_matrix ctm, fz_rect bbox, int tr, float ca, float CA)
Definition interpret.h:383
int(* culler)(fz_context *ctx, void *opaque, fz_rect bbox, fz_cull_type type)
Definition interpret.h:385
void * opaque
Definition interpret.h:381
void(* after_text_object)(fz_context *ctx, void *opaque, pdf_document *doc, pdf_processor *chain, fz_matrix ctm)
Definition interpret.h:384
Definition interpret.h:505
fz_text * clip_text
Definition interpret.h:506
fz_matrix tm
Definition interpret.h:510
pdf_font_desc * fontdesc
Definition interpret.h:516
fz_rect text_bbox
Definition interpret.h:508
float char_ty
Definition interpret.h:518
fz_rect char_bbox
Definition interpret.h:515
fz_text * text
Definition interpret.h:507
fz_matrix tlm
Definition interpret.h:509
float char_tx
Definition interpret.h:517
int gid
Definition interpret.h:514
int text_mode
Definition interpret.h:511
int cid
Definition interpret.h:513
Definition interpret.h:492
float rise
Definition interpret.h:501
float leading
Definition interpret.h:496
float size
Definition interpret.h:499
int render
Definition interpret.h:500
float char_space
Definition interpret.h:493
float word_space
Definition interpret.h:494
float scale
Definition interpret.h:495
fz_string * fontname
Definition interpret.h:498
pdf_font_desc * font
Definition interpret.h:497
Definition interpret.h:416
void * opaque
Definition interpret.h:417