PyMuPDF 1.26.6__cp310-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.
- fitz/__init__.py +13 -0
- fitz/table.py +2 -0
- fitz/utils.py +2 -0
- pymupdf/__init__.py +25899 -0
- pymupdf/__main__.py +1140 -0
- pymupdf/_apply_pages.py +253 -0
- pymupdf/_build.py +8 -0
- pymupdf/_extra.pyd +0 -0
- pymupdf/_mupdf.pyd +0 -0
- pymupdf/_wxcolors.py +562 -0
- pymupdf/extra.py +220 -0
- pymupdf/mupdf-devel/include/mupdf/classes.h +19999 -0
- pymupdf/mupdf-devel/include/mupdf/classes2.h +12244 -0
- pymupdf/mupdf-devel/include/mupdf/exceptions.h +118 -0
- pymupdf/mupdf-devel/include/mupdf/extra.h +189 -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/barcode.h +138 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/bidi.h +90 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/bitmap.h +188 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/buffer.h +250 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/color.h +433 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/compress.h +132 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/compressed-buffer.h +194 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/config.h +302 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/context.h +1064 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/crypt.h +270 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/deskew.h +46 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/device.h +652 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/display-list.h +142 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/document.h +1103 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/export.h +52 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/filter.h +269 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/font.h +858 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/geometry.h +885 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/getopt.h +134 -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 +190 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/heap.h +143 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/image.h +451 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/json.h +98 -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 +254 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/output-svg.h +64 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/output.h +448 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/path.h +477 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/pixmap.h +516 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/pool.h +102 -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 +465 -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 +335 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/structured-text.h +924 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/system.h +495 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/text.h +210 -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 +159 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/version.h +31 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/write-pixmap.h +507 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/writer.h +269 -0
- pymupdf/mupdf-devel/include/mupdf/fitz/xml.h +435 -0
- pymupdf/mupdf-devel/include/mupdf/fitz.h +101 -0
- pymupdf/mupdf-devel/include/mupdf/functions.h +13819 -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/internal.h +29 -0
- pymupdf/mupdf-devel/include/mupdf/memento.h +425 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/annot.h +1015 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/clean.h +68 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/cmap.h +145 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/crypt.h +108 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/document.h +902 -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 +381 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/image-rewriter.h +78 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/interpret.h +518 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/javascript.h +43 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/name-table.h +621 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/object.h +445 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/page.h +327 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/parse.h +61 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/recolor.h +49 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/resource.h +144 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/xref.h +300 -0
- pymupdf/mupdf-devel/include/mupdf/pdf/zugferd.h +49 -0
- pymupdf/mupdf-devel/include/mupdf/pdf.h +59 -0
- pymupdf/mupdf-devel/include/mupdf/ucdn.h +464 -0
- pymupdf/mupdf-devel/lib/libmuthreads.lib +0 -0
- pymupdf/mupdf-devel/lib/mupdfcpp64.lib +0 -0
- pymupdf/mupdf.py +63667 -0
- pymupdf/mupdfcpp64.dll +0 -0
- pymupdf/pymupdf.py +2 -0
- pymupdf/table.py +2697 -0
- pymupdf/utils.py +1169 -0
- pymupdf-1.26.6.dist-info/COPYING +1 -0
- pymupdf-1.26.6.dist-info/METADATA +83 -0
- pymupdf-1.26.6.dist-info/README.md +60 -0
- pymupdf-1.26.6.dist-info/RECORD +112 -0
- pymupdf-1.26.6.dist-info/WHEEL +4 -0
- pymupdf-1.26.6.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,300 @@
|
|
|
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 MUPDF_PDF_XREF_H
|
|
24
|
+
#define MUPDF_PDF_XREF_H
|
|
25
|
+
|
|
26
|
+
#include "mupdf/pdf/document.h"
|
|
27
|
+
|
|
28
|
+
/*
|
|
29
|
+
Allocate a slot in the xref table and return a fresh unused object number.
|
|
30
|
+
*/
|
|
31
|
+
int pdf_create_object(fz_context *ctx, pdf_document *doc);
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
Remove object from xref table, marking the slot as free.
|
|
35
|
+
*/
|
|
36
|
+
void pdf_delete_object(fz_context *ctx, pdf_document *doc, int num);
|
|
37
|
+
|
|
38
|
+
/*
|
|
39
|
+
Replace object in xref table with the passed in object.
|
|
40
|
+
*/
|
|
41
|
+
void pdf_update_object(fz_context *ctx, pdf_document *doc, int num, pdf_obj *obj);
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
Replace stream contents for object in xref table with the passed in buffer.
|
|
45
|
+
|
|
46
|
+
The buffer contents must match the /Filter setting if 'compressed' is true.
|
|
47
|
+
If 'compressed' is false, the /Filter and /DecodeParms entries are deleted.
|
|
48
|
+
The /Length entry is updated.
|
|
49
|
+
*/
|
|
50
|
+
void pdf_update_stream(fz_context *ctx, pdf_document *doc, pdf_obj *ref, fz_buffer *buf, int compressed);
|
|
51
|
+
|
|
52
|
+
/*
|
|
53
|
+
Return true if 'obj' is an indirect reference to an object that is held
|
|
54
|
+
by the "local" xref section.
|
|
55
|
+
*/
|
|
56
|
+
int pdf_is_local_object(fz_context *ctx, pdf_document *doc, pdf_obj *obj);
|
|
57
|
+
|
|
58
|
+
pdf_obj *pdf_add_object(fz_context *ctx, pdf_document *doc, pdf_obj *obj);
|
|
59
|
+
pdf_obj *pdf_add_object_drop(fz_context *ctx, pdf_document *doc, pdf_obj *obj);
|
|
60
|
+
pdf_obj *pdf_add_stream(fz_context *ctx, pdf_document *doc, fz_buffer *buf, pdf_obj *obj, int compressed);
|
|
61
|
+
|
|
62
|
+
pdf_obj *pdf_add_new_dict(fz_context *ctx, pdf_document *doc, int initial);
|
|
63
|
+
pdf_obj *pdf_add_new_array(fz_context *ctx, pdf_document *doc, int initial);
|
|
64
|
+
|
|
65
|
+
typedef struct
|
|
66
|
+
{
|
|
67
|
+
char type; /* 0=unset (f)ree i(n)use (o)bjstm */
|
|
68
|
+
unsigned char marked; /* marked to keep alive with pdf_mark_xref */
|
|
69
|
+
unsigned short gen; /* generation / objstm index */
|
|
70
|
+
int num; /* original object number (for decryption after renumbering) */
|
|
71
|
+
int64_t ofs; /* file offset / objstm object number */
|
|
72
|
+
int64_t stm_ofs; /* on-disk stream */
|
|
73
|
+
fz_buffer *stm_buf; /* in-memory stream (for updated objects) */
|
|
74
|
+
pdf_obj *obj; /* stored/cached object */
|
|
75
|
+
} pdf_xref_entry;
|
|
76
|
+
|
|
77
|
+
typedef struct pdf_xref_subsec
|
|
78
|
+
{
|
|
79
|
+
struct pdf_xref_subsec *next;
|
|
80
|
+
int len;
|
|
81
|
+
int start;
|
|
82
|
+
pdf_xref_entry *table;
|
|
83
|
+
} pdf_xref_subsec;
|
|
84
|
+
|
|
85
|
+
struct pdf_xref
|
|
86
|
+
{
|
|
87
|
+
int num_objects;
|
|
88
|
+
pdf_xref_subsec *subsec;
|
|
89
|
+
pdf_obj *trailer;
|
|
90
|
+
pdf_obj *pre_repair_trailer;
|
|
91
|
+
pdf_unsaved_sig *unsaved_sigs;
|
|
92
|
+
pdf_unsaved_sig **unsaved_sigs_end;
|
|
93
|
+
int64_t end_ofs; /* file offset to end of xref */
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
Retrieve the pdf_xref_entry for a given object.
|
|
98
|
+
|
|
99
|
+
This can cause xref reorganisations (solidifications etc) due to
|
|
100
|
+
repairs, so all held pdf_xref_entries should be considered
|
|
101
|
+
invalid after this call (other than the returned one).
|
|
102
|
+
*/
|
|
103
|
+
pdf_xref_entry *pdf_cache_object(fz_context *ctx, pdf_document *doc, int num);
|
|
104
|
+
|
|
105
|
+
int pdf_object_exists(fz_context *ctx, pdf_document *doc, int num);
|
|
106
|
+
|
|
107
|
+
int pdf_count_objects(fz_context *ctx, pdf_document *doc);
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
Resolve an indirect object (or chain of objects).
|
|
111
|
+
|
|
112
|
+
This can cause xref reorganisations (solidifications etc) due to
|
|
113
|
+
repairs, so all held pdf_xref_entries should be considered
|
|
114
|
+
invalid after this call (other than the returned one).
|
|
115
|
+
*/
|
|
116
|
+
pdf_obj *pdf_resolve_indirect(fz_context *ctx, pdf_obj *ref);
|
|
117
|
+
pdf_obj *pdf_resolve_indirect_chain(fz_context *ctx, pdf_obj *ref);
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
Load a given object.
|
|
121
|
+
|
|
122
|
+
This can cause xref reorganisations (solidifications etc) due to
|
|
123
|
+
repairs, so all held pdf_xref_entries should be considered
|
|
124
|
+
invalid after this call (other than the returned one).
|
|
125
|
+
*/
|
|
126
|
+
pdf_obj *pdf_load_object(fz_context *ctx, pdf_document *doc, int num);
|
|
127
|
+
pdf_obj *pdf_load_unencrypted_object(fz_context *ctx, pdf_document *doc, int num);
|
|
128
|
+
|
|
129
|
+
/*
|
|
130
|
+
Load raw (compressed but decrypted) contents of a stream into buf.
|
|
131
|
+
*/
|
|
132
|
+
fz_buffer *pdf_load_raw_stream_number(fz_context *ctx, pdf_document *doc, int num);
|
|
133
|
+
fz_buffer *pdf_load_raw_stream(fz_context *ctx, pdf_obj *ref);
|
|
134
|
+
|
|
135
|
+
/*
|
|
136
|
+
Load uncompressed contents of a stream into buf.
|
|
137
|
+
*/
|
|
138
|
+
fz_buffer *pdf_load_stream_number(fz_context *ctx, pdf_document *doc, int num);
|
|
139
|
+
fz_buffer *pdf_load_stream(fz_context *ctx, pdf_obj *ref);
|
|
140
|
+
|
|
141
|
+
/*
|
|
142
|
+
Open a stream for reading the raw (compressed but decrypted) data.
|
|
143
|
+
*/
|
|
144
|
+
fz_stream *pdf_open_raw_stream_number(fz_context *ctx, pdf_document *doc, int num);
|
|
145
|
+
fz_stream *pdf_open_raw_stream(fz_context *ctx, pdf_obj *ref);
|
|
146
|
+
|
|
147
|
+
/*
|
|
148
|
+
Open a stream for reading uncompressed data.
|
|
149
|
+
Put the opened file in doc->stream.
|
|
150
|
+
Using doc->file while a stream is open is a Bad idea.
|
|
151
|
+
*/
|
|
152
|
+
fz_stream *pdf_open_stream_number(fz_context *ctx, pdf_document *doc, int num);
|
|
153
|
+
fz_stream *pdf_open_stream(fz_context *ctx, pdf_obj *ref);
|
|
154
|
+
|
|
155
|
+
/*
|
|
156
|
+
Construct a filter to decode a stream, without
|
|
157
|
+
constraining to stream length, and without decryption.
|
|
158
|
+
*/
|
|
159
|
+
fz_stream *pdf_open_inline_stream(fz_context *ctx, pdf_document *doc, pdf_obj *stmobj, int length, fz_stream *chain, fz_compression_params *params);
|
|
160
|
+
fz_compressed_buffer *pdf_load_compressed_stream(fz_context *ctx, pdf_document *doc, int num, size_t worst_case);
|
|
161
|
+
void pdf_load_compressed_inline_image(fz_context *ctx, pdf_document *doc, pdf_obj *dict, int length, fz_stream *cstm, int indexed, fz_compressed_image *image);
|
|
162
|
+
fz_stream *pdf_open_stream_with_offset(fz_context *ctx, pdf_document *doc, int num, pdf_obj *dict, int64_t stm_ofs);
|
|
163
|
+
fz_stream *pdf_open_contents_stream(fz_context *ctx, pdf_document *doc, pdf_obj *obj);
|
|
164
|
+
|
|
165
|
+
int pdf_version(fz_context *ctx, pdf_document *doc);
|
|
166
|
+
pdf_obj *pdf_trailer(fz_context *ctx, pdf_document *doc);
|
|
167
|
+
void pdf_set_populating_xref_trailer(fz_context *ctx, pdf_document *doc, pdf_obj *trailer);
|
|
168
|
+
int pdf_xref_len(fz_context *ctx, pdf_document *doc);
|
|
169
|
+
|
|
170
|
+
pdf_obj *pdf_metadata(fz_context *ctx, pdf_document *doc);
|
|
171
|
+
|
|
172
|
+
/*
|
|
173
|
+
Used while reading the individual xref sections from a file.
|
|
174
|
+
*/
|
|
175
|
+
pdf_xref_entry *pdf_get_populating_xref_entry(fz_context *ctx, pdf_document *doc, int i);
|
|
176
|
+
|
|
177
|
+
/*
|
|
178
|
+
Used after loading a document to access entries.
|
|
179
|
+
|
|
180
|
+
This will never throw anything, or return NULL if it is
|
|
181
|
+
only asked to return objects in range within a 'solid'
|
|
182
|
+
xref.
|
|
183
|
+
|
|
184
|
+
This may "solidify" the xref (so can cause allocations).
|
|
185
|
+
*/
|
|
186
|
+
pdf_xref_entry *pdf_get_xref_entry(fz_context *ctx, pdf_document *doc, int i);
|
|
187
|
+
|
|
188
|
+
/*
|
|
189
|
+
Map a function across all xref entries in a document.
|
|
190
|
+
*/
|
|
191
|
+
void pdf_xref_entry_map(fz_context *ctx, pdf_document *doc, void (*fn)(fz_context *, pdf_xref_entry *, int i, pdf_document *doc, void *), void *arg);
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
/*
|
|
195
|
+
Used after loading a document to access entries.
|
|
196
|
+
|
|
197
|
+
This will never throw anything, or return NULL if it is
|
|
198
|
+
only asked to return objects in range within a 'solid'
|
|
199
|
+
xref.
|
|
200
|
+
|
|
201
|
+
This will never "solidify" the xref, so no entry may be found
|
|
202
|
+
(NULL will be returned) for free entries.
|
|
203
|
+
|
|
204
|
+
Called with a valid i, this will never try/catch or throw.
|
|
205
|
+
*/
|
|
206
|
+
pdf_xref_entry *pdf_get_xref_entry_no_change(fz_context *ctx, pdf_document *doc, int i);
|
|
207
|
+
pdf_xref_entry *pdf_get_xref_entry_no_null(fz_context *ctx, pdf_document *doc, int i);
|
|
208
|
+
void pdf_replace_xref(fz_context *ctx, pdf_document *doc, pdf_xref_entry *entries, int n);
|
|
209
|
+
void pdf_forget_xref(fz_context *ctx, pdf_document *doc);
|
|
210
|
+
pdf_xref_entry *pdf_get_incremental_xref_entry(fz_context *ctx, pdf_document *doc, int i);
|
|
211
|
+
|
|
212
|
+
/*
|
|
213
|
+
Ensure that an object has been cloned into the incremental xref section.
|
|
214
|
+
*/
|
|
215
|
+
int pdf_xref_ensure_incremental_object(fz_context *ctx, pdf_document *doc, int num);
|
|
216
|
+
int pdf_xref_is_incremental(fz_context *ctx, pdf_document *doc, int num);
|
|
217
|
+
void pdf_xref_store_unsaved_signature(fz_context *ctx, pdf_document *doc, pdf_obj *field, pdf_pkcs7_signer *signer);
|
|
218
|
+
void pdf_xref_remove_unsaved_signature(fz_context *ctx, pdf_document *doc, pdf_obj *field);
|
|
219
|
+
int pdf_xref_obj_is_unsaved_signature(pdf_document *doc, pdf_obj *obj);
|
|
220
|
+
void pdf_xref_ensure_local_object(fz_context *ctx, pdf_document *doc, int num);
|
|
221
|
+
int pdf_obj_is_incremental(fz_context *ctx, pdf_obj *obj);
|
|
222
|
+
|
|
223
|
+
void pdf_repair_xref(fz_context *ctx, pdf_document *doc);
|
|
224
|
+
|
|
225
|
+
/*
|
|
226
|
+
Ensure that the current populating xref has a single subsection
|
|
227
|
+
that covers the entire range.
|
|
228
|
+
*/
|
|
229
|
+
void pdf_ensure_solid_xref(fz_context *ctx, pdf_document *doc, int num);
|
|
230
|
+
void pdf_mark_xref(fz_context *ctx, pdf_document *doc);
|
|
231
|
+
void pdf_clear_xref(fz_context *ctx, pdf_document *doc);
|
|
232
|
+
void pdf_clear_xref_to_mark(fz_context *ctx, pdf_document *doc);
|
|
233
|
+
|
|
234
|
+
int pdf_repair_obj(fz_context *ctx, pdf_document *doc, pdf_lexbuf *buf, int64_t *stmofsp, int64_t *stmlenp, pdf_obj **encrypt, pdf_obj **id, pdf_obj **page, int64_t *tmpofs, pdf_obj **root);
|
|
235
|
+
|
|
236
|
+
pdf_obj *pdf_progressive_advance(fz_context *ctx, pdf_document *doc, int pagenum);
|
|
237
|
+
|
|
238
|
+
/*
|
|
239
|
+
Return the number of versions that there
|
|
240
|
+
are in a file. i.e. 1 + the number of updates that
|
|
241
|
+
the file on disc has been through. i.e. internal
|
|
242
|
+
unsaved changes to the file (such as appearance streams)
|
|
243
|
+
are ignored. Also, the initial write of a linearized
|
|
244
|
+
file (which appears as a base file write + an incremental
|
|
245
|
+
update) is treated as a single version.
|
|
246
|
+
*/
|
|
247
|
+
int pdf_count_versions(fz_context *ctx, pdf_document *doc);
|
|
248
|
+
int pdf_count_unsaved_versions(fz_context *ctx, pdf_document *doc);
|
|
249
|
+
int pdf_validate_changes(fz_context *ctx, pdf_document *doc, int version);
|
|
250
|
+
int pdf_doc_was_linearized(fz_context *ctx, pdf_document *doc);
|
|
251
|
+
|
|
252
|
+
typedef struct pdf_locked_fields pdf_locked_fields;
|
|
253
|
+
int pdf_is_field_locked(fz_context *ctx, pdf_locked_fields *locked, const char *name);
|
|
254
|
+
void pdf_drop_locked_fields(fz_context *ctx, pdf_locked_fields *locked);
|
|
255
|
+
pdf_locked_fields *pdf_find_locked_fields(fz_context *ctx, pdf_document *doc, int version);
|
|
256
|
+
pdf_locked_fields *pdf_find_locked_fields_for_sig(fz_context *ctx, pdf_document *doc, pdf_obj *sig);
|
|
257
|
+
|
|
258
|
+
/*
|
|
259
|
+
Check the entire history of the document, and return the number of
|
|
260
|
+
the last version that checked out OK.
|
|
261
|
+
i.e. 0 = "the entire history checks out OK".
|
|
262
|
+
n = "none of the history checked out OK".
|
|
263
|
+
*/
|
|
264
|
+
int pdf_validate_change_history(fz_context *ctx, pdf_document *doc);
|
|
265
|
+
|
|
266
|
+
/*
|
|
267
|
+
Find which version of a document the current version of obj
|
|
268
|
+
was defined in.
|
|
269
|
+
|
|
270
|
+
version = 0 = latest, 1 = previous update etc, allowing for
|
|
271
|
+
the first incremental update in a linearized file being ignored.
|
|
272
|
+
*/
|
|
273
|
+
int pdf_find_version_for_obj(fz_context *ctx, pdf_document *doc, pdf_obj *obj);
|
|
274
|
+
|
|
275
|
+
/*
|
|
276
|
+
Return the number of updates ago when a signature became invalid,
|
|
277
|
+
not counting any unsaved changes.
|
|
278
|
+
|
|
279
|
+
Thus:
|
|
280
|
+
-1 => Has changed in the current unsaved changes.
|
|
281
|
+
0 => still valid.
|
|
282
|
+
1 => became invalid on the last save
|
|
283
|
+
n => became invalid n saves ago
|
|
284
|
+
*/
|
|
285
|
+
int pdf_validate_signature(fz_context *ctx, pdf_annot *widget);
|
|
286
|
+
int pdf_was_pure_xfa(fz_context *ctx, pdf_document *doc);
|
|
287
|
+
|
|
288
|
+
/* Local xrefs - designed for holding stuff that shouldn't be written
|
|
289
|
+
* back into the actual document, such as synthesized appearance
|
|
290
|
+
* streams. */
|
|
291
|
+
pdf_xref *pdf_new_local_xref(fz_context *ctx, pdf_document *doc);
|
|
292
|
+
|
|
293
|
+
void pdf_drop_local_xref(fz_context *ctx, pdf_xref *xref);
|
|
294
|
+
void pdf_drop_local_xref_and_resources(fz_context *ctx, pdf_document *doc);
|
|
295
|
+
|
|
296
|
+
/* Debug call to dump the incremental/local xrefs to the
|
|
297
|
+
* debug channel. */
|
|
298
|
+
void pdf_debug_doc_changes(fz_context *ctx, pdf_document *doc);
|
|
299
|
+
|
|
300
|
+
#endif
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Copyright (C) 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_PDF_ZUGFERD_H
|
|
24
|
+
#define MUPDF_PDF_ZUGFERD_H
|
|
25
|
+
|
|
26
|
+
#include "mupdf/pdf/document.h"
|
|
27
|
+
|
|
28
|
+
enum pdf_zugferd_profile
|
|
29
|
+
{
|
|
30
|
+
PDF_NOT_ZUGFERD = 0,
|
|
31
|
+
/* ZUGFeRD 1.0 */
|
|
32
|
+
PDF_ZUGFERD_COMFORT,
|
|
33
|
+
PDF_ZUGFERD_BASIC,
|
|
34
|
+
PDF_ZUGFERD_EXTENDED,
|
|
35
|
+
/* ZUGFeRD 2.01 */
|
|
36
|
+
PDF_ZUGFERD_BASIC_WL,
|
|
37
|
+
PDF_ZUGFERD_MINIMUM,
|
|
38
|
+
/* ZUGFeRD 2.2 */
|
|
39
|
+
PDF_ZUGFERD_XRECHNUNG,
|
|
40
|
+
PDF_ZUGFERD_UNKNOWN
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
enum pdf_zugferd_profile pdf_zugferd_profile(fz_context *ctx, pdf_document *doc, float *version);
|
|
44
|
+
|
|
45
|
+
fz_buffer *pdf_zugferd_xml(fz_context *ctx, pdf_document *doc);
|
|
46
|
+
|
|
47
|
+
const char *pdf_zugferd_profile_to_string(fz_context *ctx, enum pdf_zugferd_profile profile);
|
|
48
|
+
|
|
49
|
+
#endif
|
|
@@ -0,0 +1,59 @@
|
|
|
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_PDF_H
|
|
24
|
+
#define MUPDF_PDF_H
|
|
25
|
+
|
|
26
|
+
#include "mupdf/fitz.h"
|
|
27
|
+
|
|
28
|
+
#ifdef __cplusplus
|
|
29
|
+
extern "C" {
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
#include "mupdf/pdf/object.h"
|
|
33
|
+
#include "mupdf/pdf/document.h"
|
|
34
|
+
#include "mupdf/pdf/parse.h"
|
|
35
|
+
#include "mupdf/pdf/xref.h"
|
|
36
|
+
#include "mupdf/pdf/crypt.h"
|
|
37
|
+
|
|
38
|
+
#include "mupdf/pdf/page.h"
|
|
39
|
+
#include "mupdf/pdf/resource.h"
|
|
40
|
+
#include "mupdf/pdf/cmap.h"
|
|
41
|
+
#include "mupdf/pdf/font.h"
|
|
42
|
+
#include "mupdf/pdf/interpret.h"
|
|
43
|
+
|
|
44
|
+
#include "mupdf/pdf/annot.h"
|
|
45
|
+
#include "mupdf/pdf/form.h"
|
|
46
|
+
#include "mupdf/pdf/event.h"
|
|
47
|
+
#include "mupdf/pdf/javascript.h"
|
|
48
|
+
|
|
49
|
+
#include "mupdf/pdf/clean.h"
|
|
50
|
+
#include "mupdf/pdf/recolor.h"
|
|
51
|
+
#include "mupdf/pdf/image-rewriter.h"
|
|
52
|
+
#include "mupdf/pdf/zugferd.h"
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
#ifdef __cplusplus
|
|
56
|
+
}
|
|
57
|
+
#endif
|
|
58
|
+
|
|
59
|
+
#endif
|