PyMuPDF 1.24.11__cp38-abi3-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- PyMuPDF-1.24.11.dist-info/COPYING +1 -0
- PyMuPDF-1.24.11.dist-info/METADATA +83 -0
- PyMuPDF-1.24.11.dist-info/README.md +60 -0
- PyMuPDF-1.24.11.dist-info/RECORD +99 -0
- PyMuPDF-1.24.11.dist-info/WHEEL +4 -0
- PyMuPDF-1.24.11.dist-info/entry_points.txt +3 -0
- fitz/__init__.py +11 -0
- fitz/table.py +2 -0
- fitz/utils.py +2 -0
- pymupdf/__init__.py +22122 -0
- pymupdf/__main__.py +1146 -0
- pymupdf/_apply_pages.py +253 -0
- pymupdf/_build.py +1 -0
- pymupdf/_extra.pyd +0 -0
- pymupdf/_mupdf.pyd +0 -0
- pymupdf/extra.py +214 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/archive.h +444 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/band-writer.h +117 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/bidi.h +90 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/bitmap.h +175 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/buffer.h +250 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/color.h +427 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/compress.h +88 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/compressed-buffer.h +185 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/config.h +223 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/context.h +1006 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/crypt.h +270 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/device.h +654 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/display-list.h +142 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/document.h +1108 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/export.h +52 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/filter.h +263 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/font.h +815 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/geometry.h +818 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/getopt.h +128 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/glyph-cache.h +96 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/glyph.h +81 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/hash.h +126 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/heap-imp.h +163 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/heap.h +140 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/image.h +443 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/link.h +130 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/log.h +61 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/outline.h +228 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/output-svg.h +64 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/output.h +415 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/path.h +447 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/pixmap.h +501 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/pool.h +68 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/separation.h +138 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/shade.h +233 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/store.h +456 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/story-writer.h +209 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/story.h +232 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/stream.h +646 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/string-util.h +286 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/structured-text.h +365 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/system.h +459 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/text.h +209 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/track-usage.h +57 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/transition.h +76 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/tree.h +62 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/types.h +41 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/util.h +151 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/version.h +31 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/write-pixmap.h +499 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/writer.h +266 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/xml.h +397 -0
- pymupdf/mupdf-devel/include/mupdf/fitz.h +97 -0
- pymupdf/mupdf-devel/include/mupdf/helpers/mu-office-lib.h +666 -0
- pymupdf/mupdf-devel/include/mupdf/helpers/mu-threads.h +280 -0
- pymupdf/mupdf-devel/include/mupdf/helpers/pkcs7-openssl.h +48 -0
- pymupdf/mupdf-devel/include/mupdf/html.h +53 -0
- pymupdf/mupdf-devel/include/mupdf/memento.h +423 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/annot.h +965 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/clean.h +48 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/cmap.h +145 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/crypt.h +107 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/document.h +842 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/event.h +167 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/font.h +168 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/form.h +380 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/image-rewriter.h +78 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/interpret.h +492 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/javascript.h +43 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/name-table.h +596 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/object.h +435 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/page.h +316 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/parse.h +61 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/resource.h +133 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/xref.h +300 -0
- pymupdf/mupdf-devel/include/mupdf/pdf.h +57 -0
- pymupdf/mupdf-devel/include/mupdf/ucdn.h +452 -0
- pymupdf/mupdf-devel/lib/mupdfcpp64.lib +0 -0
- pymupdf/mupdf.py +58506 -0
- pymupdf/mupdfcpp64.dll +0 -0
- pymupdf/pymupdf.py +2 -0
- pymupdf/table.py +2355 -0
- pymupdf/utils.py +5880 -0
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
// Copyright (C) 2004-2022 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_ARCHIVE_H
|
|
24
|
+
#define MUPDF_FITZ_ARCHIVE_H
|
|
25
|
+
|
|
26
|
+
#include "mupdf/fitz/system.h"
|
|
27
|
+
#include "mupdf/fitz/context.h"
|
|
28
|
+
#include "mupdf/fitz/buffer.h"
|
|
29
|
+
#include "mupdf/fitz/stream.h"
|
|
30
|
+
#include "mupdf/fitz/tree.h"
|
|
31
|
+
|
|
32
|
+
/* PUBLIC API */
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
fz_archive:
|
|
36
|
+
|
|
37
|
+
fz_archive provides methods for accessing "archive" files.
|
|
38
|
+
An archive file is a conceptual entity that contains multiple
|
|
39
|
+
files, which can be counted, enumerated, and read.
|
|
40
|
+
|
|
41
|
+
Implementations of fz_archive based upon directories, zip
|
|
42
|
+
and tar files are included.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
typedef struct fz_archive fz_archive;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
Open a zip or tar archive
|
|
49
|
+
|
|
50
|
+
Open a file and identify its archive type based on the archive
|
|
51
|
+
signature contained inside.
|
|
52
|
+
|
|
53
|
+
filename: a path to a file as it would be given to open(2).
|
|
54
|
+
*/
|
|
55
|
+
fz_archive *fz_open_archive(fz_context *ctx, const char *filename);
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
Open zip or tar archive stream.
|
|
59
|
+
|
|
60
|
+
Open an archive using a seekable stream object rather than
|
|
61
|
+
opening a file or directory on disk.
|
|
62
|
+
*/
|
|
63
|
+
fz_archive *fz_open_archive_with_stream(fz_context *ctx, fz_stream *file);
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
Open zip or tar archive stream.
|
|
67
|
+
|
|
68
|
+
Does the same as fz_open_archive_with_stream, but will not throw
|
|
69
|
+
an error in the event of failing to recognise the format. Will
|
|
70
|
+
still throw errors in other cases though!
|
|
71
|
+
*/
|
|
72
|
+
fz_archive *fz_try_open_archive_with_stream(fz_context *ctx, fz_stream *file);
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
Open a directory as if it was an archive.
|
|
76
|
+
|
|
77
|
+
A special case where a directory is opened as if it was an
|
|
78
|
+
archive.
|
|
79
|
+
|
|
80
|
+
Note that for directories it is not possible to retrieve the
|
|
81
|
+
number of entries or list the entries. It is however possible
|
|
82
|
+
to check if the archive has a particular entry.
|
|
83
|
+
|
|
84
|
+
path: a path to a directory as it would be given to opendir(3).
|
|
85
|
+
*/
|
|
86
|
+
fz_archive *fz_open_directory(fz_context *ctx, const char *path);
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
Determine if a given path is a directory.
|
|
91
|
+
|
|
92
|
+
In the case of the path not existing, or having no access
|
|
93
|
+
we will return 0.
|
|
94
|
+
*/
|
|
95
|
+
int fz_is_directory(fz_context *ctx, const char *path);
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
Drop a reference to an archive.
|
|
99
|
+
|
|
100
|
+
When the last reference is dropped, this closes and releases
|
|
101
|
+
any memory or filehandles associated with the archive.
|
|
102
|
+
*/
|
|
103
|
+
void fz_drop_archive(fz_context *ctx, fz_archive *arch);
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
Keep a reference to an archive.
|
|
107
|
+
*/
|
|
108
|
+
fz_archive *
|
|
109
|
+
fz_keep_archive(fz_context *ctx, fz_archive *arch);
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
Return a pointer to a string describing the format of the
|
|
113
|
+
archive.
|
|
114
|
+
|
|
115
|
+
The lifetime of the string is unspecified (in current
|
|
116
|
+
implementations the string will persist until the archive
|
|
117
|
+
is closed, but this is not guaranteed).
|
|
118
|
+
*/
|
|
119
|
+
const char *fz_archive_format(fz_context *ctx, fz_archive *arch);
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
Number of entries in archive.
|
|
123
|
+
|
|
124
|
+
Will always return a value >= 0.
|
|
125
|
+
|
|
126
|
+
May throw an exception if this type of archive cannot count the
|
|
127
|
+
entries (such as a directory).
|
|
128
|
+
*/
|
|
129
|
+
int fz_count_archive_entries(fz_context *ctx, fz_archive *arch);
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
Get listed name of entry position idx.
|
|
133
|
+
|
|
134
|
+
idx: Must be a value >= 0 < return value from
|
|
135
|
+
fz_count_archive_entries. If not in range NULL will be
|
|
136
|
+
returned.
|
|
137
|
+
|
|
138
|
+
May throw an exception if this type of archive cannot list the
|
|
139
|
+
entries (such as a directory).
|
|
140
|
+
*/
|
|
141
|
+
const char *fz_list_archive_entry(fz_context *ctx, fz_archive *arch, int idx);
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
Check if entry by given name exists.
|
|
145
|
+
|
|
146
|
+
If named entry does not exist 0 will be returned, if it does
|
|
147
|
+
exist 1 is returned.
|
|
148
|
+
|
|
149
|
+
name: Entry name to look for, this must be an exact match to
|
|
150
|
+
the entry name in the archive.
|
|
151
|
+
*/
|
|
152
|
+
int fz_has_archive_entry(fz_context *ctx, fz_archive *arch, const char *name);
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
Opens an archive entry as a stream.
|
|
156
|
+
|
|
157
|
+
name: Entry name to look for, this must be an exact match to
|
|
158
|
+
the entry name in the archive.
|
|
159
|
+
|
|
160
|
+
Throws an exception if a matching entry cannot be found.
|
|
161
|
+
*/
|
|
162
|
+
fz_stream *fz_open_archive_entry(fz_context *ctx, fz_archive *arch, const char *name);
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
Opens an archive entry as a stream.
|
|
166
|
+
|
|
167
|
+
Returns NULL if a matching entry cannot be found, otherwise
|
|
168
|
+
behaves exactly as fz_open_archive_entry.
|
|
169
|
+
*/
|
|
170
|
+
fz_stream *fz_try_open_archive_entry(fz_context *ctx, fz_archive *arch, const char *name);
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
Reads all bytes in an archive entry
|
|
174
|
+
into a buffer.
|
|
175
|
+
|
|
176
|
+
name: Entry name to look for, this must be an exact match to
|
|
177
|
+
the entry name in the archive.
|
|
178
|
+
|
|
179
|
+
Throws an exception if a matching entry cannot be found.
|
|
180
|
+
*/
|
|
181
|
+
fz_buffer *fz_read_archive_entry(fz_context *ctx, fz_archive *arch, const char *name);
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
Reads all bytes in an archive entry
|
|
185
|
+
into a buffer.
|
|
186
|
+
|
|
187
|
+
name: Entry name to look for, this must be an exact match to
|
|
188
|
+
the entry name in the archive.
|
|
189
|
+
|
|
190
|
+
Returns NULL if a matching entry cannot be found. Otherwise behaves
|
|
191
|
+
the same as fz_read_archive_entry. Exceptions may be thrown.
|
|
192
|
+
*/
|
|
193
|
+
fz_buffer *fz_try_read_archive_entry(fz_context *ctx, fz_archive *arch, const char *name);
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
fz_archive: tar implementation
|
|
197
|
+
*/
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
Detect if stream object is a tar archive.
|
|
201
|
+
|
|
202
|
+
Assumes that the stream object is seekable.
|
|
203
|
+
*/
|
|
204
|
+
int fz_is_tar_archive(fz_context *ctx, fz_stream *file);
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
Detect if stream object is an archive supported by libarchive.
|
|
208
|
+
|
|
209
|
+
Assumes that the stream object is seekable.
|
|
210
|
+
*/
|
|
211
|
+
int fz_is_libarchive_archive(fz_context *ctx, fz_stream *file);
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
Detect if stream object is a cfb archive.
|
|
215
|
+
|
|
216
|
+
Assumes that the stream object is seekable.
|
|
217
|
+
*/
|
|
218
|
+
int fz_is_cfb_archive(fz_context *ctx, fz_stream *file);
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
Open a tar archive file.
|
|
222
|
+
|
|
223
|
+
An exception is thrown if the file is not a tar archive as
|
|
224
|
+
indicated by the presence of a tar signature.
|
|
225
|
+
|
|
226
|
+
filename: a path to a tar archive file as it would be given to
|
|
227
|
+
open(2).
|
|
228
|
+
*/
|
|
229
|
+
fz_archive *fz_open_tar_archive(fz_context *ctx, const char *filename);
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
Open a tar archive stream.
|
|
233
|
+
|
|
234
|
+
Open an archive using a seekable stream object rather than
|
|
235
|
+
opening a file or directory on disk.
|
|
236
|
+
|
|
237
|
+
An exception is thrown if the stream is not a tar archive as
|
|
238
|
+
indicated by the presence of a tar signature.
|
|
239
|
+
|
|
240
|
+
*/
|
|
241
|
+
fz_archive *fz_open_tar_archive_with_stream(fz_context *ctx, fz_stream *file);
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
Open an archive using libarchive.
|
|
245
|
+
|
|
246
|
+
An exception is thrown if the file is not supported by libarchive.
|
|
247
|
+
|
|
248
|
+
filename: a path to an archive file as it would be given to
|
|
249
|
+
open(2).
|
|
250
|
+
*/
|
|
251
|
+
fz_archive *fz_open_libarchive_archive(fz_context *ctx, const char *filename);
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
Open an archive using libarchive.
|
|
255
|
+
|
|
256
|
+
Open an archive using a seekable stream object rather than
|
|
257
|
+
opening a file or directory on disk.
|
|
258
|
+
|
|
259
|
+
An exception is thrown if the stream is not supported by libarchive.
|
|
260
|
+
*/
|
|
261
|
+
fz_archive *fz_open_libarchive_archive_with_stream(fz_context *ctx, fz_stream *file);
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
Open a cfb file as an archive.
|
|
265
|
+
|
|
266
|
+
An exception is thrown if the file is not recognised as a cfb.
|
|
267
|
+
|
|
268
|
+
filename: a path to an archive file as it would be given to
|
|
269
|
+
open(2).
|
|
270
|
+
*/
|
|
271
|
+
fz_archive *fz_open_cfb_archive(fz_context *ctx, const char *filename);
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
Open a cfb file as an archive.
|
|
275
|
+
|
|
276
|
+
Open an archive using a seekable stream object rather than
|
|
277
|
+
opening a file or directory on disk.
|
|
278
|
+
|
|
279
|
+
An exception is thrown if the file is not recognised as a chm.
|
|
280
|
+
*/
|
|
281
|
+
fz_archive *fz_open_cfb_archive_with_stream(fz_context *ctx, fz_stream *file);
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
fz_archive: zip implementation
|
|
285
|
+
*/
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
Detect if stream object is a zip archive.
|
|
289
|
+
|
|
290
|
+
Assumes that the stream object is seekable.
|
|
291
|
+
*/
|
|
292
|
+
int fz_is_zip_archive(fz_context *ctx, fz_stream *file);
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
Open a zip archive file.
|
|
296
|
+
|
|
297
|
+
An exception is thrown if the file is not a zip archive as
|
|
298
|
+
indicated by the presence of a zip signature.
|
|
299
|
+
|
|
300
|
+
filename: a path to a zip archive file as it would be given to
|
|
301
|
+
open(2).
|
|
302
|
+
*/
|
|
303
|
+
fz_archive *fz_open_zip_archive(fz_context *ctx, const char *path);
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
Open a zip archive stream.
|
|
307
|
+
|
|
308
|
+
Open an archive using a seekable stream object rather than
|
|
309
|
+
opening a file or directory on disk.
|
|
310
|
+
|
|
311
|
+
An exception is thrown if the stream is not a zip archive as
|
|
312
|
+
indicated by the presence of a zip signature.
|
|
313
|
+
|
|
314
|
+
*/
|
|
315
|
+
fz_archive *fz_open_zip_archive_with_stream(fz_context *ctx, fz_stream *file);
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
fz_zip_writer offers methods for creating and writing zip files.
|
|
319
|
+
It can be seen as the reverse of the fz_archive zip
|
|
320
|
+
implementation.
|
|
321
|
+
*/
|
|
322
|
+
|
|
323
|
+
typedef struct fz_zip_writer fz_zip_writer;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
Create a new zip writer that writes to a given file.
|
|
327
|
+
|
|
328
|
+
Open an archive using a seekable stream object rather than
|
|
329
|
+
opening a file or directory on disk.
|
|
330
|
+
*/
|
|
331
|
+
fz_zip_writer *fz_new_zip_writer(fz_context *ctx, const char *filename);
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
Create a new zip writer that writes to a given output stream.
|
|
335
|
+
|
|
336
|
+
Ownership of out passes in immediately upon calling this function.
|
|
337
|
+
The caller should never drop the fz_output, even if this function throws
|
|
338
|
+
an exception.
|
|
339
|
+
*/
|
|
340
|
+
fz_zip_writer *fz_new_zip_writer_with_output(fz_context *ctx, fz_output *out);
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
Given a buffer of data, (optionally) compress it, and add it to
|
|
345
|
+
the zip file with the given name.
|
|
346
|
+
*/
|
|
347
|
+
void fz_write_zip_entry(fz_context *ctx, fz_zip_writer *zip, const char *name, fz_buffer *buf, int compress);
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
Close the zip file for writing.
|
|
351
|
+
|
|
352
|
+
This flushes any pending data to the file. This can throw
|
|
353
|
+
exceptions.
|
|
354
|
+
*/
|
|
355
|
+
void fz_close_zip_writer(fz_context *ctx, fz_zip_writer *zip);
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
Drop the reference to the zipfile.
|
|
359
|
+
|
|
360
|
+
In common with other 'drop' methods, this will never throw an
|
|
361
|
+
exception.
|
|
362
|
+
*/
|
|
363
|
+
void fz_drop_zip_writer(fz_context *ctx, fz_zip_writer *zip);
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
Create an archive that holds named buffers.
|
|
367
|
+
|
|
368
|
+
tree can either be a preformed tree with fz_buffers as values,
|
|
369
|
+
or it can be NULL for an empty tree.
|
|
370
|
+
*/
|
|
371
|
+
fz_archive *fz_new_tree_archive(fz_context *ctx, fz_tree *tree);
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
Add a named buffer to an existing tree archive.
|
|
375
|
+
|
|
376
|
+
The tree will take a new reference to the buffer. Ownership
|
|
377
|
+
is not transferred.
|
|
378
|
+
*/
|
|
379
|
+
void fz_tree_archive_add_buffer(fz_context *ctx, fz_archive *arch_, const char *name, fz_buffer *buf);
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
Add a named block of data to an existing tree archive.
|
|
383
|
+
|
|
384
|
+
The data will be copied into a buffer, and so the caller
|
|
385
|
+
may free it as soon as this returns.
|
|
386
|
+
*/
|
|
387
|
+
void fz_tree_archive_add_data(fz_context *ctx, fz_archive *arch_, const char *name, const void *data, size_t size);
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
Create a new multi archive (initially empty).
|
|
391
|
+
*/
|
|
392
|
+
fz_archive *fz_new_multi_archive(fz_context *ctx);
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
Add an archive to the set of archives handled by a multi
|
|
396
|
+
archive.
|
|
397
|
+
|
|
398
|
+
If path is NULL, then the archive contents will appear at the
|
|
399
|
+
top level, otherwise, the archives contents will appear prefixed
|
|
400
|
+
by path.
|
|
401
|
+
*/
|
|
402
|
+
void fz_mount_multi_archive(fz_context *ctx, fz_archive *arch_, fz_archive *sub, const char *path);
|
|
403
|
+
|
|
404
|
+
typedef int (fz_recognize_archive_fn)(fz_context *, fz_stream *);
|
|
405
|
+
typedef fz_archive *(fz_open_archive_fn)(fz_context *, fz_stream *);
|
|
406
|
+
|
|
407
|
+
typedef struct
|
|
408
|
+
{
|
|
409
|
+
fz_recognize_archive_fn *recognize;
|
|
410
|
+
fz_open_archive_fn *open;
|
|
411
|
+
}
|
|
412
|
+
fz_archive_handler;
|
|
413
|
+
|
|
414
|
+
FZ_DATA extern const fz_archive_handler fz_libarchive_archive_handler;
|
|
415
|
+
|
|
416
|
+
void fz_register_archive_handler(fz_context *ctx, const fz_archive_handler *handler);
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
Implementation details: Subject to change.
|
|
420
|
+
*/
|
|
421
|
+
|
|
422
|
+
struct fz_archive
|
|
423
|
+
{
|
|
424
|
+
int refs;
|
|
425
|
+
fz_stream *file;
|
|
426
|
+
|
|
427
|
+
const char *format;
|
|
428
|
+
|
|
429
|
+
void (*drop_archive)(fz_context *ctx, fz_archive *arch);
|
|
430
|
+
int (*count_entries)(fz_context *ctx, fz_archive *arch);
|
|
431
|
+
const char *(*list_entry)(fz_context *ctx, fz_archive *arch, int idx);
|
|
432
|
+
int (*has_entry)(fz_context *ctx, fz_archive *arch, const char *name);
|
|
433
|
+
fz_buffer *(*read_entry)(fz_context *ctx, fz_archive *arch, const char *name);
|
|
434
|
+
fz_stream *(*open_entry)(fz_context *ctx, fz_archive *arch, const char *name);
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
fz_archive *fz_new_archive_of_size(fz_context *ctx, fz_stream *file, int size);
|
|
438
|
+
|
|
439
|
+
#define fz_new_derived_archive(C,F,M) \
|
|
440
|
+
((M*)Memento_label(fz_new_archive_of_size(C, F, sizeof(M)), #M))
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
#endif
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// Copyright (C) 2004-2021 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_BAND_WRITER_H
|
|
24
|
+
#define MUPDF_FITZ_BAND_WRITER_H
|
|
25
|
+
|
|
26
|
+
#include "mupdf/fitz/system.h"
|
|
27
|
+
#include "mupdf/fitz/context.h"
|
|
28
|
+
#include "mupdf/fitz/output.h"
|
|
29
|
+
#include "mupdf/fitz/color.h"
|
|
30
|
+
#include "mupdf/fitz/separation.h"
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
fz_band_writer
|
|
34
|
+
*/
|
|
35
|
+
typedef struct fz_band_writer fz_band_writer;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
Cause a band writer to write the header for
|
|
39
|
+
a banded image with the given properties/dimensions etc. This
|
|
40
|
+
also configures the bandwriter for the format of the data to be
|
|
41
|
+
passed in future calls.
|
|
42
|
+
|
|
43
|
+
w, h: Width and Height of the entire page.
|
|
44
|
+
|
|
45
|
+
n: Number of components (including spots and alphas).
|
|
46
|
+
|
|
47
|
+
alpha: Number of alpha components.
|
|
48
|
+
|
|
49
|
+
xres, yres: X and Y resolutions in dpi.
|
|
50
|
+
|
|
51
|
+
cs: Colorspace (NULL for bitmaps)
|
|
52
|
+
|
|
53
|
+
seps: Separation details (or NULL).
|
|
54
|
+
*/
|
|
55
|
+
void fz_write_header(fz_context *ctx, fz_band_writer *writer, int w, int h, int n, int alpha, int xres, int yres, int pagenum, fz_colorspace *cs, fz_separations *seps);
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
Cause a band writer to write the next band
|
|
59
|
+
of data for an image.
|
|
60
|
+
|
|
61
|
+
stride: The byte offset from the first byte of the data
|
|
62
|
+
for a pixel to the first byte of the data for the same pixel
|
|
63
|
+
on the row below.
|
|
64
|
+
|
|
65
|
+
band_height: The number of lines in this band.
|
|
66
|
+
|
|
67
|
+
samples: Pointer to first byte of the data.
|
|
68
|
+
*/
|
|
69
|
+
void fz_write_band(fz_context *ctx, fz_band_writer *writer, int stride, int band_height, const unsigned char *samples);
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
Finishes up the output and closes the band writer. After this
|
|
73
|
+
call no more headers or bands may be written.
|
|
74
|
+
*/
|
|
75
|
+
void fz_close_band_writer(fz_context *ctx, fz_band_writer *writer);
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
Drop the reference to the band writer, causing it to be
|
|
79
|
+
destroyed.
|
|
80
|
+
|
|
81
|
+
Never throws an exception.
|
|
82
|
+
*/
|
|
83
|
+
void fz_drop_band_writer(fz_context *ctx, fz_band_writer *writer);
|
|
84
|
+
|
|
85
|
+
/* Implementation details: subject to change. */
|
|
86
|
+
|
|
87
|
+
typedef void (fz_write_header_fn)(fz_context *ctx, fz_band_writer *writer, fz_colorspace *cs);
|
|
88
|
+
typedef void (fz_write_band_fn)(fz_context *ctx, fz_band_writer *writer, int stride, int band_start, int band_height, const unsigned char *samples);
|
|
89
|
+
typedef void (fz_write_trailer_fn)(fz_context *ctx, fz_band_writer *writer);
|
|
90
|
+
typedef void (fz_close_band_writer_fn)(fz_context *ctx, fz_band_writer *writer);
|
|
91
|
+
typedef void (fz_drop_band_writer_fn)(fz_context *ctx, fz_band_writer *writer);
|
|
92
|
+
|
|
93
|
+
struct fz_band_writer
|
|
94
|
+
{
|
|
95
|
+
fz_drop_band_writer_fn *drop;
|
|
96
|
+
fz_close_band_writer_fn *close;
|
|
97
|
+
fz_write_header_fn *header;
|
|
98
|
+
fz_write_band_fn *band;
|
|
99
|
+
fz_write_trailer_fn *trailer;
|
|
100
|
+
fz_output *out;
|
|
101
|
+
int w;
|
|
102
|
+
int h;
|
|
103
|
+
int n;
|
|
104
|
+
int s;
|
|
105
|
+
int alpha;
|
|
106
|
+
int xres;
|
|
107
|
+
int yres;
|
|
108
|
+
int pagenum;
|
|
109
|
+
int line;
|
|
110
|
+
fz_separations *seps;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
fz_band_writer *fz_new_band_writer_of_size(fz_context *ctx, size_t size, fz_output *out);
|
|
114
|
+
#define fz_new_band_writer(C,M,O) ((M *)Memento_label(fz_new_band_writer_of_size(ctx, sizeof(M), O), #M))
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
#endif
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Bidirectional text processing.
|
|
3
|
+
|
|
4
|
+
Derived from the SmartOffice code, which is itself derived
|
|
5
|
+
from the example unicode standard code. Original copyright
|
|
6
|
+
messages follow:
|
|
7
|
+
|
|
8
|
+
Copyright (C) Picsel, 2004-2008. All Rights Reserved.
|
|
9
|
+
|
|
10
|
+
Processes Unicode text by arranging the characters into an order
|
|
11
|
+
suitable for display. E.g. Hebrew text will be arranged from
|
|
12
|
+
right-to-left and any English within the text will remain in the
|
|
13
|
+
left-to-right order.
|
|
14
|
+
|
|
15
|
+
This is an implementation of the Unicode Bidirectional Algorithm
|
|
16
|
+
which can be found here: http://www.unicode.org/reports/tr9/ and
|
|
17
|
+
is based on the reference implementation found on Unicode.org.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#ifndef FITZ_BIDI_H
|
|
21
|
+
#define FITZ_BIDI_H
|
|
22
|
+
|
|
23
|
+
#include "mupdf/fitz/system.h"
|
|
24
|
+
#include "mupdf/fitz/context.h"
|
|
25
|
+
|
|
26
|
+
/* Implementation details: subject to change. */
|
|
27
|
+
|
|
28
|
+
typedef enum
|
|
29
|
+
{
|
|
30
|
+
FZ_BIDI_LTR = 0,
|
|
31
|
+
FZ_BIDI_RTL = 1,
|
|
32
|
+
FZ_BIDI_NEUTRAL = 2
|
|
33
|
+
}
|
|
34
|
+
fz_bidi_direction;
|
|
35
|
+
|
|
36
|
+
typedef enum
|
|
37
|
+
{
|
|
38
|
+
FZ_BIDI_CLASSIFY_WHITE_SPACE = 1,
|
|
39
|
+
FZ_BIDI_REPLACE_TAB = 2
|
|
40
|
+
}
|
|
41
|
+
fz_bidi_flags;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
Prototype for callback function supplied to fz_bidi_fragment_text.
|
|
45
|
+
|
|
46
|
+
@param fragment first character in fragment
|
|
47
|
+
@param fragmentLen number of characters in fragment
|
|
48
|
+
@param bidiLevel The bidirectional level for this text.
|
|
49
|
+
The bottom bit will be set iff block
|
|
50
|
+
should concatenate with other blocks as
|
|
51
|
+
right-to-left
|
|
52
|
+
@param script the script in use for this fragment (other
|
|
53
|
+
than common or inherited)
|
|
54
|
+
@param arg data from caller of Bidi_fragmentText
|
|
55
|
+
*/
|
|
56
|
+
typedef void (fz_bidi_fragment_fn)(const uint32_t *fragment,
|
|
57
|
+
size_t fragmentLen,
|
|
58
|
+
int bidiLevel,
|
|
59
|
+
int script,
|
|
60
|
+
void *arg);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
Partitions the given Unicode sequence into one or more
|
|
64
|
+
unidirectional fragments and invokes the given callback
|
|
65
|
+
function for each fragment.
|
|
66
|
+
|
|
67
|
+
For example, if directionality of text is:
|
|
68
|
+
0123456789
|
|
69
|
+
rrlllrrrrr,
|
|
70
|
+
we'll invoke callback with:
|
|
71
|
+
&text[0], length == 2
|
|
72
|
+
&text[2], length == 3
|
|
73
|
+
&text[5], length == 5
|
|
74
|
+
|
|
75
|
+
@param[in] text start of Unicode sequence
|
|
76
|
+
@param[in] textlen number of Unicodes to analyse
|
|
77
|
+
@param[in] baseDir direction of paragraph (specify FZ_BIDI_NEUTRAL to force auto-detection)
|
|
78
|
+
@param[in] callback function to be called for each fragment
|
|
79
|
+
@param[in] arg data to be passed to the callback function
|
|
80
|
+
@param[in] flags flags to control operation (see fz_bidi_flags above)
|
|
81
|
+
*/
|
|
82
|
+
void fz_bidi_fragment_text(fz_context *ctx,
|
|
83
|
+
const uint32_t *text,
|
|
84
|
+
size_t textlen,
|
|
85
|
+
fz_bidi_direction *baseDir,
|
|
86
|
+
fz_bidi_fragment_fn *callback,
|
|
87
|
+
void *arg,
|
|
88
|
+
int flags);
|
|
89
|
+
|
|
90
|
+
#endif
|