Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/pypdf/constants.py: 94%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""Various constants, enums, and flags to aid readability."""
3from enum import Enum, IntFlag, auto, unique
6class StrEnum(str, Enum): # Once we are on Python 3.11+: enum.StrEnum
7 def __str__(self) -> str:
8 return str(self.value)
11class Core:
12 """Keywords that don't quite belong anywhere else."""
14 OUTLINES = "/Outlines"
15 THREADS = "/Threads"
16 PAGE = "/Page"
17 PAGES = "/Pages"
18 CATALOG = "/Catalog"
21class TrailerKeys:
22 SIZE = "/Size"
23 PREV = "/Prev"
24 ROOT = "/Root"
25 ENCRYPT = "/Encrypt"
26 INFO = "/Info"
27 ID = "/ID"
30class CatalogAttributes:
31 NAMES = "/Names"
32 DESTS = "/Dests"
35class EncryptionDictAttributes:
36 """
37 Additional encryption dictionary entries for the standard security handler.
39 Table 3.19, Page 122.
40 Table 21 of the 2.0 manual.
41 """
43 R = "/R" # number, required; revision of the standard security handler
44 O = "/O" # 32-byte string, required # noqa: E741
45 U = "/U" # 32-byte string, required
46 P = "/P" # integer flag, required; permitted operations
47 ENCRYPT_METADATA = "/EncryptMetadata" # boolean flag, optional
50class UserAccessPermissions(IntFlag):
51 """
52 Table 3.20 User access permissions.
53 Table 22 of the 2.0 manual.
54 """
56 R1 = 1
57 R2 = 2
58 PRINT = 4
59 MODIFY = 8
60 EXTRACT = 16
61 ADD_OR_MODIFY = 32
62 R7 = 64
63 R8 = 128
64 FILL_FORM_FIELDS = 256
65 EXTRACT_TEXT_AND_GRAPHICS = 512
66 ASSEMBLE_DOC = 1024
67 PRINT_TO_REPRESENTATION = 2048
68 R13 = 2**12
69 R14 = 2**13
70 R15 = 2**14
71 R16 = 2**15
72 R17 = 2**16
73 R18 = 2**17
74 R19 = 2**18
75 R20 = 2**19
76 R21 = 2**20
77 R22 = 2**21
78 R23 = 2**22
79 R24 = 2**23
80 R25 = 2**24
81 R26 = 2**25
82 R27 = 2**26
83 R28 = 2**27
84 R29 = 2**28
85 R30 = 2**29
86 R31 = 2**30
87 R32 = 2**31
89 @classmethod
90 def _is_reserved(cls, name: str) -> bool:
91 """Check if the given name corresponds to a reserved flag entry."""
92 return name.startswith("R") and name[1:].isdigit()
94 @classmethod
95 def _is_active(cls, name: str) -> bool:
96 """Check if the given reserved name defaults to 1 = active."""
97 return name not in {"R1", "R2"}
99 def to_dict(self) -> dict[str, bool]:
100 """Convert the given flag value to a corresponding verbose name mapping."""
101 result: dict[str, bool] = {}
102 for name, flag in UserAccessPermissions.__members__.items():
103 if UserAccessPermissions._is_reserved(name):
104 continue
105 result[name.lower()] = (self & flag) == flag
106 return result
108 @classmethod
109 def from_dict(cls, value: dict[str, bool]) -> "UserAccessPermissions":
110 """Convert the verbose name mapping to the corresponding flag value."""
111 value_copy = value.copy()
112 result = cls(0)
113 for name, flag in cls.__members__.items():
114 if cls._is_reserved(name):
115 # Reserved names have a required value. Use it.
116 if cls._is_active(name):
117 result |= flag
118 continue
119 is_active = value_copy.pop(name.lower(), False)
120 if is_active:
121 result |= flag
122 if value_copy:
123 raise ValueError(f"Unknown dictionary keys: {value_copy!r}")
124 return result
126 @classmethod
127 def all(cls) -> "UserAccessPermissions":
128 return cls((2**32 - 1) - cls.R1 - cls.R2)
131class Resources:
132 """
133 Table 3.30 Entries in a resource dictionary.
134 Table 34 in the 2.0 reference.
135 """
137 EXT_G_STATE = "/ExtGState" # dictionary, optional
138 COLOR_SPACE = "/ColorSpace" # dictionary, optional
139 PATTERN = "/Pattern" # dictionary, optional
140 SHADING = "/Shading" # dictionary, optional
141 XOBJECT = "/XObject" # dictionary, optional
142 FONT = "/Font" # dictionary, optional
143 PROC_SET = "/ProcSet" # array, optional
144 PROPERTIES = "/Properties" # dictionary, optional
147class PagesAttributes:
148 """§7.7.3.2 of the 1.7 and 2.0 reference."""
150 TYPE = "/Type" # name, required; must be /Pages
151 PARENT = "/Parent" # dictionary, required; indirect reference to pages object
152 KIDS = "/Kids" # array, required; List of indirect references
153 COUNT = "/Count"
154 # integer, required; the number of leaf nodes (page objects)
155 # that are descendants of this node within the page tree
158class PageAttributes:
159 """§7.7.3.3 of the 1.7 and 2.0 reference."""
161 TYPE = "/Type" # name, required; must be /Page
162 PARENT = "/Parent" # dictionary, required; a pages object
163 LAST_MODIFIED = (
164 "/LastModified" # date, optional; date and time of last modification
165 )
166 RESOURCES = "/Resources" # dictionary, required if there are any
167 MEDIABOX = "/MediaBox" # rectangle, required; rectangle specifying page size
168 CROPBOX = "/CropBox" # rectangle, optional
169 BLEEDBOX = "/BleedBox" # rectangle, optional
170 TRIMBOX = "/TrimBox" # rectangle, optional
171 ARTBOX = "/ArtBox" # rectangle, optional
172 BOX_COLOR_INFO = "/BoxColorInfo" # dictionary, optional
173 CONTENTS = "/Contents" # stream or array, optional
174 ROTATE = "/Rotate" # integer, optional; page rotation in degrees
175 GROUP = "/Group" # dictionary, optional; page group
176 THUMB = "/Thumb" # stream, optional; indirect reference to image of the page
177 B = "/B" # array, optional
178 DUR = "/Dur" # number, optional
179 TRANS = "/Trans" # dictionary, optional
180 ANNOTS = "/Annots" # array, optional; an array of annotations
181 AA = "/AA" # dictionary, optional
182 METADATA = "/Metadata" # stream, optional
183 PIECE_INFO = "/PieceInfo" # dictionary, optional
184 STRUCT_PARENTS = "/StructParents" # integer, optional
185 ID = "/ID" # byte string, optional
186 PZ = "/PZ" # number, optional
187 SEPARATION_INFO = "/SeparationInfo" # dictionary, optional
188 TABS = "/Tabs" # name, optional
189 TEMPLATE_INSTANTIATED = "/TemplateInstantiated" # name, optional
190 PRES_STEPS = "/PresSteps" # dictionary, optional
191 USER_UNIT = "/UserUnit" # number, optional
192 VP = "/VP" # dictionary, optional
193 AF = "/AF" # array of dictionaries, optional
194 OUTPUT_INTENTS = "/OutputIntents" # array, optional
195 D_PART = "/DPart" # dictionary, required, if this page is within the range of a DPart, not permitted otherwise
198class FileSpecificationDictionaryEntries:
199 """Table 3.41 Entries in a file specification dictionary."""
201 Type = "/Type"
202 FS = "/FS" # The name of the file system to be used to interpret this file specification
203 F = "/F" # A file specification string of the form described in §3.10.1
204 UF = "/UF" # A Unicode string of the file as described in §3.10.1
205 DOS = "/DOS"
206 Mac = "/Mac"
207 Unix = "/Unix"
208 ID = "/ID"
209 V = "/V"
210 EF = "/EF" # dictionary, containing a subset of the keys F, UF, DOS, Mac, and Unix
211 RF = "/RF" # dictionary, containing arrays of /EmbeddedFile
212 DESC = "/Desc" # description of the file
213 Cl = "/Cl"
216class StreamAttributes:
217 """
218 Table 4.2.
219 Table 5 in the 2.0 reference.
220 """
222 LENGTH = "/Length" # integer, required
223 FILTER = "/Filter" # name or array of names, optional
224 DECODE_PARMS = "/DecodeParms" # variable, optional -- 'decodeParams is wrong
227@unique
228class FilterTypes(StrEnum):
229 """§7.4 of the 1.7 and 2.0 references."""
231 ASCII_HEX_DECODE = "/ASCIIHexDecode" # abbreviation: AHx
232 ASCII_85_DECODE = "/ASCII85Decode" # abbreviation: A85
233 LZW_DECODE = "/LZWDecode" # abbreviation: LZW
234 FLATE_DECODE = "/FlateDecode" # abbreviation: Fl
235 RUN_LENGTH_DECODE = "/RunLengthDecode" # abbreviation: RL
236 CCITT_FAX_DECODE = "/CCITTFaxDecode" # abbreviation: CCF
237 DCT_DECODE = "/DCTDecode" # abbreviation: DCT
238 JPX_DECODE = "/JPXDecode"
239 JBIG2_DECODE = "/JBIG2Decode"
242class FilterTypeAbbreviations:
243 """§8.9.7 of the 1.7 and 2.0 references."""
245 AHx = "/AHx"
246 A85 = "/A85"
247 LZW = "/LZW"
248 FL = "/Fl"
249 RL = "/RL"
250 CCF = "/CCF"
251 DCT = "/DCT"
254class LzwFilterParameters:
255 """
256 Table 4.4.
257 Table 8 in the 2.0 reference.
258 """
260 PREDICTOR = "/Predictor" # integer
261 COLORS = "/Colors" # integer
262 BITS_PER_COMPONENT = "/BitsPerComponent" # integer
263 COLUMNS = "/Columns" # integer
264 EARLY_CHANGE = "/EarlyChange" # integer
267class CcittFaxDecodeParameters:
268 """
269 Table 4.5.
270 Table 11 in the 2.0 reference.
271 """
273 K = "/K" # integer
274 END_OF_LINE = "/EndOfLine" # boolean
275 ENCODED_BYTE_ALIGN = "/EncodedByteAlign" # boolean
276 COLUMNS = "/Columns" # integer
277 ROWS = "/Rows" # integer
278 END_OF_BLOCK = "/EndOfBlock" # boolean
279 BLACK_IS_1 = "/BlackIs1" # boolean
280 DAMAGED_ROWS_BEFORE_ERROR = "/DamagedRowsBeforeError" # integer
283class ImageAttributes:
284 """§11.6.5 of the 1.7 and 2.0 references."""
286 TYPE = "/Type" # name, required; must be /XObject
287 SUBTYPE = "/Subtype" # name, required; must be /Image
288 NAME = "/Name" # name, required
289 WIDTH = "/Width" # integer, required
290 HEIGHT = "/Height" # integer, required
291 BITS_PER_COMPONENT = "/BitsPerComponent" # integer, required
292 COLOR_SPACE = "/ColorSpace" # name, required
293 DECODE = "/Decode" # array, optional
294 INTENT = "/Intent" # string, optional
295 INTERPOLATE = "/Interpolate" # boolean, optional
296 IMAGE_MASK = "/ImageMask" # boolean, optional
297 MASK = "/Mask" # 1-bit image mask stream
298 S_MASK = "/SMask" # dictionary or name, optional
301class ColorSpaces:
302 DEVICE_RGB = "/DeviceRGB"
303 DEVICE_CMYK = "/DeviceCMYK"
304 DEVICE_GRAY = "/DeviceGray"
307class TypArguments:
308 """Table 8.2 of the PDF 1.7 reference."""
310 LEFT = "/Left"
311 RIGHT = "/Right"
312 BOTTOM = "/Bottom"
313 TOP = "/Top"
316class TypFitArguments:
317 """Table 8.2 of the PDF 1.7 reference."""
319 XYZ = "/XYZ"
320 FIT = "/Fit"
321 FIT_H = "/FitH"
322 FIT_V = "/FitV"
323 FIT_R = "/FitR"
324 FIT_B = "/FitB"
325 FIT_BH = "/FitBH"
326 FIT_BV = "/FitBV"
329class GoToActionArguments:
330 S = "/S" # name, required: type of action
331 D = "/D" # name, byte string, or array, required: destination to jump to
332 SD = "/SD" # array, optional: structure destination to jump to
335class AnnotationDictionaryAttributes:
336 """Table 8.15 Entries common to all annotation dictionaries."""
338 Type = "/Type"
339 Subtype = "/Subtype"
340 Rect = "/Rect"
341 Contents = "/Contents"
342 P = "/P"
343 NM = "/NM"
344 M = "/M"
345 F = "/F"
346 AP = "/AP"
347 AS = "/AS"
348 DA = "/DA"
349 Border = "/Border"
350 C = "/C"
351 StructParent = "/StructParent"
352 OC = "/OC"
355class InteractiveFormDictEntries:
356 Fields = "/Fields"
357 NeedAppearances = "/NeedAppearances"
358 SigFlags = "/SigFlags"
359 CO = "/CO"
360 DR = "/DR"
361 DA = "/DA"
362 Q = "/Q"
363 XFA = "/XFA"
366class FieldDictionaryAttributes:
367 """
368 Entries common to all field dictionaries (Table 8.69 PDF 1.7 reference)
369 (*very partially documented here*).
371 FFBits provides the constants used for `/Ff` from Table 8.70/8.75/8.77/8.79
372 """
374 FT = "/FT" # name, required for terminal fields
375 Parent = "/Parent" # dictionary, required for children
376 Kids = "/Kids" # array, sometimes required
377 T = "/T" # text string, optional
378 TU = "/TU" # text string, optional
379 TM = "/TM" # text string, optional
380 Ff = "/Ff" # integer, optional
381 V = "/V" # text string or array, optional
382 DV = "/DV" # text string, optional
383 AA = "/AA" # dictionary, optional
384 Opt = "/Opt" # array, optional
386 class FfBits(IntFlag):
387 """
388 Ease building /Ff flags
389 Some entries may be specific to:
391 * Text (Tx) (Table 8.75 PDF 1.7 reference)
392 * Buttons (Btn) (Table 8.77 PDF 1.7 reference)
393 * Choice (Ch) (Table 8.79 PDF 1.7 reference)
394 """
396 ReadOnly = 1 << 0
397 """common to Tx/Btn/Ch in Table 8.70"""
398 Required = 1 << 1
399 """common to Tx/Btn/Ch in Table 8.70"""
400 NoExport = 1 << 2
401 """common to Tx/Btn/Ch in Table 8.70"""
403 Multiline = 1 << 12
404 """Tx"""
405 Password = 1 << 13
406 """Tx"""
408 NoToggleToOff = 1 << 14
409 """Btn"""
410 Radio = 1 << 15
411 """Btn"""
412 Pushbutton = 1 << 16
413 """Btn"""
415 Combo = 1 << 17
416 """Ch"""
417 Edit = 1 << 18
418 """Ch"""
419 Sort = 1 << 19
420 """Ch"""
422 FileSelect = 1 << 20
423 """Tx"""
425 MultiSelect = 1 << 21
426 """Tx"""
428 DoNotSpellCheck = 1 << 22
429 """Tx/Ch"""
430 DoNotScroll = 1 << 23
431 """Tx"""
432 Comb = 1 << 24
433 """Tx"""
435 RadiosInUnison = 1 << 25
436 """Btn"""
438 RichText = 1 << 25
439 """Tx"""
441 CommitOnSelChange = 1 << 26
442 """Ch"""
444 @classmethod
445 def attributes(cls) -> tuple[str, ...]:
446 """
447 Get a tuple of all the attributes present in a Field Dictionary.
449 This method returns a tuple of all the attribute constants defined in
450 the FieldDictionaryAttributes class. These attributes correspond to the
451 entries that are common to all field dictionaries as specified in the
452 PDF 1.7 reference.
454 Returns:
455 A tuple containing all the attribute constants.
457 """
458 return (
459 cls.TM,
460 cls.T,
461 cls.FT,
462 cls.Parent,
463 cls.TU,
464 cls.Ff,
465 cls.V,
466 cls.DV,
467 cls.Kids,
468 cls.AA,
469 )
471 @classmethod
472 def attributes_dict(cls) -> dict[str, str]:
473 """
474 Get a dictionary of attribute keys and their human-readable names.
476 This method returns a dictionary where the keys are the attribute
477 constants defined in the FieldDictionaryAttributes class and the values
478 are their corresponding human-readable names. These attributes
479 correspond to the entries that are common to all field dictionaries as
480 specified in the PDF 1.7 reference.
482 Returns:
483 A dictionary containing attribute keys and their names.
485 """
486 return {
487 cls.FT: "Field Type",
488 cls.Parent: "Parent",
489 cls.T: "Field Name",
490 cls.TU: "Alternate Field Name",
491 cls.TM: "Mapping Name",
492 cls.Ff: "Field Flags",
493 cls.V: "Value",
494 cls.DV: "Default Value",
495 }
498class CheckboxRadioButtonAttributes:
499 """Table 8.76 Field flags common to all field types."""
501 Opt = "/Opt" # Options, Optional
503 @classmethod
504 def attributes(cls) -> tuple[str, ...]:
505 """
506 Get a tuple of all the attributes present in a Field Dictionary.
508 This method returns a tuple of all the attribute constants defined in
509 the CheckboxRadioButtonAttributes class. These attributes correspond to
510 the entries that are common to all field dictionaries as specified in
511 the PDF 1.7 reference.
513 Returns:
514 A tuple containing all the attribute constants.
516 """
517 return (cls.Opt,)
519 @classmethod
520 def attributes_dict(cls) -> dict[str, str]:
521 """
522 Get a dictionary of attribute keys and their human-readable names.
524 This method returns a dictionary where the keys are the attribute
525 constants defined in the CheckboxRadioButtonAttributes class and the
526 values are their corresponding human-readable names. These attributes
527 correspond to the entries that are common to all field dictionaries as
528 specified in the PDF 1.7 reference.
530 Returns:
531 A dictionary containing attribute keys and their names.
533 """
534 return {
535 cls.Opt: "Options",
536 }
539class FieldFlag(IntFlag):
540 """Table 8.70 Field flags common to all field types."""
542 READ_ONLY = 1
543 REQUIRED = 2
544 NO_EXPORT = 4
547class DocumentInformationAttributes:
548 """Table 10.2 Entries in the document information dictionary."""
550 TITLE = "/Title" # text string, optional
551 AUTHOR = "/Author" # text string, optional
552 SUBJECT = "/Subject" # text string, optional
553 KEYWORDS = "/Keywords" # text string, optional
554 CREATOR = "/Creator" # text string, optional
555 PRODUCER = "/Producer" # text string, optional
556 CREATION_DATE = "/CreationDate" # date, optional
557 MOD_DATE = "/ModDate" # date, optional
558 TRAPPED = "/Trapped" # name, optional
561class PageLayouts:
562 """
563 Page 84, PDF 1.4 reference.
564 Page 115, PDF 2.0 reference.
565 """
567 SINGLE_PAGE = "/SinglePage"
568 ONE_COLUMN = "/OneColumn"
569 TWO_COLUMN_LEFT = "/TwoColumnLeft"
570 TWO_COLUMN_RIGHT = "/TwoColumnRight"
571 TWO_PAGE_LEFT = "/TwoPageLeft" # (PDF 1.5)
572 TWO_PAGE_RIGHT = "/TwoPageRight" # (PDF 1.5)
575class GraphicsStateParameters:
576 """Table 58 – Entries in a Graphics State Parameter Dictionary"""
578 TYPE = "/Type" # name, optional
579 LW = "/LW" # number, optional
580 LC = "/LC" # integer, optional
581 LJ = "/LJ" # integer, optional
582 ML = "/ML" # number, optional
583 D = "/D" # array, optional
584 RI = "/RI" # name, optional
585 OP = "/OP"
586 op = "/op"
587 OPM = "/OPM"
588 FONT = "/Font" # array, optional
589 BG = "/BG"
590 BG2 = "/BG2"
591 UCR = "/UCR"
592 UCR2 = "/UCR2"
593 TR = "/TR"
594 TR2 = "/TR2"
595 HT = "/HT"
596 FL = "/FL"
597 SM = "/SM"
598 SA = "/SA"
599 BM = "/BM"
600 S_MASK = "/SMask" # dictionary or name, optional
601 CA = "/CA"
602 ca = "/ca"
603 AIS = "/AIS"
604 TK = "/TK"
607class CatalogDictionary:
608 """§7.7.2 of the 1.7 and 2.0 references."""
610 TYPE = "/Type" # name, required; must be /Catalog
611 VERSION = "/Version" # name
612 EXTENSIONS = "/Extensions" # dictionary, optional; ISO 32000-1
613 PAGES = "/Pages" # dictionary, required
614 PAGE_LABELS = "/PageLabels" # number tree, optional
615 NAMES = "/Names" # dictionary, optional
616 DESTS = "/Dests" # dictionary, optional
617 VIEWER_PREFERENCES = "/ViewerPreferences" # dictionary, optional
618 PAGE_LAYOUT = "/PageLayout" # name, optional
619 PAGE_MODE = "/PageMode" # name, optional
620 OUTLINES = "/Outlines" # dictionary, optional
621 THREADS = "/Threads" # array, optional
622 OPEN_ACTION = "/OpenAction" # array or dictionary or name, optional
623 AA = "/AA" # dictionary, optional
624 URI = "/URI" # dictionary, optional
625 ACRO_FORM = "/AcroForm" # dictionary, optional
626 METADATA = "/Metadata" # stream, optional
627 STRUCT_TREE_ROOT = "/StructTreeRoot" # dictionary, optional
628 MARK_INFO = "/MarkInfo" # dictionary, optional
629 LANG = "/Lang" # text string, optional
630 SPIDER_INFO = "/SpiderInfo" # dictionary, optional
631 OUTPUT_INTENTS = "/OutputIntents" # array, optional
632 PIECE_INFO = "/PieceInfo" # dictionary, optional
633 OC_PROPERTIES = "/OCProperties" # dictionary, optional
634 PERMS = "/Perms" # dictionary, optional
635 LEGAL = "/Legal" # dictionary, optional
636 REQUIREMENTS = "/Requirements" # array, optional
637 COLLECTION = "/Collection" # dictionary, optional
638 NEEDS_RENDERING = "/NeedsRendering" # boolean, optional
639 DSS = "/DSS" # dictionary, optional
640 AF = "/AF" # array of dictionaries, optional
641 D_PART_ROOT = "/DPartRoot" # dictionary, optional
644class OutlineFontFlag(IntFlag):
645 """A class used as an enumerable flag for formatting an outline font."""
647 italic = 1
648 bold = 2
651class PageLabelStyle:
652 """
653 Table 8.10 in the 1.7 reference.
654 Table 161 in the 2.0 reference.
655 """
657 DECIMAL = "/D" # Decimal Arabic numerals
658 UPPERCASE_ROMAN = "/R" # Uppercase Roman numerals
659 LOWERCASE_ROMAN = "/r" # Lowercase Roman numerals
660 UPPERCASE_LETTER = "/A" # Uppercase letters
661 LOWERCASE_LETTER = "/a" # Lowercase letters
664class AnnotationFlag(IntFlag):
665 """See §12.5.3 "Annotation Flags"."""
667 INVISIBLE = 1
668 HIDDEN = 2
669 PRINT = 4
670 NO_ZOOM = 8
671 NO_ROTATE = 16
672 NO_VIEW = 32
673 READ_ONLY = 64
674 LOCKED = 128
675 TOGGLE_NO_VIEW = 256
676 LOCKED_CONTENTS = 512
679PDF_KEYS = (
680 AnnotationDictionaryAttributes,
681 CatalogAttributes,
682 CatalogDictionary,
683 CcittFaxDecodeParameters,
684 CheckboxRadioButtonAttributes,
685 ColorSpaces,
686 Core,
687 DocumentInformationAttributes,
688 EncryptionDictAttributes,
689 FieldDictionaryAttributes,
690 FileSpecificationDictionaryEntries,
691 FilterTypeAbbreviations,
692 FilterTypes,
693 GoToActionArguments,
694 GraphicsStateParameters,
695 ImageAttributes,
696 InteractiveFormDictEntries,
697 LzwFilterParameters,
698 PageAttributes,
699 PageLayouts,
700 PagesAttributes,
701 Resources,
702 StreamAttributes,
703 TrailerKeys,
704 TypArguments,
705 TypFitArguments,
706)
709class ImageType(IntFlag):
710 NONE = 0
711 XOBJECT_IMAGES = auto()
712 INLINE_IMAGES = auto()
713 DRAWING_IMAGES = auto()
714 ALL = XOBJECT_IMAGES | INLINE_IMAGES | DRAWING_IMAGES
715 IMAGES = ALL # for consistency with ObjectDeletionFlag
718_INLINE_IMAGE_VALUE_MAPPING = {
719 "/G": "/DeviceGray",
720 "/RGB": "/DeviceRGB",
721 "/CMYK": "/DeviceCMYK",
722 "/I": "/Indexed",
723 "/AHx": "/ASCIIHexDecode",
724 "/A85": "/ASCII85Decode",
725 "/LZW": "/LZWDecode",
726 "/Fl": "/FlateDecode",
727 "/RL": "/RunLengthDecode",
728 "/CCF": "/CCITTFaxDecode",
729 "/DCT": "/DCTDecode",
730 "/DeviceGray": "/DeviceGray",
731 "/DeviceRGB": "/DeviceRGB",
732 "/DeviceCMYK": "/DeviceCMYK",
733 "/Indexed": "/Indexed",
734 "/ASCIIHexDecode": "/ASCIIHexDecode",
735 "/ASCII85Decode": "/ASCII85Decode",
736 "/LZWDecode": "/LZWDecode",
737 "/FlateDecode": "/FlateDecode",
738 "/RunLengthDecode": "/RunLengthDecode",
739 "/CCITTFaxDecode": "/CCITTFaxDecode",
740 "/DCTDecode": "/DCTDecode",
741 "/RelativeColorimetric": "/RelativeColorimetric",
742}
744_INLINE_IMAGE_KEY_MAPPING = {
745 "/BPC": "/BitsPerComponent",
746 "/CS": "/ColorSpace",
747 "/D": "/Decode",
748 "/DP": "/DecodeParms",
749 "/F": "/Filter",
750 "/H": "/Height",
751 "/W": "/Width",
752 "/I": "/Interpolate",
753 "/Intent": "/Intent",
754 "/IM": "/ImageMask",
755 "/BitsPerComponent": "/BitsPerComponent",
756 "/ColorSpace": "/ColorSpace",
757 "/Decode": "/Decode",
758 "/DecodeParms": "/DecodeParms",
759 "/Filter": "/Filter",
760 "/Height": "/Height",
761 "/Width": "/Width",
762 "/Interpolate": "/Interpolate",
763 "/ImageMask": "/ImageMask",
764}