aspose-pdf-foss-for-python 0.1.0__py3-none-any.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 (265) hide show
  1. aspose_pdf/__init__.py +367 -0
  2. aspose_pdf/_compat_surface.py +142 -0
  3. aspose_pdf/_export_files.py +108 -0
  4. aspose_pdf/_pending_signatures.py +222 -0
  5. aspose_pdf/_version.py +17 -0
  6. aspose_pdf/actions.py +273 -0
  7. aspose_pdf/annotations/__init__.py +1614 -0
  8. aspose_pdf/annotations/pdf3d.py +70 -0
  9. aspose_pdf/attachments.py +62 -0
  10. aspose_pdf/auto_links.py +375 -0
  11. aspose_pdf/block_extraction.py +223 -0
  12. aspose_pdf/cgm.py +7 -0
  13. aspose_pdf/clustering/__init__.py +13 -0
  14. aspose_pdf/clustering/hierarchical_agglomerative_clustering.py +151 -0
  15. aspose_pdf/color.py +241 -0
  16. aspose_pdf/destinations.py +164 -0
  17. aspose_pdf/document.py +5884 -0
  18. aspose_pdf/document_fonts.py +150 -0
  19. aspose_pdf/drawing.py +13 -0
  20. aspose_pdf/engine/__init__.py +1 -0
  21. aspose_pdf/engine/agl.py +243 -0
  22. aspose_pdf/engine/annotation_cleanup.py +407 -0
  23. aspose_pdf/engine/annotation_import.py +503 -0
  24. aspose_pdf/engine/annotation_json.py +313 -0
  25. aspose_pdf/engine/annotation_xfdf.py +405 -0
  26. aspose_pdf/engine/annotation_xfdf_import.py +389 -0
  27. aspose_pdf/engine/appearance.py +1361 -0
  28. aspose_pdf/engine/attachment_zip.py +306 -0
  29. aspose_pdf/engine/attachment_zip_import.py +387 -0
  30. aspose_pdf/engine/auto_crop.py +101 -0
  31. aspose_pdf/engine/auto_tag.py +1451 -0
  32. aspose_pdf/engine/blank_pages.py +198 -0
  33. aspose_pdf/engine/blank_split.py +73 -0
  34. aspose_pdf/engine/bookmark_json.py +714 -0
  35. aspose_pdf/engine/bookmark_split.py +167 -0
  36. aspose_pdf/engine/ccitt.py +457 -0
  37. aspose_pdf/engine/ccitt_tables.py +231 -0
  38. aspose_pdf/engine/cert_chain.py +306 -0
  39. aspose_pdf/engine/cff_outlines.py +928 -0
  40. aspose_pdf/engine/cms.py +562 -0
  41. aspose_pdf/engine/comparison_html.py +435 -0
  42. aspose_pdf/engine/conformance.py +2748 -0
  43. aspose_pdf/engine/contact_sheet.py +215 -0
  44. aspose_pdf/engine/content_authoring.py +1347 -0
  45. aspose_pdf/engine/content_bounds.py +67 -0
  46. aspose_pdf/engine/content_isolation.py +180 -0
  47. aspose_pdf/engine/content_stream_parser.py +2318 -0
  48. aspose_pdf/engine/cos.py +416 -0
  49. aspose_pdf/engine/data/__init__.py +81 -0
  50. aspose_pdf/engine/data/agl/LICENSE-ADOBE-AGL.txt +28 -0
  51. aspose_pdf/engine/data/agl/LICENSE-REPORTLAB.txt +31 -0
  52. aspose_pdf/engine/data/agl/README.md +44 -0
  53. aspose_pdf/engine/data/agl/glyphlist.json.zlib +0 -0
  54. aspose_pdf/engine/data/cmaps/LICENSE-ADOBE-CMAP.txt +28 -0
  55. aspose_pdf/engine/data/cmaps/LICENSE-ADOBE-MAPPING.txt +28 -0
  56. aspose_pdf/engine/data/cmaps/README.md +51 -0
  57. aspose_pdf/engine/data/cmaps/predefined_cmaps_CNS1.json.zlib +0 -0
  58. aspose_pdf/engine/data/cmaps/predefined_cmaps_GB1.json.zlib +0 -0
  59. aspose_pdf/engine/data/cmaps/predefined_cmaps_Japan1.json.zlib +0 -0
  60. aspose_pdf/engine/data/cmaps/predefined_cmaps_Korea1.json.zlib +0 -0
  61. aspose_pdf/engine/data/cmaps/predefined_cmaps_index.json.zlib +0 -0
  62. aspose_pdf/engine/data/fonts/LICENSE-DEJAVU.txt +187 -0
  63. aspose_pdf/engine/data/fonts/LICENSE-OFL.txt +102 -0
  64. aspose_pdf/engine/data/fonts/README.md +47 -0
  65. aspose_pdf/engine/data/fonts/dingbats.ttf.zlib +0 -0
  66. aspose_pdf/engine/data/fonts/mono-bold.ttf.zlib +0 -0
  67. aspose_pdf/engine/data/fonts/mono-bolditalic.ttf.zlib +0 -0
  68. aspose_pdf/engine/data/fonts/mono-italic.ttf.zlib +0 -0
  69. aspose_pdf/engine/data/fonts/mono-regular.ttf.zlib +0 -0
  70. aspose_pdf/engine/data/fonts/sans-bold.ttf.zlib +0 -0
  71. aspose_pdf/engine/data/fonts/sans-bolditalic.ttf.zlib +0 -0
  72. aspose_pdf/engine/data/fonts/sans-italic.ttf.zlib +0 -0
  73. aspose_pdf/engine/data/fonts/sans-regular.ttf.zlib +0 -0
  74. aspose_pdf/engine/data/fonts/serif-bold.ttf.zlib +0 -0
  75. aspose_pdf/engine/data/fonts/serif-bolditalic.ttf.zlib +0 -0
  76. aspose_pdf/engine/data/fonts/serif-italic.ttf.zlib +0 -0
  77. aspose_pdf/engine/data/fonts/serif-regular.ttf.zlib +0 -0
  78. aspose_pdf/engine/data/fonts/symbol.ttf.zlib +0 -0
  79. aspose_pdf/engine/data/number.py +78 -0
  80. aspose_pdf/engine/data/types.py +156 -0
  81. aspose_pdf/engine/data/xmp.py +1458 -0
  82. aspose_pdf/engine/dct.py +854 -0
  83. aspose_pdf/engine/dss.py +658 -0
  84. aspose_pdf/engine/duplicate_pages.py +67 -0
  85. aspose_pdf/engine/encryption.py +967 -0
  86. aspose_pdf/engine/field_appearance.py +310 -0
  87. aspose_pdf/engine/file_output.py +98 -0
  88. aspose_pdf/engine/filters.py +958 -0
  89. aspose_pdf/engine/flatten.py +388 -0
  90. aspose_pdf/engine/font_authoring.py +609 -0
  91. aspose_pdf/engine/font_inventory.py +211 -0
  92. aspose_pdf/engine/font_resolver.py +829 -0
  93. aspose_pdf/engine/font_subset.py +545 -0
  94. aspose_pdf/engine/font_subset_cff.py +963 -0
  95. aspose_pdf/engine/font_subset_type1.py +114 -0
  96. aspose_pdf/engine/font_variations.py +159 -0
  97. aspose_pdf/engine/form_batch.py +134 -0
  98. aspose_pdf/engine/form_csv.py +267 -0
  99. aspose_pdf/engine/form_csv_export.py +131 -0
  100. aspose_pdf/engine/form_data.py +364 -0
  101. aspose_pdf/engine/form_field_edit.py +306 -0
  102. aspose_pdf/engine/form_fields.py +253 -0
  103. aspose_pdf/engine/form_json.py +89 -0
  104. aspose_pdf/engine/form_schema.py +246 -0
  105. aspose_pdf/engine/form_validation.py +395 -0
  106. aspose_pdf/engine/glyph_outlines.py +465 -0
  107. aspose_pdf/engine/graphics_absorb.py +1061 -0
  108. aspose_pdf/engine/grid_split.py +80 -0
  109. aspose_pdf/engine/gvar.py +467 -0
  110. aspose_pdf/engine/headings.py +273 -0
  111. aspose_pdf/engine/image_export.py +875 -0
  112. aspose_pdf/engine/image_import.py +219 -0
  113. aspose_pdf/engine/image_resample.py +116 -0
  114. aspose_pdf/engine/image_resolution.py +376 -0
  115. aspose_pdf/engine/image_zip.py +339 -0
  116. aspose_pdf/engine/imposition.py +233 -0
  117. aspose_pdf/engine/incremental_update.py +477 -0
  118. aspose_pdf/engine/inline_image.py +337 -0
  119. aspose_pdf/engine/interleave.py +188 -0
  120. aspose_pdf/engine/io.py +53 -0
  121. aspose_pdf/engine/jbig2.py +186 -0
  122. aspose_pdf/engine/jpeg2000.py +2124 -0
  123. aspose_pdf/engine/jpeg_encoder.py +706 -0
  124. aspose_pdf/engine/jpx.py +211 -0
  125. aspose_pdf/engine/link_extraction.py +378 -0
  126. aspose_pdf/engine/link_urls.py +252 -0
  127. aspose_pdf/engine/link_validation.py +555 -0
  128. aspose_pdf/engine/lists.py +307 -0
  129. aspose_pdf/engine/logging.py +18 -0
  130. aspose_pdf/engine/merge_bookmarks.py +180 -0
  131. aspose_pdf/engine/optional_content.py +1323 -0
  132. aspose_pdf/engine/page_count_split.py +60 -0
  133. aspose_pdf/engine/page_labels.py +295 -0
  134. aspose_pdf/engine/page_zip.py +219 -0
  135. aspose_pdf/engine/parser_exceptions.py +125 -0
  136. aspose_pdf/engine/pdf_matrix.py +90 -0
  137. aspose_pdf/engine/pdf_parser_cos.py +1611 -0
  138. aspose_pdf/engine/pdf_writer_cos.py +544 -0
  139. aspose_pdf/engine/predefined_cmaps.py +635 -0
  140. aspose_pdf/engine/primitives/__init__.py +5 -0
  141. aspose_pdf/engine/primitives/matrix.py +31 -0
  142. aspose_pdf/engine/pubsec.py +898 -0
  143. aspose_pdf/engine/rasterized_copy.py +171 -0
  144. aspose_pdf/engine/rasterizer.py +5483 -0
  145. aspose_pdf/engine/redaction.py +140 -0
  146. aspose_pdf/engine/revocation.py +495 -0
  147. aspose_pdf/engine/rich_text.py +415 -0
  148. aspose_pdf/engine/sanitize.py +412 -0
  149. aspose_pdf/engine/sfnt.py +247 -0
  150. aspose_pdf/engine/shading.py +2317 -0
  151. aspose_pdf/engine/sign_field.py +689 -0
  152. aspose_pdf/engine/signature_appearance.py +302 -0
  153. aspose_pdf/engine/signature_profiles.py +206 -0
  154. aspose_pdf/engine/signature_revisions.py +476 -0
  155. aspose_pdf/engine/signature_validator.py +313 -0
  156. aspose_pdf/engine/signed_changes.py +208 -0
  157. aspose_pdf/engine/signing.py +288 -0
  158. aspose_pdf/engine/simple_pdf.py +21416 -0
  159. aspose_pdf/engine/spread_split.py +330 -0
  160. aspose_pdf/engine/stamps.py +414 -0
  161. aspose_pdf/engine/std_font_data.py +201 -0
  162. aspose_pdf/engine/std_fonts.py +97 -0
  163. aspose_pdf/engine/std_metrics.py +364 -0
  164. aspose_pdf/engine/stream_output.py +22 -0
  165. aspose_pdf/engine/stroke.py +228 -0
  166. aspose_pdf/engine/svg_export.py +1162 -0
  167. aspose_pdf/engine/symbol_encodings.py +260 -0
  168. aspose_pdf/engine/tables.py +420 -0
  169. aspose_pdf/engine/text_blocks.py +467 -0
  170. aspose_pdf/engine/text_comparison.py +146 -0
  171. aspose_pdf/engine/text_edit.py +1936 -0
  172. aspose_pdf/engine/text_export.py +758 -0
  173. aspose_pdf/engine/text_faces.py +275 -0
  174. aspose_pdf/engine/text_highlight.py +197 -0
  175. aspose_pdf/engine/text_layout.py +574 -0
  176. aspose_pdf/engine/text_locate.py +423 -0
  177. aspose_pdf/engine/text_metrics.py +86 -0
  178. aspose_pdf/engine/text_outlines.py +150 -0
  179. aspose_pdf/engine/text_region.py +476 -0
  180. aspose_pdf/engine/text_selection.py +53 -0
  181. aspose_pdf/engine/text_split.py +141 -0
  182. aspose_pdf/engine/tiff_import.py +130 -0
  183. aspose_pdf/engine/timestamp.py +327 -0
  184. aspose_pdf/engine/toc.py +407 -0
  185. aspose_pdf/engine/type1_outlines.py +471 -0
  186. aspose_pdf/engine/viewer_preferences.py +275 -0
  187. aspose_pdf/engine/visual_comparison.py +318 -0
  188. aspose_pdf/engine/webp_encoder.py +107 -0
  189. aspose_pdf/engine/woff.py +302 -0
  190. aspose_pdf/engine/woff2.py +674 -0
  191. aspose_pdf/engine/word_extraction.py +235 -0
  192. aspose_pdf/exceptions.py +148 -0
  193. aspose_pdf/facades.py +1569 -0
  194. aspose_pdf/font_registry.py +149 -0
  195. aspose_pdf/font_repository.py +311 -0
  196. aspose_pdf/font_substitution.py +115 -0
  197. aspose_pdf/forms.py +1688 -0
  198. aspose_pdf/generated/__init__.py +3 -0
  199. aspose_pdf/generated/document.py +14 -0
  200. aspose_pdf/generated/forms.py +12 -0
  201. aspose_pdf/generated/pdfa.py +12 -0
  202. aspose_pdf/generated/security.py +33 -0
  203. aspose_pdf/geometry.py +149 -0
  204. aspose_pdf/graphics.py +256 -0
  205. aspose_pdf/html.py +117 -0
  206. aspose_pdf/image_resolution.py +45 -0
  207. aspose_pdf/images.py +524 -0
  208. aspose_pdf/interactive.py +435 -0
  209. aspose_pdf/latex.py +14 -0
  210. aspose_pdf/layers.py +482 -0
  211. aspose_pdf/license_management.py +65 -0
  212. aspose_pdf/link_extraction.py +52 -0
  213. aspose_pdf/link_validation.py +29 -0
  214. aspose_pdf/lists.py +365 -0
  215. aspose_pdf/load_limits.py +173 -0
  216. aspose_pdf/load_options.py +63 -0
  217. aspose_pdf/logical_structure.py +34 -0
  218. aspose_pdf/lowcode.py +1598 -0
  219. aspose_pdf/markdown.py +38 -0
  220. aspose_pdf/ofd.py +7 -0
  221. aspose_pdf/optimization.py +51 -0
  222. aspose_pdf/outlines.py +271 -0
  223. aspose_pdf/page_labels.py +169 -0
  224. aspose_pdf/page_ranges.py +90 -0
  225. aspose_pdf/page_size.py +220 -0
  226. aspose_pdf/pages.py +1883 -0
  227. aspose_pdf/paths.py +306 -0
  228. aspose_pdf/pdf_consts.py +19 -0
  229. aspose_pdf/pdfa.py +285 -0
  230. aspose_pdf/pdfua.py +194 -0
  231. aspose_pdf/pdfx.py +267 -0
  232. aspose_pdf/permissions.py +340 -0
  233. aspose_pdf/presentation.py +170 -0
  234. aspose_pdf/primitives.py +22 -0
  235. aspose_pdf/printing.py +41 -0
  236. aspose_pdf/py.typed +0 -0
  237. aspose_pdf/recipients.py +78 -0
  238. aspose_pdf/sanitization.py +90 -0
  239. aspose_pdf/save_format.py +25 -0
  240. aspose_pdf/save_options.py +25 -0
  241. aspose_pdf/security/__init__.py +160 -0
  242. aspose_pdf/security/impl/__init__.py +1 -0
  243. aspose_pdf/security/impl/digests/__init__.py +1 -0
  244. aspose_pdf/signature.py +385 -0
  245. aspose_pdf/signature_appearance.py +263 -0
  246. aspose_pdf/stamps.py +563 -0
  247. aspose_pdf/svg.py +41 -0
  248. aspose_pdf/table_extraction.py +156 -0
  249. aspose_pdf/tables.py +272 -0
  250. aspose_pdf/tagged.py +254 -0
  251. aspose_pdf/text.py +762 -0
  252. aspose_pdf/text_block.py +286 -0
  253. aspose_pdf/text_comparison.py +31 -0
  254. aspose_pdf/text_layout.py +100 -0
  255. aspose_pdf/utils.py +74 -0
  256. aspose_pdf/validation.py +286 -0
  257. aspose_pdf/viewer_preferences.py +375 -0
  258. aspose_pdf/visual_comparison.py +53 -0
  259. aspose_pdf/visualization.py +118 -0
  260. aspose_pdf/xmp.py +75 -0
  261. aspose_pdf_foss_for_python-0.1.0.dist-info/METADATA +2233 -0
  262. aspose_pdf_foss_for_python-0.1.0.dist-info/RECORD +265 -0
  263. aspose_pdf_foss_for_python-0.1.0.dist-info/WHEEL +5 -0
  264. aspose_pdf_foss_for_python-0.1.0.dist-info/licenses/LICENSE +21 -0
  265. aspose_pdf_foss_for_python-0.1.0.dist-info/top_level.txt +1 -0
aspose_pdf/__init__.py ADDED
@@ -0,0 +1,367 @@
1
+ """Production-facing public API for the ``aspose_pdf`` package."""
2
+
3
+ from ._version import __version__
4
+ from .annotations import (
5
+ Annotation,
6
+ AnnotationCollection,
7
+ AnnotationFlags,
8
+ AnnotationType,
9
+ CircleAnnotation,
10
+ FileAttachmentAnnotation,
11
+ FreeTextAnnotation,
12
+ HighlightAnnotation,
13
+ InkAnnotation,
14
+ LineAnnotation,
15
+ LinkAnnotation,
16
+ MarkupAnnotation,
17
+ PolygonAnnotation,
18
+ PolyLineAnnotation,
19
+ PopupAnnotation,
20
+ RedactAnnotation,
21
+ SquareAnnotation,
22
+ SquigglyAnnotation,
23
+ StampAnnotation,
24
+ StrikeOutAnnotation,
25
+ TextAnnotation,
26
+ UnderlineAnnotation,
27
+ quad_from_rect,
28
+ )
29
+ from .attachments import AF_RELATIONSHIPS, FileSpecification
30
+ from .auto_links import AutoLinkResult
31
+ from .block_extraction import ExtractedBlock
32
+ from .color import Color
33
+ from .destinations import NamedDestinationCollection
34
+ from .document import Document
35
+ from .document_fonts import DocumentFont
36
+ from .exceptions import (
37
+ FontEmbeddingException,
38
+ PdfResourceLimitException,
39
+ UnsupportedFeatureException,
40
+ )
41
+ from .facades import (
42
+ PdfAnnotationEditor,
43
+ PdfBookmarkEditor,
44
+ PdfConverter,
45
+ PdfExtractor,
46
+ PdfFileEditor,
47
+ PdfFileInfo,
48
+ PdfFileSecurity,
49
+ PdfFileStamp,
50
+ PdfPageEditor,
51
+ PdfXmpMetadata,
52
+ )
53
+ from .font_registry import FontDescriptor
54
+ from .font_repository import (
55
+ FileFontSource,
56
+ FolderFontSource,
57
+ FontRepository,
58
+ FontSource,
59
+ MemoryFontSource,
60
+ SystemFontSource,
61
+ )
62
+ from .font_substitution import FontSubstitutionOptions
63
+ from .forms import (
64
+ Field,
65
+ FieldType,
66
+ FieldWidget,
67
+ Form,
68
+ FormType,
69
+ FormValidationIssue,
70
+ UnsignedContent,
71
+ UnsignedContentAbsorber,
72
+ )
73
+ from .image_resolution import ImageResolutionIssue
74
+ from .interactive import (
75
+ Action,
76
+ Destination,
77
+ FitBDestination,
78
+ FitBHDestination,
79
+ FitBVDestination,
80
+ FitDestination,
81
+ FitHDestination,
82
+ FitRDestination,
83
+ FitVDestination,
84
+ GoToAction,
85
+ GoToRAction,
86
+ JavaScriptAction,
87
+ LaunchAction,
88
+ NamedAction,
89
+ ResetFormAction,
90
+ SubmitFormAction,
91
+ URIAction,
92
+ XYZDestination,
93
+ )
94
+ from .link_extraction import ExtractedLink
95
+ from .link_validation import LinkValidationIssue
96
+ from .lists import ListItem, TextList
97
+ from .load_limits import PdfLoadLimits
98
+ from .lowcode import (
99
+ ByteArrayDataSource,
100
+ DataSource,
101
+ FileDataSource,
102
+ FormFiller,
103
+ FormFillerOptions,
104
+ MergeOptions,
105
+ Merger,
106
+ OperationResult,
107
+ OptimizeOptions,
108
+ Optimizer,
109
+ PdfPlugin,
110
+ Plugin,
111
+ PluginOptions,
112
+ ResultContainer,
113
+ SplitOptions,
114
+ Splitter,
115
+ StreamDataSource,
116
+ TextExtractor,
117
+ TextExtractorOptions,
118
+ )
119
+ from .optimization import OptimizationOptions
120
+ from .outlines import OutlineCollection, OutlineItem
121
+ from .page_labels import NumberingStyle, PageLabel, PageLabelCollection
122
+ from .page_ranges import parse_page_range
123
+ from .page_size import PageSize
124
+ from .pages import Page, PageCollection
125
+ from .paths import GraphicsPath
126
+ from .pdfa import PdfAValidateOptions, PdfAValidationResult, PdfAValidator
127
+ from .pdfua import PdfUaValidateOptions, PdfUaValidationResult, PdfUaValidator
128
+ from .pdfx import (
129
+ PdfXStandard,
130
+ PdfXValidateOptions,
131
+ PdfXValidationResult,
132
+ PdfXValidator,
133
+ )
134
+ from .permissions import Permissions
135
+ from .recipients import Recipient
136
+ from .sanitization import SanitizationReport
137
+ from .signature import PdfSignature
138
+ from .signature_appearance import SignatureAppearance
139
+ from .stamps import (
140
+ HorizontalAlignment,
141
+ ImageStamp,
142
+ PageNumberStamp,
143
+ PageStamp,
144
+ Stamp,
145
+ TextStamp,
146
+ VerticalAlignment,
147
+ )
148
+ from .table_extraction import ExtractedTable
149
+ from .tables import Cell, Row, Table
150
+ from .tagged import StructureElement, TaggedContent
151
+ from .text import TextHighlightResult, TextMarkupResult, TextWord
152
+ from .text_block import Paragraph, TextBlock
153
+ from .text_comparison import PageTextComparison
154
+ from .text_layout import TextLayoutOptions
155
+ from .validation import (
156
+ CertificationLevel,
157
+ RevocationStatus,
158
+ TrustStatus,
159
+ ValidationMethod,
160
+ ValidationMode,
161
+ ValidationOptions,
162
+ ValidationResult,
163
+ ValidationStatus,
164
+ )
165
+ from .viewer_preferences import (
166
+ DuplexMode,
167
+ PageBoundary,
168
+ PageLayout,
169
+ PageMode,
170
+ PrintScaling,
171
+ ReadingDirection,
172
+ ViewerPreferences,
173
+ )
174
+ from .visual_comparison import PageVisualComparison
175
+ from .visualization import RasterizedPage
176
+ from .xmp import (
177
+ NamespaceProvider,
178
+ XmpArray,
179
+ XmpField,
180
+ XmpPacket,
181
+ XmpProperty,
182
+ XmpStruct,
183
+ )
184
+ from .xmp import (
185
+ parse as parse_xmp,
186
+ )
187
+ from .xmp import (
188
+ serialize as serialize_xmp,
189
+ )
190
+
191
+ __all__ = [
192
+ "AF_RELATIONSHIPS",
193
+ "Action",
194
+ "Annotation",
195
+ "AnnotationCollection",
196
+ "AnnotationFlags",
197
+ "AnnotationType",
198
+ "AutoLinkResult",
199
+ "ByteArrayDataSource",
200
+ "Cell",
201
+ "CertificationLevel",
202
+ "CircleAnnotation",
203
+ "Color",
204
+ "DataSource",
205
+ "Destination",
206
+ "Document",
207
+ "DocumentFont",
208
+ "DuplexMode",
209
+ "ExtractedBlock",
210
+ "ExtractedLink",
211
+ "ExtractedTable",
212
+ "Field",
213
+ "FieldType",
214
+ "FieldWidget",
215
+ "FileAttachmentAnnotation",
216
+ "FileDataSource",
217
+ "FileFontSource",
218
+ "FileSpecification",
219
+ "FitBDestination",
220
+ "FitBHDestination",
221
+ "FitBVDestination",
222
+ "FitDestination",
223
+ "FitHDestination",
224
+ "FitRDestination",
225
+ "FitVDestination",
226
+ "FolderFontSource",
227
+ "FontDescriptor",
228
+ "FontEmbeddingException",
229
+ "FontRepository",
230
+ "FontSource",
231
+ "FontSubstitutionOptions",
232
+ "Form",
233
+ "FormFiller",
234
+ "FormFillerOptions",
235
+ "FormType",
236
+ "FormValidationIssue",
237
+ "FreeTextAnnotation",
238
+ "GoToAction",
239
+ "GoToRAction",
240
+ "GraphicsPath",
241
+ "HighlightAnnotation",
242
+ "HorizontalAlignment",
243
+ "ImageResolutionIssue",
244
+ "ImageStamp",
245
+ "InkAnnotation",
246
+ "JavaScriptAction",
247
+ "LaunchAction",
248
+ "LineAnnotation",
249
+ "LinkAnnotation",
250
+ "LinkValidationIssue",
251
+ "ListItem",
252
+ "MarkupAnnotation",
253
+ "MemoryFontSource",
254
+ "MergeOptions",
255
+ "Merger",
256
+ "NamedAction",
257
+ "NamedDestinationCollection",
258
+ "NamespaceProvider",
259
+ "NumberingStyle",
260
+ "OperationResult",
261
+ "OptimizationOptions",
262
+ "OptimizeOptions",
263
+ "Optimizer",
264
+ "OutlineCollection",
265
+ "OutlineItem",
266
+ "Page",
267
+ "PageBoundary",
268
+ "PageCollection",
269
+ "PageLabel",
270
+ "PageLabelCollection",
271
+ "PageLayout",
272
+ "PageMode",
273
+ "PageNumberStamp",
274
+ "PageSize",
275
+ "PageStamp",
276
+ "PageTextComparison",
277
+ "PageVisualComparison",
278
+ "Paragraph",
279
+ "PdfAValidateOptions",
280
+ "PdfAValidationResult",
281
+ "PdfAValidator",
282
+ "PdfAnnotationEditor",
283
+ "PdfBookmarkEditor",
284
+ "PdfConverter",
285
+ "PdfExtractor",
286
+ "PdfFileEditor",
287
+ "PdfFileInfo",
288
+ "PdfFileSecurity",
289
+ "PdfFileStamp",
290
+ "PdfLoadLimits",
291
+ "PdfPageEditor",
292
+ "PdfPlugin",
293
+ "PdfResourceLimitException",
294
+ "PdfSignature",
295
+ "PdfUaValidateOptions",
296
+ "PdfUaValidationResult",
297
+ "PdfUaValidator",
298
+ "PdfXStandard",
299
+ "PdfXValidateOptions",
300
+ "PdfXValidationResult",
301
+ "PdfXValidator",
302
+ "PdfXmpMetadata",
303
+ "Permissions",
304
+ "Plugin",
305
+ "PluginOptions",
306
+ "PolyLineAnnotation",
307
+ "PolygonAnnotation",
308
+ "PopupAnnotation",
309
+ "PrintScaling",
310
+ "RasterizedPage",
311
+ "ReadingDirection",
312
+ "Recipient",
313
+ "RedactAnnotation",
314
+ "ResetFormAction",
315
+ "ResultContainer",
316
+ "RevocationStatus",
317
+ "Row",
318
+ "SanitizationReport",
319
+ "SignatureAppearance",
320
+ "SplitOptions",
321
+ "Splitter",
322
+ "SquareAnnotation",
323
+ "SquigglyAnnotation",
324
+ "Stamp",
325
+ "StampAnnotation",
326
+ "StreamDataSource",
327
+ "StrikeOutAnnotation",
328
+ "StructureElement",
329
+ "SubmitFormAction",
330
+ "SystemFontSource",
331
+ "Table",
332
+ "TaggedContent",
333
+ "TextAnnotation",
334
+ "TextBlock",
335
+ "TextExtractor",
336
+ "TextExtractorOptions",
337
+ "TextHighlightResult",
338
+ "TextLayoutOptions",
339
+ "TextList",
340
+ "TextMarkupResult",
341
+ "TextStamp",
342
+ "TextWord",
343
+ "TrustStatus",
344
+ "URIAction",
345
+ "UnderlineAnnotation",
346
+ "UnsignedContent",
347
+ "UnsignedContentAbsorber",
348
+ "UnsupportedFeatureException",
349
+ "ValidationMethod",
350
+ "ValidationMode",
351
+ "ValidationOptions",
352
+ "ValidationResult",
353
+ "ValidationStatus",
354
+ "VerticalAlignment",
355
+ "ViewerPreferences",
356
+ "XYZDestination",
357
+ "XmpArray",
358
+ "XmpField",
359
+ "XmpPacket",
360
+ "XmpProperty",
361
+ "XmpStruct",
362
+ "__version__",
363
+ "parse_page_range",
364
+ "parse_xmp",
365
+ "quad_from_rect",
366
+ "serialize_xmp",
367
+ ]
@@ -0,0 +1,142 @@
1
+ """Explicit rejection of compatibility names that have no implementation.
2
+
3
+ The package ships option, enumeration, and value objects for the parts of the
4
+ Aspose.PDF API this project does not implement (HTML/SVG/CGM/OFD/CDR import,
5
+ LaTeX authoring, PPTX export, printing). They exist so that porting code keeps
6
+ importing, not so that it silently produces nothing: every real operation routes
7
+ its format/option arguments through the helpers below and raises
8
+ :class:`~aspose_pdf.exceptions.UnsupportedFeatureException` instead.
9
+
10
+ Surfaces are matched by class name rather than by import so that this module
11
+ stays free of package-level import cycles and keeps working for the thin
12
+ subclasses in :mod:`aspose_pdf.svg` and friends.
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ from typing import Any, NoReturn
18
+
19
+ from aspose_pdf.exceptions import UnsupportedFeatureException
20
+
21
+ __all__ = [
22
+ "describe",
23
+ "reject_load_options",
24
+ "reject_operation",
25
+ "require_pdf_save_format",
26
+ ]
27
+
28
+ _DOC_POINTER = (
29
+ "See 'Known Unsupported Compatibility Surfaces' in supported-features.md."
30
+ )
31
+
32
+ # Class name -> feature the class stands for.
33
+ _UNSUPPORTED_TYPES: dict[str, str] = {
34
+ "CdrLoadOptions": "CorelDRAW (CDR) import",
35
+ "CgmLoadOptions": "CGM import",
36
+ "HtmlLoadOptions": "HTML import",
37
+ "LatexFragment": "LaTeX authoring",
38
+ "OfdLoadOptions": "OFD import",
39
+ "PrinterSettings": "printing",
40
+ "SvgLoadOptions": "SVG import",
41
+ }
42
+
43
+ # (enum class name, member name) -> feature the member stands for.
44
+ _UNSUPPORTED_MEMBERS: dict[tuple[str, str], str] = {
45
+ ("SaveFormat", "PPTX"): "PPTX export",
46
+ }
47
+
48
+ # (enum class name, member name) pairs that mean "plain PDF".
49
+ _PDF_MEMBERS: frozenset[tuple[str, str]] = frozenset(
50
+ {("DocFormat", "PDF"), ("SaveFormat", "PDF")}
51
+ )
52
+
53
+
54
+ def _is_package_class(cls: type) -> bool:
55
+ module = getattr(cls, "__module__", "")
56
+ return module == "aspose_pdf" or module.startswith("aspose_pdf.")
57
+
58
+
59
+ def _member_key(value: Any) -> tuple[str, str] | None:
60
+ name = getattr(value, "name", None)
61
+ if not isinstance(name, str):
62
+ return None
63
+ cls = type(value)
64
+ if not _is_package_class(cls):
65
+ return None
66
+ return (cls.__name__, name)
67
+
68
+
69
+ def describe(value: Any) -> str | None:
70
+ """Return the unimplemented feature *value* stands for, else ``None``."""
71
+ if value is None:
72
+ return None
73
+
74
+ key = _member_key(value)
75
+ if key is not None and key in _UNSUPPORTED_MEMBERS:
76
+ return _UNSUPPORTED_MEMBERS[key]
77
+
78
+ for cls in type(value).__mro__:
79
+ if not _is_package_class(cls):
80
+ continue
81
+ feature = _UNSUPPORTED_TYPES.get(cls.__name__)
82
+ if feature is not None:
83
+ return feature
84
+ return None
85
+
86
+
87
+ def _fail(feature: str, subject: str) -> NoReturn:
88
+ raise UnsupportedFeatureException(
89
+ f"{feature} is not implemented; {subject} is an API-compatibility "
90
+ f"placeholder. {_DOC_POINTER}"
91
+ )
92
+
93
+
94
+ def reject_operation(value: Any, subject: str) -> NoReturn:
95
+ """Reject an operation on a placeholder object.
96
+
97
+ A placeholder may be *constructed* -- that is what keeps ported code
98
+ importing and running as far as the first real use. Asking one to do work
99
+ is the real use, and doing nothing quietly would leave the caller to find
100
+ out from a blank page.
101
+ """
102
+ feature = describe(value) or "this surface"
103
+ _fail(feature, subject)
104
+
105
+
106
+ def reject_load_options(value: Any) -> NoReturn:
107
+ """Reject a non-``None`` load-options argument.
108
+
109
+ No load options are implemented: importing a non-PDF format is out of
110
+ scope, and PDF loading is configured through ``password`` and ``limits``.
111
+ """
112
+ feature = describe(value)
113
+ if feature is not None:
114
+ _fail(feature, f"`{type(value).__name__}`")
115
+ raise TypeError(
116
+ "load options are not supported; loading accepts PDF data only, "
117
+ "configured through the password and limits keywords. "
118
+ f"{_DOC_POINTER}"
119
+ )
120
+
121
+
122
+ def require_pdf_save_format(value: Any) -> None:
123
+ """Accept ``None`` or a PDF save format; reject every other export."""
124
+ if value is None:
125
+ return
126
+
127
+ key = _member_key(value)
128
+ if key is not None:
129
+ if key in _PDF_MEMBERS:
130
+ return
131
+ feature = _UNSUPPORTED_MEMBERS.get(key)
132
+ if feature is not None:
133
+ _fail(feature, f"`{key[0]}.{key[1]}`")
134
+
135
+ feature = describe(value)
136
+ if feature is not None:
137
+ _fail(feature, f"`{type(value).__name__}`")
138
+
139
+ raise TypeError(
140
+ "save_format must be SaveFormat.PDF, DocFormat.PDF, or None; "
141
+ f"saving writes PDF only. {_DOC_POINTER}"
142
+ )
@@ -0,0 +1,108 @@
1
+ """The files an HTML, Markdown or SVG export writes, and the options that shape them.
2
+
3
+ An export can be several files -- a document per page, the images it links to
4
+ -- so everything is produced in memory first, the targets are checked against
5
+ ``overwrite`` all together, and only then is anything written, each file
6
+ atomically (:func:`~aspose_pdf.engine.file_output.write_file_atomically`). A
7
+ refused save writes nothing; a failed one leaves every file it had not reached
8
+ as it was, and every file it had reached complete.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import os
14
+ import urllib.parse
15
+ from pathlib import Path
16
+ from typing import Any
17
+
18
+ from aspose_pdf.engine.file_output import write_file_atomically
19
+ from aspose_pdf.exceptions import PdfValidationException, UnsupportedFeatureException
20
+
21
+
22
+ def directory_beside(target: Path, directory: str | os.PathLike[str]) -> Path:
23
+ """*directory*, a relative one taken from the folder *target* is written to."""
24
+ path = Path(directory)
25
+ return path if path.is_absolute() else target.parent / path
26
+
27
+
28
+ def relative_url(path: Path, base: Path) -> str:
29
+ """The URL of *path* as a document in folder *base* refers to it."""
30
+ try:
31
+ relative = os.path.relpath(path, base)
32
+ except ValueError: # another drive (Windows): no relative path exists
33
+ return path.resolve().as_uri()
34
+ return urllib.parse.quote(Path(relative).as_posix())
35
+
36
+
37
+ class ExportImages:
38
+ """Figures written as PNG files in *directory*, each distinct image once.
39
+
40
+ Called with a figure's PNG bytes, it names the file the image goes to and
41
+ returns the URL the document at *base* refers to it by.
42
+ """
43
+
44
+ def __init__(self, directory: Path, stem: str, base: Path) -> None:
45
+ self.directory = directory
46
+ self.stem = stem
47
+ self.base = base
48
+ self.files: dict[bytes, Path] = {}
49
+
50
+ def __call__(self, png: bytes) -> str:
51
+ path = self.files.get(png)
52
+ if path is None:
53
+ path = self.directory / f"{self.stem}-image-{len(self.files) + 1}.png"
54
+ self.files[png] = path
55
+ return relative_url(path, self.base)
56
+
57
+ def outputs(self) -> list[tuple[Path, bytes]]:
58
+ return [(path, png) for png, path in self.files.items()]
59
+
60
+
61
+ def check_targets(paths: list[Path], overwrite: bool) -> None:
62
+ """Refuse the whole export when one of its files exists and may not be replaced."""
63
+ if overwrite:
64
+ return
65
+ for path in paths:
66
+ if path.exists():
67
+ raise FileExistsError(f"File already exists: {path}")
68
+
69
+
70
+ def write_files(files: list[tuple[Path, bytes]], overwrite: bool) -> None:
71
+ """Write every file of an export, after checking all of them."""
72
+ check_targets([path for path, _ in files], overwrite)
73
+ for path, data in files:
74
+ path.parent.mkdir(parents=True, exist_ok=True)
75
+ write_file_atomically(path, data)
76
+
77
+
78
+ def html_arguments(options: Any) -> dict[str, Any]:
79
+ """``Document.save_as_html`` keywords for an ``HtmlSaveOptions``."""
80
+ for name in ("xps_intermediate_file", "aps_intermediate_file"):
81
+ if getattr(options, name, None) is not None:
82
+ raise UnsupportedFeatureException(
83
+ f"HtmlSaveOptions.{name} names an intermediate file this export "
84
+ "does not produce: it converts the page structure directly"
85
+ )
86
+ gap = getattr(options, "max_distance_between_text_lines", None)
87
+ return {
88
+ "split_into_pages": bool(getattr(options, "split_into_pages", False)),
89
+ "resources_directory": getattr(options, "resources_directory", None),
90
+ "clip_to_page": bool(getattr(options, "use_area_clipping", True)),
91
+ "paragraph_gap": None if gap is None else float(gap),
92
+ }
93
+
94
+
95
+ def markdown_arguments(options: Any) -> dict[str, Any]:
96
+ """``Document.save_as_markdown`` keywords for a ``MarkdownSaveOptions``."""
97
+ image_directory = getattr(options, "image_directory", None)
98
+ resources_name = getattr(options, "resources_directory_name", None)
99
+ if image_directory is not None and resources_name is not None:
100
+ raise PdfValidationException(
101
+ "MarkdownSaveOptions: set image_directory or resources_directory_name, "
102
+ "not both -- they name the same folder"
103
+ )
104
+ return {
105
+ "embed_images": bool(getattr(options, "extract_images", True)),
106
+ "image_directory": image_directory if image_directory is not None else resources_name,
107
+ "markdown_format": getattr(options, "markdown_format", "GFM"),
108
+ }