mupdf
Loading...
Searching...
No Matches
util.h
Go to the documentation of this file.
1// Copyright (C) 2004-2024 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 MUPDF_FITZ_UTIL_H
24#define MUPDF_FITZ_UTIL_H
25
26#include "mupdf/fitz/system.h"
27#include "mupdf/fitz/context.h"
28#include "mupdf/fitz/geometry.h"
29#include "mupdf/fitz/document.h"
30#include "mupdf/fitz/pixmap.h"
32#include "mupdf/fitz/buffer.h"
33#include "mupdf/fitz/xml.h"
34#include "mupdf/fitz/archive.h"
36
44
51
60
67
77
79
90
94typedef enum
95{
96 /* ALL: Flatten the text completely. All gaps between words/
97 * paragraphs/lines are expressed as a single space. */
99
100 /* KEEP_LINES: Keep line splits as \n. */
102
103 /* KEEP_PARAGRAPHS: Keep paragraph splits. If used without
104 * KEEP_LINES, paragraphs will appear as \n. If used with
105 * KEEP_LINES, paragraphs will appear as \n\n. */
107
108 /* KEEP_HYPHENS: Do not join hyphenated lines. */
111
117
123
130
137
143int fz_search_page(fz_context *ctx, fz_page *page, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max);
144int fz_search_page_number(fz_context *ctx, fz_document *doc, int number, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max);
145int fz_search_chapter_page_number(fz_context *ctx, fz_document *doc, int chapter, int page, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max);
146int fz_search_display_list(fz_context *ctx, fz_display_list *list, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max);
147int fz_match_page(fz_context *ctx, fz_page *page, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max, fz_search_options options);
148int fz_match_page_number(fz_context *ctx, fz_document *doc, int number, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max, fz_search_options options);
149int fz_match_chapter_page_number(fz_context *ctx, fz_document *doc, int chapter, int page, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max, fz_search_options options);
150int fz_match_display_list(fz_context *ctx, fz_display_list *list, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max, fz_search_options options);
151
155int fz_search_page_cb(fz_context *ctx, fz_page *page, const char *needle, fz_search_callback_fn *cb, void *opaque);
156int fz_search_page_number_cb(fz_context *ctx, fz_document *doc, int number, const char *needle, fz_search_callback_fn *cb, void *opaque);
157int fz_search_chapter_page_number_cb(fz_context *ctx, fz_document *doc, int chapter, int page, const char *needle, fz_search_callback_fn *cb, void *opaque);
158int fz_search_display_list_cb(fz_context *ctx, fz_display_list *list, const char *needle, fz_search_callback_fn *cb, void *opaque);
159int fz_match_page_cb(fz_context *ctx, fz_page *page, const char *needle, fz_match_callback_fn *cb, void *opaque, fz_search_options options);
160int fz_match_page_number_cb(fz_context *ctx, fz_document *doc, int number, const char *needle, fz_match_callback_fn *cb, void *opaque, fz_search_options options);
161int fz_match_chapter_page_number_cb(fz_context *ctx, fz_document *doc, int chapter, int page, const char *needle, fz_match_callback_fn *cb, void *opaque, fz_search_options options);
162int fz_match_display_list_cb(fz_context *ctx, fz_display_list *list, const char *needle, fz_match_callback_fn *cb, void *opaque, fz_search_options options);
163
167fz_display_list *fz_new_display_list_from_svg(fz_context *ctx, fz_buffer *buf, const char *base_uri, fz_archive *dir, float *w, float *h);
168
172fz_image *fz_new_image_from_svg(fz_context *ctx, fz_buffer *buf, const char *base_uri, fz_archive *dir);
173
177fz_display_list *fz_new_display_list_from_svg_xml(fz_context *ctx, fz_xml_doc *xmldoc, fz_xml *xml, const char *base_uri, fz_archive *dir, float *w, float *h);
178
182fz_image *fz_new_image_from_svg_xml(fz_context *ctx, fz_xml_doc *xmldoc, fz_xml *xml, const char *base_uri, fz_archive *dir);
183
191
197
205fz_buffer *fz_new_buffer_from_page_with_format(fz_context *ctx, fz_page *page, const char *format, const char *options, fz_matrix transform, fz_cookie *cookie);
206
210fz_pixmap *fz_new_pixmap_from_page_number_culling_text(fz_context *ctx, fz_document *doc, int number, fz_matrix ctm, fz_colorspace *cs, int alpha, int n, const fz_rect *rects);
213
217
218fz_pixmap *fz_new_pixmap_from_page_number_culling_text_etc(fz_context *ctx, fz_document *doc, int number, fz_matrix ctm, fz_colorspace *cs, int alpha, int n, const fz_rect *rects, float borders);
219fz_pixmap *fz_new_pixmap_from_page_culling_text_etc(fz_context *ctx, fz_page *page, fz_matrix ctm, fz_colorspace *cs, int alpha, int n, const fz_rect *rects, float borders);
220fz_pixmap *fz_new_pixmap_from_display_list_culling_text_etc(fz_context *ctx, fz_display_list *list, fz_matrix ctm, fz_colorspace *cs, int alpha, int n, const fz_rect *rects, float borders);
221
222#endif
struct fz_display_list fz_display_list
Definition display-list.h:47
struct fz_separations fz_separations
Definition separation.h:43
Definition archive.h:429
Definition buffer.h:41
Definition color.h:417
Definition context.h:886
Definition device.h:575
Definition document.h:1080
Definition image.h:351
Definition geometry.h:388
Definition output.h:111
Definition document.h:1044
Definition pixmap.h:432
Definition geometry.h:782
Definition geometry.h:231
Definition structured-text.h:724
Definition structured-text.h:344
Definition structured-text.h:1026
fz_search_options
Definition structured-text.h:982
int fz_match_callback_fn(fz_context *ctx, void *opaque, int num_quads, fz_quad *hit_bbox, int chapter, int page)
Definition structured-text.h:670
int fz_search_callback_fn(fz_context *ctx, void *opaque, int num_quads, fz_quad *hit_bbox)
Definition structured-text.h:660
fz_pixmap * fz_fill_pixmap_from_display_list(fz_context *ctx, fz_display_list *list, fz_matrix ctm, fz_pixmap *pix)
fz_image * fz_new_image_from_svg(fz_context *ctx, fz_buffer *buf, const char *base_uri, fz_archive *dir)
int fz_match_chapter_page_number_cb(fz_context *ctx, fz_document *doc, int chapter, int page, const char *needle, fz_match_callback_fn *cb, void *opaque, fz_search_options options)
int fz_search_page_number(fz_context *ctx, fz_document *doc, int number, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max)
fz_pixmap * fz_new_pixmap_from_culled_page(fz_context *ctx, fz_page *page, fz_matrix ctm, fz_colorspace *cs, int alpha, const fz_culling_options *opts)
fz_buffer * fz_new_buffer_from_flattened_display_list(fz_context *ctx, fz_display_list *list, const fz_stext_options *options, fz_text_flatten flatten)
fz_text_flatten
Definition util.h:95
@ FZ_TEXT_FLATTEN_KEEP_LINES
Definition util.h:101
@ FZ_TEXT_FLATTEN_KEEP_HYPHENS
Definition util.h:109
@ FZ_TEXT_FLATTEN_ALL
Definition util.h:98
@ FZ_TEXT_FLATTEN_KEEP_PARAGRAPHS
Definition util.h:106
fz_image * fz_new_image_from_svg_xml(fz_context *ctx, fz_xml_doc *xmldoc, fz_xml *xml, const char *base_uri, fz_archive *dir)
fz_pixmap * fz_new_pixmap_from_page_number_with_separations(fz_context *ctx, fz_document *doc, int number, fz_matrix ctm, fz_colorspace *cs, fz_separations *seps, int alpha)
fz_stext_page * fz_new_stext_page_from_page_with_cookie(fz_context *ctx, fz_page *page, const fz_stext_options *options, fz_cookie *cookie)
int fz_search_page_number_cb(fz_context *ctx, fz_document *doc, int number, const char *needle, fz_search_callback_fn *cb, void *opaque)
fz_buffer * fz_new_buffer_from_flattened_stext_page(fz_context *ctx, fz_stext_page *text, fz_text_flatten flatten, fz_stext_position **map)
int fz_search_page(fz_context *ctx, fz_page *page, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max)
fz_stext_page * fz_new_stext_page_from_page(fz_context *ctx, fz_page *page, const fz_stext_options *options)
fz_display_list * fz_new_display_list_from_svg(fz_context *ctx, fz_buffer *buf, const char *base_uri, fz_archive *dir, float *w, float *h)
fz_stext_page * fz_new_stext_page_from_display_list(fz_context *ctx, fz_display_list *list, const fz_stext_options *options)
fz_display_list * fz_new_display_list_from_page_contents(fz_context *ctx, fz_page *page)
fz_document * fz_new_xhtml_document_from_document(fz_context *ctx, fz_document *old_doc, const fz_stext_options *opts)
fz_buffer * fz_new_buffer_from_page_with_format(fz_context *ctx, fz_page *page, const char *format, const char *options, fz_matrix transform, fz_cookie *cookie)
fz_pixmap * fz_new_pixmap_from_page_with_separations(fz_context *ctx, fz_page *page, fz_matrix ctm, fz_colorspace *cs, fz_separations *seps, int alpha)
int fz_match_page_cb(fz_context *ctx, fz_page *page, const char *needle, fz_match_callback_fn *cb, void *opaque, fz_search_options options)
fz_buffer * fz_new_buffer_from_stext_page(fz_context *ctx, fz_stext_page *text)
int fz_match_page_number_cb(fz_context *ctx, fz_document *doc, int number, const char *needle, fz_match_callback_fn *cb, void *opaque, fz_search_options options)
int fz_search_chapter_page_number_cb(fz_context *ctx, fz_document *doc, int chapter, int page, const char *needle, fz_search_callback_fn *cb, void *opaque)
int fz_match_display_list(fz_context *ctx, fz_display_list *list, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max, fz_search_options options)
fz_display_list * fz_new_display_list_from_page(fz_context *ctx, fz_page *page)
int fz_search_display_list(fz_context *ctx, fz_display_list *list, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max)
fz_buffer * fz_new_buffer_from_page_number(fz_context *ctx, fz_document *doc, int number, const fz_stext_options *options)
fz_pixmap * fz_new_pixmap_from_page_contents_with_separations(fz_context *ctx, fz_page *page, fz_matrix ctm, fz_colorspace *cs, fz_separations *seps, int alpha)
fz_pixmap * fz_new_pixmap_from_page_culling_text_etc(fz_context *ctx, fz_page *page, fz_matrix ctm, fz_colorspace *cs, int alpha, int n, const fz_rect *rects, float borders)
fz_pixmap * fz_new_pixmap_from_display_list_culling_text_etc(fz_context *ctx, fz_display_list *list, fz_matrix ctm, fz_colorspace *cs, int alpha, int n, const fz_rect *rects, float borders)
int fz_match_page_number(fz_context *ctx, fz_document *doc, int number, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max, fz_search_options options)
fz_stext_page * fz_new_stext_page_from_chapter_page_number(fz_context *ctx, fz_document *doc, int chapter, int number, const fz_stext_options *options)
fz_buffer * fz_new_buffer_from_display_list(fz_context *ctx, fz_display_list *list, const fz_stext_options *options)
fz_buffer * fz_new_buffer_from_page(fz_context *ctx, fz_page *page, const fz_stext_options *options)
fz_pixmap * fz_new_pixmap_from_page_number_culling_text(fz_context *ctx, fz_document *doc, int number, fz_matrix ctm, fz_colorspace *cs, int alpha, int n, const fz_rect *rects)
fz_pixmap * fz_new_pixmap_from_page_contents(fz_context *ctx, fz_page *page, fz_matrix ctm, fz_colorspace *cs, int alpha)
int fz_search_chapter_page_number(fz_context *ctx, fz_document *doc, int chapter, int page, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max)
fz_buffer * fz_new_buffer_from_flattened_page_number(fz_context *ctx, fz_document *doc, int number, const fz_stext_options *options, fz_text_flatten flatten)
int fz_match_display_list_cb(fz_context *ctx, fz_display_list *list, const char *needle, fz_match_callback_fn *cb, void *opaque, fz_search_options options)
fz_display_list * fz_new_display_list_from_page_number(fz_context *ctx, fz_document *doc, int number)
fz_display_list * fz_new_display_list_from_svg_xml(fz_context *ctx, fz_xml_doc *xmldoc, fz_xml *xml, const char *base_uri, fz_archive *dir, float *w, float *h)
void fz_write_pixmap_as_data_uri(fz_context *ctx, fz_output *out, fz_pixmap *pixmap)
fz_pixmap * fz_new_pixmap_from_display_list_with_separations(fz_context *ctx, fz_display_list *list, fz_matrix ctm, fz_colorspace *cs, fz_separations *seps, int alpha)
fz_buffer * fz_new_buffer_from_flattened_page(fz_context *ctx, fz_page *page, const fz_stext_options *options, fz_text_flatten flatten)
void fz_write_image_as_data_uri(fz_context *ctx, fz_output *out, fz_image *image)
int fz_match_page(fz_context *ctx, fz_page *page, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max, fz_search_options options)
fz_pixmap * fz_new_pixmap_from_culled_display_list(fz_context *ctx, fz_display_list *list, fz_matrix ctm, fz_colorspace *cs, int alpha, const fz_culling_options *opts)
void fz_append_pixmap_as_data_uri(fz_context *ctx, fz_buffer *out, fz_pixmap *pixmap)
fz_pixmap * fz_new_pixmap_from_page_number(fz_context *ctx, fz_document *doc, int number, fz_matrix ctm, fz_colorspace *cs, int alpha)
fz_pixmap * fz_new_pixmap_from_display_list(fz_context *ctx, fz_display_list *list, fz_matrix ctm, fz_colorspace *cs, int alpha)
fz_stext_page * fz_new_stext_page_from_page_number(fz_context *ctx, fz_document *doc, int number, const fz_stext_options *options)
void fz_append_image_as_data_uri(fz_context *ctx, fz_buffer *out, fz_image *image)
fz_pixmap * fz_new_pixmap_from_culled_page_number(fz_context *ctx, fz_document *doc, int number, fz_matrix ctm, fz_colorspace *cs, int alpha, const fz_culling_options *opts)
fz_pixmap * fz_new_pixmap_from_display_list_culling_text(fz_context *ctx, fz_display_list *list, fz_matrix ctm, fz_colorspace *cs, int alpha, int n, const fz_rect *rects)
fz_pixmap * fz_new_pixmap_from_page_number_culling_text_etc(fz_context *ctx, fz_document *doc, int number, fz_matrix ctm, fz_colorspace *cs, int alpha, int n, const fz_rect *rects, float borders)
fz_pixmap * fz_new_pixmap_from_page_culling_text(fz_context *ctx, fz_page *page, fz_matrix ctm, fz_colorspace *cs, int alpha, int n, const fz_rect *rects)
fz_pixmap * fz_new_pixmap_from_page(fz_context *ctx, fz_page *page, fz_matrix ctm, fz_colorspace *cs, int alpha)
int fz_search_page_cb(fz_context *ctx, fz_page *page, const char *needle, fz_search_callback_fn *cb, void *opaque)
int fz_search_display_list_cb(fz_context *ctx, fz_display_list *list, const char *needle, fz_search_callback_fn *cb, void *opaque)
int fz_match_chapter_page_number(fz_context *ctx, fz_document *doc, int chapter, int page, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max, fz_search_options options)
fz_xml fz_xml_doc
Definition xml.h:39
struct fz_xml fz_xml
Definition xml.h:36