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.
Files changed (112) hide show
  1. fitz/__init__.py +13 -0
  2. fitz/table.py +2 -0
  3. fitz/utils.py +2 -0
  4. pymupdf/__init__.py +25899 -0
  5. pymupdf/__main__.py +1140 -0
  6. pymupdf/_apply_pages.py +253 -0
  7. pymupdf/_build.py +8 -0
  8. pymupdf/_extra.pyd +0 -0
  9. pymupdf/_mupdf.pyd +0 -0
  10. pymupdf/_wxcolors.py +562 -0
  11. pymupdf/extra.py +220 -0
  12. pymupdf/mupdf-devel/include/mupdf/classes.h +19999 -0
  13. pymupdf/mupdf-devel/include/mupdf/classes2.h +12244 -0
  14. pymupdf/mupdf-devel/include/mupdf/exceptions.h +118 -0
  15. pymupdf/mupdf-devel/include/mupdf/extra.h +189 -0
  16. pymupdf/mupdf-devel/include/mupdf/fitz/archive.h +444 -0
  17. pymupdf/mupdf-devel/include/mupdf/fitz/band-writer.h +117 -0
  18. pymupdf/mupdf-devel/include/mupdf/fitz/barcode.h +138 -0
  19. pymupdf/mupdf-devel/include/mupdf/fitz/bidi.h +90 -0
  20. pymupdf/mupdf-devel/include/mupdf/fitz/bitmap.h +188 -0
  21. pymupdf/mupdf-devel/include/mupdf/fitz/buffer.h +250 -0
  22. pymupdf/mupdf-devel/include/mupdf/fitz/color.h +433 -0
  23. pymupdf/mupdf-devel/include/mupdf/fitz/compress.h +132 -0
  24. pymupdf/mupdf-devel/include/mupdf/fitz/compressed-buffer.h +194 -0
  25. pymupdf/mupdf-devel/include/mupdf/fitz/config.h +302 -0
  26. pymupdf/mupdf-devel/include/mupdf/fitz/context.h +1064 -0
  27. pymupdf/mupdf-devel/include/mupdf/fitz/crypt.h +270 -0
  28. pymupdf/mupdf-devel/include/mupdf/fitz/deskew.h +46 -0
  29. pymupdf/mupdf-devel/include/mupdf/fitz/device.h +652 -0
  30. pymupdf/mupdf-devel/include/mupdf/fitz/display-list.h +142 -0
  31. pymupdf/mupdf-devel/include/mupdf/fitz/document.h +1103 -0
  32. pymupdf/mupdf-devel/include/mupdf/fitz/export.h +52 -0
  33. pymupdf/mupdf-devel/include/mupdf/fitz/filter.h +269 -0
  34. pymupdf/mupdf-devel/include/mupdf/fitz/font.h +858 -0
  35. pymupdf/mupdf-devel/include/mupdf/fitz/geometry.h +885 -0
  36. pymupdf/mupdf-devel/include/mupdf/fitz/getopt.h +134 -0
  37. pymupdf/mupdf-devel/include/mupdf/fitz/glyph-cache.h +96 -0
  38. pymupdf/mupdf-devel/include/mupdf/fitz/glyph.h +81 -0
  39. pymupdf/mupdf-devel/include/mupdf/fitz/hash.h +126 -0
  40. pymupdf/mupdf-devel/include/mupdf/fitz/heap-imp.h +190 -0
  41. pymupdf/mupdf-devel/include/mupdf/fitz/heap.h +143 -0
  42. pymupdf/mupdf-devel/include/mupdf/fitz/image.h +451 -0
  43. pymupdf/mupdf-devel/include/mupdf/fitz/json.h +98 -0
  44. pymupdf/mupdf-devel/include/mupdf/fitz/link.h +130 -0
  45. pymupdf/mupdf-devel/include/mupdf/fitz/log.h +61 -0
  46. pymupdf/mupdf-devel/include/mupdf/fitz/outline.h +254 -0
  47. pymupdf/mupdf-devel/include/mupdf/fitz/output-svg.h +64 -0
  48. pymupdf/mupdf-devel/include/mupdf/fitz/output.h +448 -0
  49. pymupdf/mupdf-devel/include/mupdf/fitz/path.h +477 -0
  50. pymupdf/mupdf-devel/include/mupdf/fitz/pixmap.h +516 -0
  51. pymupdf/mupdf-devel/include/mupdf/fitz/pool.h +102 -0
  52. pymupdf/mupdf-devel/include/mupdf/fitz/separation.h +138 -0
  53. pymupdf/mupdf-devel/include/mupdf/fitz/shade.h +233 -0
  54. pymupdf/mupdf-devel/include/mupdf/fitz/store.h +465 -0
  55. pymupdf/mupdf-devel/include/mupdf/fitz/story-writer.h +209 -0
  56. pymupdf/mupdf-devel/include/mupdf/fitz/story.h +232 -0
  57. pymupdf/mupdf-devel/include/mupdf/fitz/stream.h +646 -0
  58. pymupdf/mupdf-devel/include/mupdf/fitz/string-util.h +335 -0
  59. pymupdf/mupdf-devel/include/mupdf/fitz/structured-text.h +924 -0
  60. pymupdf/mupdf-devel/include/mupdf/fitz/system.h +495 -0
  61. pymupdf/mupdf-devel/include/mupdf/fitz/text.h +210 -0
  62. pymupdf/mupdf-devel/include/mupdf/fitz/track-usage.h +57 -0
  63. pymupdf/mupdf-devel/include/mupdf/fitz/transition.h +76 -0
  64. pymupdf/mupdf-devel/include/mupdf/fitz/tree.h +62 -0
  65. pymupdf/mupdf-devel/include/mupdf/fitz/types.h +41 -0
  66. pymupdf/mupdf-devel/include/mupdf/fitz/util.h +159 -0
  67. pymupdf/mupdf-devel/include/mupdf/fitz/version.h +31 -0
  68. pymupdf/mupdf-devel/include/mupdf/fitz/write-pixmap.h +507 -0
  69. pymupdf/mupdf-devel/include/mupdf/fitz/writer.h +269 -0
  70. pymupdf/mupdf-devel/include/mupdf/fitz/xml.h +435 -0
  71. pymupdf/mupdf-devel/include/mupdf/fitz.h +101 -0
  72. pymupdf/mupdf-devel/include/mupdf/functions.h +13819 -0
  73. pymupdf/mupdf-devel/include/mupdf/helpers/mu-office-lib.h +666 -0
  74. pymupdf/mupdf-devel/include/mupdf/helpers/mu-threads.h +280 -0
  75. pymupdf/mupdf-devel/include/mupdf/helpers/pkcs7-openssl.h +48 -0
  76. pymupdf/mupdf-devel/include/mupdf/html.h +53 -0
  77. pymupdf/mupdf-devel/include/mupdf/internal.h +29 -0
  78. pymupdf/mupdf-devel/include/mupdf/memento.h +425 -0
  79. pymupdf/mupdf-devel/include/mupdf/pdf/annot.h +1015 -0
  80. pymupdf/mupdf-devel/include/mupdf/pdf/clean.h +68 -0
  81. pymupdf/mupdf-devel/include/mupdf/pdf/cmap.h +145 -0
  82. pymupdf/mupdf-devel/include/mupdf/pdf/crypt.h +108 -0
  83. pymupdf/mupdf-devel/include/mupdf/pdf/document.h +902 -0
  84. pymupdf/mupdf-devel/include/mupdf/pdf/event.h +167 -0
  85. pymupdf/mupdf-devel/include/mupdf/pdf/font.h +168 -0
  86. pymupdf/mupdf-devel/include/mupdf/pdf/form.h +381 -0
  87. pymupdf/mupdf-devel/include/mupdf/pdf/image-rewriter.h +78 -0
  88. pymupdf/mupdf-devel/include/mupdf/pdf/interpret.h +518 -0
  89. pymupdf/mupdf-devel/include/mupdf/pdf/javascript.h +43 -0
  90. pymupdf/mupdf-devel/include/mupdf/pdf/name-table.h +621 -0
  91. pymupdf/mupdf-devel/include/mupdf/pdf/object.h +445 -0
  92. pymupdf/mupdf-devel/include/mupdf/pdf/page.h +327 -0
  93. pymupdf/mupdf-devel/include/mupdf/pdf/parse.h +61 -0
  94. pymupdf/mupdf-devel/include/mupdf/pdf/recolor.h +49 -0
  95. pymupdf/mupdf-devel/include/mupdf/pdf/resource.h +144 -0
  96. pymupdf/mupdf-devel/include/mupdf/pdf/xref.h +300 -0
  97. pymupdf/mupdf-devel/include/mupdf/pdf/zugferd.h +49 -0
  98. pymupdf/mupdf-devel/include/mupdf/pdf.h +59 -0
  99. pymupdf/mupdf-devel/include/mupdf/ucdn.h +464 -0
  100. pymupdf/mupdf-devel/lib/libmuthreads.lib +0 -0
  101. pymupdf/mupdf-devel/lib/mupdfcpp64.lib +0 -0
  102. pymupdf/mupdf.py +63667 -0
  103. pymupdf/mupdfcpp64.dll +0 -0
  104. pymupdf/pymupdf.py +2 -0
  105. pymupdf/table.py +2697 -0
  106. pymupdf/utils.py +1169 -0
  107. pymupdf-1.26.6.dist-info/COPYING +1 -0
  108. pymupdf-1.26.6.dist-info/METADATA +83 -0
  109. pymupdf-1.26.6.dist-info/README.md +60 -0
  110. pymupdf-1.26.6.dist-info/RECORD +112 -0
  111. pymupdf-1.26.6.dist-info/WHEEL +4 -0
  112. pymupdf-1.26.6.dist-info/entry_points.txt +3 -0
@@ -0,0 +1,130 @@
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_LINK_H
24
+ #define MUPDF_FITZ_LINK_H
25
+
26
+ #include "mupdf/fitz/system.h"
27
+ #include "mupdf/fitz/context.h"
28
+ #include "mupdf/fitz/geometry.h"
29
+ #include "mupdf/fitz/types.h"
30
+
31
+ typedef struct fz_link fz_link;
32
+ typedef void (fz_link_set_rect_fn)(fz_context *ctx, fz_link *link, fz_rect rect);
33
+ typedef void (fz_link_set_uri_fn)(fz_context *ctx, fz_link *link, const char *uri);
34
+ typedef void (fz_link_drop_link_fn)(fz_context *ctx, fz_link *link);
35
+
36
+ /**
37
+ fz_link is a list of interactive links on a page.
38
+
39
+ There is no relation between the order of the links in the
40
+ list and the order they appear on the page. The list of links
41
+ for a given page can be obtained from fz_load_links.
42
+
43
+ A link is reference counted. Dropping a reference to a link is
44
+ done by calling fz_drop_link.
45
+
46
+ rect: The hot zone. The area that can be clicked in
47
+ untransformed coordinates.
48
+
49
+ uri: Link destinations come in two forms: internal and external.
50
+ Internal links refer to other pages in the same document.
51
+ External links are URLs to other documents.
52
+
53
+ next: A pointer to the next link on the same page.
54
+ */
55
+ typedef struct fz_link
56
+ {
57
+ int refs;
58
+ struct fz_link *next;
59
+ fz_rect rect;
60
+ char *uri;
61
+ fz_link_set_rect_fn *set_rect_fn;
62
+ fz_link_set_uri_fn *set_uri_fn;
63
+ fz_link_drop_link_fn *drop;
64
+ } fz_link;
65
+
66
+ typedef enum
67
+ {
68
+ FZ_LINK_DEST_FIT,
69
+ FZ_LINK_DEST_FIT_B,
70
+ FZ_LINK_DEST_FIT_H,
71
+ FZ_LINK_DEST_FIT_BH,
72
+ FZ_LINK_DEST_FIT_V,
73
+ FZ_LINK_DEST_FIT_BV,
74
+ FZ_LINK_DEST_FIT_R,
75
+ FZ_LINK_DEST_XYZ
76
+ } fz_link_dest_type;
77
+
78
+ typedef struct
79
+ {
80
+ fz_location loc;
81
+ fz_link_dest_type type;
82
+ float x, y, w, h, zoom;
83
+ } fz_link_dest;
84
+
85
+ fz_link_dest fz_make_link_dest_none(void);
86
+ fz_link_dest fz_make_link_dest_xyz(int chapter, int page, float x, float y, float z);
87
+
88
+ /**
89
+ Create a new link record.
90
+
91
+ next is set to NULL with the expectation that the caller will
92
+ handle the linked list setup. Internal function.
93
+
94
+ Different document types will be implemented by deriving from
95
+ fz_link. This macro allocates such derived structures, and
96
+ initialises the base sections.
97
+ */
98
+ fz_link *fz_new_link_of_size(fz_context *ctx, int size, fz_rect rect, const char *uri);
99
+ #define fz_new_derived_link(CTX,TYPE,RECT,URI) \
100
+ ((TYPE *)Memento_label(fz_new_link_of_size(CTX,sizeof(TYPE),RECT,URI),#TYPE))
101
+
102
+ /**
103
+ Increment the reference count for a link. The same pointer is
104
+ returned.
105
+
106
+ Never throws exceptions.
107
+ */
108
+ fz_link *fz_keep_link(fz_context *ctx, fz_link *link);
109
+
110
+ /**
111
+ Decrement the reference count for a link. When the reference
112
+ count reaches zero, the link is destroyed.
113
+
114
+ When a link is freed, the reference for any linked link (next)
115
+ is dropped too, thus an entire linked list of fz_link's can be
116
+ freed by just dropping the head.
117
+ */
118
+ void fz_drop_link(fz_context *ctx, fz_link *link);
119
+
120
+ /**
121
+ Query whether a link is external to a document (determined by
122
+ uri containing a ':', intended to match with '://' which
123
+ separates the scheme from the scheme specific parts in URIs).
124
+ */
125
+ int fz_is_external_link(fz_context *ctx, const char *uri);
126
+
127
+ void fz_set_link_rect(fz_context *ctx, fz_link *link, fz_rect rect);
128
+ void fz_set_link_uri(fz_context *ctx, fz_link *link, const char *uri);
129
+
130
+ #endif
@@ -0,0 +1,61 @@
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_LOG_H
24
+ #define MUPDF_FITZ_LOG_H
25
+
26
+ #include "mupdf/fitz/context.h"
27
+ #include "mupdf/fitz/output.h"
28
+
29
+ /**
30
+ The functions in this file offer simple logging abilities.
31
+
32
+ The default logfile is "fitz_log.txt". This can overridden by
33
+ defining an environment variable "FZ_LOG_FILE", or module
34
+ specific environment variables "FZ_LOG_FILE_<module>" (e.g.
35
+ "FZ_LOG_FILE_STORE").
36
+
37
+ Enable the following define(s) to enable built in debug logging
38
+ from within the appropriate module(s).
39
+ */
40
+
41
+ /* #define ENABLE_STORE_LOGGING */
42
+
43
+
44
+ /**
45
+ Output a line to the log.
46
+ */
47
+ void fz_log(fz_context *ctx, const char *fmt, ...);
48
+
49
+ /**
50
+ Output a line to the log for a given module.
51
+ */
52
+ void fz_log_module(fz_context *ctx, const char *module, const char *fmt, ...);
53
+
54
+ /**
55
+ Internal function to actually do the opening of the logfile.
56
+
57
+ Caller should close/drop the output when finished with it.
58
+ */
59
+ fz_output *fz_new_log_for_module(fz_context *ctx, const char *module);
60
+
61
+ #endif
@@ -0,0 +1,254 @@
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_FITZ_OUTLINE_H
24
+ #define MUPDF_FITZ_OUTLINE_H
25
+
26
+ #include "mupdf/fitz/system.h"
27
+ #include "mupdf/fitz/types.h"
28
+ #include "mupdf/fitz/context.h"
29
+ #include "mupdf/fitz/link.h"
30
+ #include "mupdf/fitz/output.h"
31
+
32
+ /* Outline */
33
+
34
+ typedef struct {
35
+ char *title;
36
+ char *uri;
37
+ int is_open;
38
+ int flags;
39
+ float r;
40
+ float g;
41
+ float b;
42
+ } fz_outline_item;
43
+
44
+ enum
45
+ {
46
+ FZ_OUTLINE_FLAG_BOLD = 1,
47
+ FZ_OUTLINE_FLAG_ITALIC = 2,
48
+ };
49
+
50
+ typedef struct fz_outline_iterator fz_outline_iterator;
51
+
52
+ /**
53
+ Call to get the current outline item.
54
+
55
+ Can return NULL. The item is only valid until the next call.
56
+ */
57
+ fz_outline_item *fz_outline_iterator_item(fz_context *ctx, fz_outline_iterator *iter);
58
+
59
+ /**
60
+ Calls to move the iterator position.
61
+
62
+ A negative return value means we could not move as requested. Otherwise:
63
+ 0 = the final position has a valid item.
64
+ 1 = not a valid item, but we can insert an item here.
65
+ */
66
+ int fz_outline_iterator_next(fz_context *ctx, fz_outline_iterator *iter);
67
+ int fz_outline_iterator_prev(fz_context *ctx, fz_outline_iterator *iter);
68
+ int fz_outline_iterator_up(fz_context *ctx, fz_outline_iterator *iter);
69
+ int fz_outline_iterator_down(fz_context *ctx, fz_outline_iterator *iter);
70
+
71
+ /**
72
+ Call to insert a new item BEFORE the current point.
73
+
74
+ Ownership of pointers are retained by the caller. The item data will be copied.
75
+
76
+ After an insert, we do not change where we are pointing.
77
+ The return code is the same as for next, it indicates the current iterator position.
78
+
79
+ Note that for PDF documents at least, the is_open field is ignored. All childless
80
+ nodes are considered closed by PDF, hence (given every newly inserted node is
81
+ childless by definition) all new nodes are inserted with is_open == false.
82
+ */
83
+ int fz_outline_iterator_insert(fz_context *ctx, fz_outline_iterator *iter, fz_outline_item *item);
84
+
85
+ /**
86
+ Delete the current item.
87
+
88
+ This implicitly moves us to the 'next' item, and the return code is as for fz_outline_iterator_next.
89
+ */
90
+ int fz_outline_iterator_delete(fz_context *ctx, fz_outline_iterator *iter);
91
+
92
+ /**
93
+ Update the current item properties according to the given item.
94
+ */
95
+ void fz_outline_iterator_update(fz_context *ctx, fz_outline_iterator *iter, fz_outline_item *item);
96
+
97
+ /**
98
+ Drop the current iterator.
99
+ */
100
+ void fz_drop_outline_iterator(fz_context *ctx, fz_outline_iterator *iter);
101
+
102
+
103
+ /** Structure based API */
104
+
105
+ /**
106
+ fz_outline is a tree of the outline of a document (also known
107
+ as table of contents).
108
+
109
+ title: Title of outline item using UTF-8 encoding. May be NULL
110
+ if the outline item has no text string.
111
+
112
+ uri: Destination in the document to be displayed when this
113
+ outline item is activated. May be an internal or external
114
+ link, or NULL if the outline item does not have a destination.
115
+
116
+ page: The page number of an internal link, or -1 for external
117
+ links or links with no destination.
118
+
119
+ next: The next outline item at the same level as this outline
120
+ item. May be NULL if no more outline items exist at this level.
121
+
122
+ down: The outline items immediate children in the hierarchy.
123
+ May be NULL if no children exist.
124
+
125
+ is_open: If zero, the outline element is closed in the UI. If
126
+ 1, it should be open, showing any child elements.
127
+
128
+ flags: Bit 0 set -> Bold, Bit 1 set -> Italic. All other bits
129
+ reserved.
130
+
131
+ r, g, b: The RGB components of the color of this entry.
132
+ */
133
+ typedef struct fz_outline
134
+ {
135
+ int refs;
136
+ char *title;
137
+ char *uri;
138
+ fz_location page;
139
+ float x, y;
140
+ struct fz_outline *next;
141
+ struct fz_outline *down;
142
+ unsigned int is_open : 1;
143
+ unsigned int flags : 7;
144
+ unsigned int r : 8;
145
+ unsigned int g : 8;
146
+ unsigned int b : 8;
147
+ } fz_outline;
148
+
149
+ /**
150
+ Create a new outline entry with zeroed fields for the caller
151
+ to fill in.
152
+ */
153
+ fz_outline *fz_new_outline(fz_context *ctx);
154
+
155
+ /**
156
+ Increment the reference count. Returns the same pointer.
157
+
158
+ Never throws exceptions.
159
+ */
160
+ fz_outline *fz_keep_outline(fz_context *ctx, fz_outline *outline);
161
+
162
+ /**
163
+ Decrements the reference count. When the reference point
164
+ reaches zero, the outline is freed.
165
+
166
+ When freed, it will drop linked outline entries (next and down)
167
+ too, thus a whole outline structure can be dropped by dropping
168
+ the top entry.
169
+
170
+ Never throws exceptions.
171
+ */
172
+ void fz_drop_outline(fz_context *ctx, fz_outline *outline);
173
+
174
+ /**
175
+ Routine to implement the old Structure based API from an iterator.
176
+ */
177
+ fz_outline *
178
+ fz_load_outline_from_iterator(fz_context *ctx, fz_outline_iterator *iter);
179
+
180
+
181
+ /**
182
+ Implementation details.
183
+ Of use to people coding new document handlers.
184
+ */
185
+
186
+ /**
187
+ Function type for getting the current item.
188
+
189
+ Can return NULL. The item is only valid until the next call.
190
+ */
191
+ typedef fz_outline_item *(fz_outline_iterator_item_fn)(fz_context *ctx, fz_outline_iterator *iter);
192
+
193
+ /**
194
+ Function types for moving the iterator position.
195
+
196
+ A negative return value means we could not move as requested. Otherwise:
197
+ 0 = the final position has a valid item.
198
+ 1 = not a valid item, but we can insert an item here.
199
+ */
200
+ typedef int (fz_outline_iterator_next_fn)(fz_context *ctx, fz_outline_iterator *iter);
201
+ typedef int (fz_outline_iterator_prev_fn)(fz_context *ctx, fz_outline_iterator *iter);
202
+ typedef int (fz_outline_iterator_up_fn)(fz_context *ctx, fz_outline_iterator *iter);
203
+ typedef int (fz_outline_iterator_down_fn)(fz_context *ctx, fz_outline_iterator *iter);
204
+
205
+ /**
206
+ Function type for inserting a new item BEFORE the current point.
207
+
208
+ Ownership of pointers are retained by the caller. The item data will be copied.
209
+
210
+ After an insert, we implicitly do a next, so that a successive insert operation
211
+ would insert after the item inserted here. The return code is therefore as for next.
212
+ */
213
+ typedef int (fz_outline_iterator_insert_fn)(fz_context *ctx, fz_outline_iterator *iter, fz_outline_item *item);
214
+
215
+ /**
216
+ Function type for deleting the current item.
217
+
218
+ This implicitly moves us to the 'next' item, and the return code is as for fz_outline_iterator_next.
219
+ */
220
+ typedef int (fz_outline_iterator_delete_fn)(fz_context *ctx, fz_outline_iterator *iter);
221
+
222
+ /**
223
+ Function type for updating the current item properties according to the given item.
224
+ */
225
+ typedef void (fz_outline_iterator_update_fn)(fz_context *ctx, fz_outline_iterator *iter, fz_outline_item *item);
226
+
227
+ /**
228
+ Function type for dropping the current iterator.
229
+ */
230
+ typedef void (fz_outline_iterator_drop_fn)(fz_context *ctx, fz_outline_iterator *iter);
231
+
232
+ #define fz_new_derived_outline_iter(CTX, TYPE, DOC)\
233
+ ((TYPE *)Memento_label(fz_new_outline_iterator_of_size(ctx,sizeof(TYPE),DOC),#TYPE))
234
+
235
+ fz_outline_iterator *fz_new_outline_iterator_of_size(fz_context *ctx, size_t size, fz_document *doc);
236
+
237
+ fz_outline_iterator *fz_outline_iterator_from_outline(fz_context *ctx, fz_outline *outline);
238
+
239
+ struct fz_outline_iterator {
240
+ /* Functions */
241
+ fz_outline_iterator_drop_fn *drop;
242
+ fz_outline_iterator_item_fn *item;
243
+ fz_outline_iterator_next_fn *next;
244
+ fz_outline_iterator_prev_fn *prev;
245
+ fz_outline_iterator_up_fn *up;
246
+ fz_outline_iterator_down_fn *down;
247
+ fz_outline_iterator_insert_fn *insert;
248
+ fz_outline_iterator_update_fn *update;
249
+ fz_outline_iterator_delete_fn *del;
250
+ /* Common state */
251
+ fz_document *doc;
252
+ };
253
+
254
+ #endif
@@ -0,0 +1,64 @@
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_OUTPUT_SVG_H
24
+ #define MUPDF_FITZ_OUTPUT_SVG_H
25
+
26
+ #include "mupdf/fitz/system.h"
27
+ #include "mupdf/fitz/context.h"
28
+ #include "mupdf/fitz/device.h"
29
+ #include "mupdf/fitz/output.h"
30
+
31
+ enum {
32
+ FZ_SVG_TEXT_AS_PATH = 0,
33
+ FZ_SVG_TEXT_AS_TEXT = 1,
34
+ };
35
+
36
+ /**
37
+ Create a device that outputs (single page) SVG files to
38
+ the given output stream.
39
+
40
+ Equivalent to fz_new_svg_device_with_id passing id = NULL.
41
+ */
42
+ fz_device *fz_new_svg_device(fz_context *ctx, fz_output *out, float page_width, float page_height, int text_format, int reuse_images);
43
+
44
+ /**
45
+ Create a device that outputs (single page) SVG files to
46
+ the given output stream.
47
+
48
+ output: The output stream to send the constructed SVG page to.
49
+
50
+ page_width, page_height: The page dimensions to use (in points).
51
+
52
+ text_format: How to emit text. One of the following values:
53
+ FZ_SVG_TEXT_AS_TEXT: As <text> elements with possible
54
+ layout errors and mismatching fonts.
55
+ FZ_SVG_TEXT_AS_PATH: As <path> elements with exact
56
+ visual appearance.
57
+
58
+ reuse_images: Share image resources using <symbol> definitions.
59
+
60
+ id: ID parameter to keep generated IDs unique across SVG files.
61
+ */
62
+ fz_device *fz_new_svg_device_with_id(fz_context *ctx, fz_output *out, float page_width, float page_height, int text_format, int reuse_images, int *id);
63
+
64
+ #endif