
    @wgS                     (   d Z ddlmZmZmZmZ ddlmZmZ  G d de	e      Z
 G d d      Z G d d	      Z G d
 d      Z G d d      Z G d de      Z G d d      Z G d d      Z G d d      Z G d d      Z G d d      Z G d d      Ze G d de
             Z G d d      Z G d  d!      Z G d" d#      Z G d$ d%      Z G d& d'      Z G d( d)      Z G d* d+      Z G d, d-      Z G d. d/      Z G d0 d1      Z  G d2 d3      Z! G d4 d5      Z" G d6 d7e      Z# G d8 d9      Z$ G d: d;      Z% G d< d=      Z& G d> d?      Z' G d@ dAe      Z( G dB dC      Z) G dD dEe      Z*eee'ee"eee$ee!eeee&eeeee%eeeeeefZ+ G dF dGe      Z,yH)Iao  
PDF Specification Archive
https://pdfa.org/resource/pdf-specification-archive/

Portable Document Format Reference Manual, 1993. ISBN 0-201-62628-4
https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/pdfreference1.0.pdf

ISO 32000-1:2008 (PDF 1.7)
https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf

ISO 32000-2:2020 (PDF 2.0)
    )EnumIntFlagautounique)DictTuplec                       e Zd ZdefdZy)StrEnumreturnc                 ,    t        | j                        S )N)strvalue)selfs    F/var/www/horilla/myenv/lib/python3.12/site-packages/pypdf/constants.py__str__zStrEnum.__str__   s    4::    N)__name__
__module____qualname__r   r    r   r   r
   r
      s     r   r
   c                   $    e Zd ZdZdZdZdZdZdZy)Corez/Keywords that don't quite belong anywhere else.	/Outlines/Threadsz/Page/Pagesz/CatalogN)	r   r   r   __doc__OUTLINESTHREADSPAGEPAGESCATALOGr   r   r   r   r      s    9HGDEGr   r   c                   $    e Zd ZdZdZdZdZdZdZy)TrailerKeysz/Rootz/Encrypt/IDz/Infoz/Sizez/PrevN)	r   r   r   ROOTENCRYPTIDINFOSIZEPREVr   r   r   r#   r#   !   s     DG	BDDDr   r#   c                       e Zd ZdZdZy)CatalogAttributes/Names/DestsN)r   r   r   NAMESDESTSr   r   r   r,   r,   *   s    EEr   r,   c                   $    e Zd ZdZdZdZdZdZdZy)EncryptionDictAttributesz
    Additional encryption dictionary entries for the standard security handler.

    Table 3.19, Page 122.
    Table 21 of the 2.0 manual.
    /Rz/Oz/U/Pz/EncryptMetadataN)	r   r   r   r   ROUPENCRYPT_METADATAr   r   r   r2   r2   /   s#     	AAAA)r   r2   c                      e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#e$d"e%d#e&fd$       Z'e$d"e%d#e&fd%       Z(d#e)e%e&f   fd&Z*e$d'e)e%e&f   d#d fd(       Z+e$d+d)       Z,y*),UserAccessPermissionszM
    Table 3.20 User access permissions.
    Table 22 of the 2.0 manual.
                       @            i   i           @                          @             i   i   i    i   @l        namer   c                 N    |j                  d      xr |dd j                         S )z=Check if the given name corresponds to a reserved flag entry.r5   r<   N)
startswithisdigitclsrU   s     r   _is_reservedz"UserAccessPermissions._is_reservede   s'     s#:QR(8(8(::r   c                 
    |dvS )z8Check if the given reserved name defaults to 1 = active.>   R1R2r   rY   s     r   
_is_activez UserAccessPermissions._is_activej   s     <''r   c                     i }t         j                  j                         D ]4  \  }}t         j                  |      r| |z  |k(  ||j	                         <   6 |S )zEConvert the given flag value to a corresponding verbose name mapping.)r;   __members__itemsr[   lower)r   resultrU   flags       r   to_dictzUserAccessPermissions.to_dicto   sZ    "$/;;AAC 	9JD$$11$7$(4KD#8F4::< 	9 r   r   c                 :   |j                         } | d      }| j                  j                         D ]U  \  }}| j                  |      r| j	                  |      r||z  }.|j                  |j                         d      }|sQ||z  }W |rt        d|      |S )zAConvert the verbose name mapping to the corresponding flag value.r   FzUnknown dictionary keys: )copyra   rb   r[   r_   poprc   
ValueError)rZ   r   
value_copyrd   rU   re   	is_actives          r   	from_dictzUserAccessPermissions.from_dictx   s     ZZ\
Q////1 	JD$%>>$'dNF"tzz|U;I$	 8GHHr   c                 F     | d| j                   z
  | j                  z
        S )Nl    )r]   r^   rZ   s    r   allzUserAccessPermissions.all   s    I'#&&011r   N)r   r;   )-r   r   r   r   r]   r^   PRINTMODIFYEXTRACTADD_OR_MODIFYR7R8FILL_FORM_FIELDSEXTRACT_TEXT_AND_GRAPHICSASSEMBLE_DOCPRINT_TO_REPRESENTATIONR13R14R15R16R17R18R19R20R21R22R23R24R25R26R27R28R29R30R31R32classmethodr   boolr[   r_   r   rf   rm   rp   r   r   r   r;   r;   >   sA   
 
B	
BEFGM	B	B #L"
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C; ; ; ; (c (d ( (c4i  d39o 2I  " 2 2r   r;   c                   0    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zy
)	Resourcesz
    Table 3.30 Entries in a resource dictionary.
    Used to be Ressources (a misspelling).

    Table 34 in the 2.0 reference.
    z
/ExtGState/ColorSpacez/Patternz/Shadingz/XObject/Fontz/ProcSetz/PropertiesN)r   r   r   r   EXT_G_STATECOLOR_SPACEPATTERNSHADINGXOBJECTFONTPROC_SET
PROPERTIESr   r   r   r   r      s1     KKGGGDHJr   r   c                       e Zd ZdZy)
RessourceszE
    Use :class: `Resources` instead.

    .. deprecated:: 5.0.0
    N)r   r   r   r   r   r   r   r   r      s    r   r   c                        e Zd ZdZdZdZdZdZy)PagesAttributesu'   §7.7.3.2 of the 1.7 and 2.0 reference./Type/Parent/Kidsz/CountN)r   r   r   r   TYPEPARENTKIDSCOUNTr   r   r   r   r      s    1DFDEr   r   c                       e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$y#)$PageAttributesu'   §7.7.3.3 of the 1.7 and 2.0 reference.r   r   z/LastModifiedz
/Resourcesz	/MediaBoxz/CropBoxz	/BleedBoxz/TrimBoxz/ArtBoxz/BoxColorInfo	/Contentsz/Rotatez/Groupz/Thumbz/Bz/Durz/Transz/Annots/AA	/Metadata
/PieceInfoz/StructParentsr$   z/PZz/SeparationInfoz/Tabsz/TemplateInstantiatedz
/PresStepsz	/UserUnitz/VP/AF/OutputIntentsz/DPartN)%r   r   r   r   r   r   LAST_MODIFIED	RESOURCESMEDIABOXCROPBOXBLEEDBOXTRIMBOXARTBOXBOX_COLOR_INFOCONTENTSROTATEGROUPTHUMBBDURTRANSANNOTSAAMETADATA
PIECE_INFOSTRUCT_PARENTSr'   PZSEPARATION_INFOTABSTEMPLATE_INSTANTIATED
PRES_STEPS	USER_UNITVPAFOUTPUT_INTENTSD_PARTr   r   r   r   r      s    1DF  IHGHGF$NHFEEA
CEF	BHJ%N	B	B'OD3JI	B	B%NFr   r   c                   D    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZy)"FileSpecificationDictionaryEntriesz6Table 3.41 Entries in a file specification dictionary.r   z/FS/Fz/UFz/DOSz/Macz/Unixr$   /Vz/EFz/RFz/Descz/ClN)r   r   r   r   TypeFSFUFDOSMacUnixr'   VEFRFDESCClr   r   r   r   r      sF    @D	BA	B
C
CD	BA	B	BD	Br   r   c                       e Zd ZdZdZdZdZy)StreamAttributesz6
    Table 4.2.
    Table 5 in the 2.0 reference.
    z/Lengthz/Filterz/DecodeParmsN)r   r   r   r   LENGTHFILTERDECODE_PARMSr   r   r   r   r      s    
 FF!Lr   r   c                   0    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zy
)FilterTypesu$   §7.4 of the 1.7 and 2.0 references.z/ASCIIHexDecodez/ASCII85Decodez
/LZWDecodez/FlateDecodez/RunLengthDecodez/CCITTFaxDecodez
/DCTDecodez
/JPXDecodeN)r   r   r   r   ASCII_HEX_DECODEASCII_85_DECODE
LZW_DECODEFLATE_DECODERUN_LENGTH_DECODECCITT_FAX_DECODE
DCT_DECODE
JPX_DECODEr   r   r   r   r      s0    .(&OJ!L*(JJr   r   c                   ,    e Zd ZdZdZdZdZdZdZdZ	dZ
y	)
FilterTypeAbbreviationsu&   §8.9.7 of the 1.7 and 2.0 references.z/AHxz/A85z/LZWz/Flz/RLz/CCFz/DCTN)r   r   r   r   AHxA85LZWFLRLCCFDCTr   r   r   r   r     s(    0
C
C
C	B	B
C
Cr   r   c                   $    e Zd ZdZdZdZdZdZdZy)LzwFilterParametersz6
    Table 4.4.
    Table 8 in the 2.0 reference.
    z
/Predictorz/Colors/BitsPerComponent/Columnsz/EarlyChangeN)	r   r   r   r   	PREDICTORCOLORSBITS_PER_COMPONENTCOLUMNSEARLY_CHANGEr   r   r   r   r     s#    
 IF,G!Lr   r   c                   0    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zy
)CcittFaxDecodeParametersz7
    Table 4.5.
    Table 11 in the 2.0 reference.
    z/Kz
/EndOfLinez/EncodedByteAlignr   z/Rowsz/EndOfBlockz	/BlackIs1z/DamagedRowsBeforeErrorN)r   r   r   r   KEND_OF_LINEENCODED_BYTE_ALIGNr   ROWSEND_OF_BLOCK
BLACK_IS_1DAMAGED_ROWS_BEFORE_ERRORr   r   r   r   r   !  s3    
 	AK,GD LJ 9r   r   c                   D    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZy)ImageAttributesu'   §11.6.5 of the 1.7 and 2.0 references.r   /Subtypez/Namez/Widthz/Heightr   r   z/Decodez/Intentz/Interpolatez
/ImageMaskz/Mask/SMaskN)r   r   r   r   r   SUBTYPENAMEWIDTHHEIGHTr   r   DECODEINTENTINTERPOLATE
IMAGE_MASKMASKS_MASKr   r   r   r	  r	  1  sG    1DGDEF,KFF KJDFr   r	  c                       e Zd ZdZdZdZy)ColorSpacesz
/DeviceRGBz/DeviceCMYKz/DeviceGrayN)r   r   r   
DEVICE_RGBDEVICE_CMYKDEVICE_GRAYr   r   r   r  r  C  s    JKKr   r  c                        e Zd ZdZdZdZdZdZy)TypArguments#Table 8.2 of the PDF 1.7 reference.z/Leftz/Rightz/Bottomz/TopN)r   r   r   r   LEFTRIGHTBOTTOMTOPr   r   r   r  r  I  s    -DEF
Cr   r  c                   0    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zy
)TypFitArgumentsr  z/Fitz/FitVz/FitBVz/FitBz/FitHz/FitBHz/FitRz/XYZN)r   r   r   r   FITFIT_VFIT_BVFIT_BFIT_HFIT_BHFIT_RXYZr   r   r   r#  r#  R  s-    -
CEFEEFE
Cr   r#  c                       e Zd ZdZdZy)GoToActionArgumentsz/S/DN)r   r   r   SDr   r   r   r-  r-  _  s    AAr   r-  c                   L    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZy)AnnotationDictionaryAttributesz9Table 8.15 Entries common to all annotation dictionaries.r   r
  z/Rectr   r4   z/NMz/Mr   z/APz/AS/DAz/Borderz/Cz/StructParentz/OCN)r   r   r   r   r   SubtypeRectContentsr8   NMMr   APASDABorderCStructParentOCr   r   r   r2  r2  d  sP    CDGDHA	BAA	B	B	BFA"L	Br   r2  c                   ,    e Zd ZdZdZdZdZdZdZdZ	dZ
y	)
InteractiveFormDictEntriesz/Fieldsz/NeedAppearancesz	/SigFlagsz/COz/DRr3  z/Qz/XFAN)r   r   r   FieldsNeedAppearancesSigFlagsCODRr;  QXFAr   r   r   rA  rA  x  s*    F(OH	B	B	BA
Cr   rA  c                       e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZ G d de      Zedeedf   fd       Zedeeef   fd       Zy)FieldDictionaryAttributesz
    Entries common to all field dictionaries (Table 8.69 PDF 1.7 reference)
    (*very partially documented here*).

    FFBits provides the constants used for `/Ff` from Table 8.70/8.75/8.77/8.79
    z/FTr   r   z/Tz/TUz/TMz/Ffr   z/DVr   /Optc                       e Zd ZdZdZ	 dZ	 dZ	 dZ	 dZ	 dZ		 dZ
	 d	Z	 d
Z	 dZ	 dZ	 dZ	 dZ	 dZ	 dZ	 dZ	 dZ	 dZ	 dZy) FieldDictionaryAttributes.FfBitsz
        Ease building /Ff flags
        Some entries may be specific to:

        * Text(Tx) (Table 8.75 PDF 1.7 reference)
        * Buttons(Btn) (Table 8.77 PDF 1.7 reference)
        * List(Ch) (Table 8.79 PDF 1.7 reference)
        r<   r=   r>   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   N)r   r   r   r   ReadOnlyRequiredNoExport	MultilinePasswordNoToggleToOffRadio
PushbuttonComboEditSort
FileSelectMultiSelectDoNotSpellCheckDoNotScrollCombRadiosInUnisonRichTextCommitOnSelChanger   r   r   FfBitsrM    s    	 ///	

! #r   ra  r   .c           
          | j                   | j                  | j                  | j                  | j                  | j
                  | j                  | j                  | j                  | j                  f
S )a  
        Get a tuple of all the attributes present in a Field Dictionary.

        This method returns a tuple of all the attribute constants defined in
        the FieldDictionaryAttributes class. These attributes correspond to the
        entries that are common to all field dictionaries as specified in the
        PDF 1.7 reference.

        Returns:
            A tuple containing all the attribute constants.

        )
TMTFTParentTUFfr   DVKidsr   ro   s    r   
attributesz$FieldDictionaryAttributes.attributes  sT     FFEEFFJJFFFFEEFFHHFF
 	
r   c                     | j                   d| j                  d| j                  d| j                  d| j                  d| j
                  d| j                  d| j                  diS )	a  
        Get a dictionary of attribute keys and their human-readable names.

        This method returns a dictionary where the keys are the attribute
        constants defined in the FieldDictionaryAttributes class and the values
        are their corresponding human-readable names. These attributes
        correspond to the entries that are common to all field dictionaries as
        specified in the PDF 1.7 reference.

        Returns:
            A dictionary containing attribute keys and their names.

        z
Field Typerf  z
Field NamezAlternate Field NamezMapping NamezField FlagsValuezDefault Value)re  rf  rd  rg  rc  rh  r   ri  ro   s    r   attributes_dictz)FieldDictionaryAttributes.attributes_dict  sW      FFLJJEE<FF*FFNFFMEE7FFO	
 		
r   N)r   r   r   r   re  rf  rj  rd  rg  rc  rh  r   ri  r   Optr   ra  r   r   r   rk  r   rn  r   r   r   rJ  rJ    s     
BFDA	B	B	BA	B	B
C8 8t 
5c? 
 
4 
S#X 
 
r   rJ  c                   T    e Zd ZdZdZedeedf   fd       Zede	eef   fd       Z
y)CheckboxRadioButtonAttributesz1Table 8.76 Field flags common to all field types.rK  r   .c                     | j                   fS )a  
        Get a tuple of all the attributes present in a Field Dictionary.

        This method returns a tuple of all the attribute constants defined in
        the CheckboxRadioButtonAttributes class. These attributes correspond to
        the entries that are common to all field dictionaries as specified in
        the PDF 1.7 reference.

        Returns:
            A tuple containing all the attribute constants.

        ro  ro   s    r   rk  z(CheckboxRadioButtonAttributes.attributes  s     zr   c                     | j                   diS )a  
        Get a dictionary of attribute keys and their human-readable names.

        This method returns a dictionary where the keys are the attribute
        constants defined in the CheckboxRadioButtonAttributes class and the
        values are their corresponding human-readable names. These attributes
        correspond to the entries that are common to all field dictionaries as
        specified in the PDF 1.7 reference.

        Returns:
            A dictionary containing attribute keys and their names.

        Optionsrs  ro   s    r   rn  z-CheckboxRadioButtonAttributes.attributes_dict  s      GGY
 	
r   N)r   r   r   r   ro  r   r   r   rk  r   rn  r   r   r   rq  rq    sN    ;
C5c?   
S#X 
 
r   rq  c                       e Zd ZdZdZdZdZy)	FieldFlagz1Table 8.70 Field flags common to all field types.r<   r=   r>   N)r   r   r   r   	READ_ONLYREQUIRED	NO_EXPORTr   r   r   rw  rw  0  s    ;IHIr   rw  c                   4    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
Zy)DocumentInformationAttributesz:Table 10.2 Entries in the document information dictionary.z/Titlez/Authorz/Subjectz	/Keywordsz/Creatorz	/Producerz/CreationDatez/ModDatez/TrappedN)r   r   r   r   TITLEAUTHORSUBJECTKEYWORDSCREATORPRODUCERCREATION_DATEMOD_DATETRAPPEDr   r   r   r|  r|  8  s2    DEFGHGH#MHGr   r|  c                   (    e Zd ZdZdZdZdZdZdZdZ	y)	PageLayoutszF
    Page 84, PDF 1.4 reference.
    Page 115, PDF 2.0 reference.
    z/SinglePagez
/OneColumnz/TwoColumnLeftz/TwoColumnRightz/TwoPageLeftz/TwoPageRightN)
r   r   r   r   SINGLE_PAGE
ONE_COLUMNTWO_COLUMN_LEFTTWO_COLUMN_RIGHTTWO_PAGE_LEFTTWO_PAGE_RIGHTr   r   r   r  r  F  s(    
  KJ&O("M$Nr   r  c                   |    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZy)GraphicsStateParametersu=   Table 58 – Entries in a Graphics State Parameter Dictionaryr   z/LWz/LCz/LJz/MLr.  z/RIz/OPz/opz/OPMr   z/BGz/BG2z/UCRz/UCR2z/TRz/TR2z/HTz/FLz/SMz/SAz/BMr  z/CAz/caz/AISz/TKN)r   r   r   r   r   LWLCLJMLr0  RIOPopOPMr   BGBG2UCRUCR2TRTR2HTr   SMSABMr  CAcaAISTKr   r   r   r  r  T  s    GD	B	B	B	BA	B	B	B
CD	B
C
CD	B
C	B	B	B	B	BF	B	B
C	Br   r  c                       e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#y")#CatalogDictionaryu&   §7.7.2 of the 1.7 and 2.0 references.r   z/Versionz/Extensionsr   z/PageLabelsr-   r.   z/ViewerPreferencesz/PageLayoutz	/PageModer   r   z/OpenActionr   z/URIz	/AcroFormr   z/StructTreeRootz	/MarkInfoz/Langz/SpiderInfor   r   z/OCPropertiesz/Permsz/Legalz/Requirementsz/Collectionz/NeedsRenderingz/DSSr   z
/DPartRootN)$r   r   r   r   r   VERSION
EXTENSIONSr    PAGE_LABELSr/   r0   VIEWER_PREFERENCESPAGE_LAYOUT	PAGE_MODEr   r   OPEN_ACTIONr   URI	ACRO_FORMr   STRUCT_TREE_ROOT	MARK_INFOLANGSPIDER_INFOr   r   OC_PROPERTIESPERMSLEGALREQUIREMENTS
COLLECTIONNEEDS_RENDERINGDSSr   D_PART_ROOTr   r   r   r  r  t  s    0DGJEKEE-KIHGK	B
CIH(IDK%NJ#MEE"LJ'O
C	BKr   r  c                       e Zd ZdZdZdZy)OutlineFontFlagzBA class used as an enumerable flag for formatting an outline font.r<   r=   N)r   r   r   r   italicboldr   r   r   r  r    s    LFDr   r  c                   $    e Zd ZdZdZdZdZdZdZy)PageLabelStylezN
    Table 8.10 in the 1.7 reference.
    Table 161 in the 2.0 reference.
    r.  r3   z/rz/Az/aN)	r   r   r   r   DECIMALUPPERCASE_ROMANLOWERCASE_ROMANUPPERCASE_LETTERLOWERCASE_LETTERr   r   r   r  r    s$    
 GOOr   r  c                   8    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZy)AnnotationFlagu    See §12.5.3 "Annotation Flags".r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   N)r   r   r   r   	INVISIBLEHIDDENrq   NO_ZOOM	NO_ROTATENO_VIEWrx  LOCKEDTOGGLE_NO_VIEWLOCKED_CONTENTSr   r   r   r  r    s7    *IFEGIGIFNOr   r  c                   N    e Zd ZdZ e       Z e       Z e       Zeez  ez  ZeZ	y)	ImageTyper   N)
r   r   r   NONEr   XOBJECT_IMAGESINLINE_IMAGESDRAWING_IMAGESALLIMAGESr   r   r   r  r    s0    DVNFMVN
=
(>
9CFr   r  N)-r   enumr   r   r   r   typingr   r   r   r
   r   r#   r,   r2   r;   r   r   r   r   r   r   r   r   r   r   r	  r  r  r#  r-  r2  rA  rJ  rq  rw  r|  r  r  r  r  r  r  PDF_KEYSr  r   r   r   <module>r     s   - , c4 
   
* *N2G N2b $  % %P $" " 
' 
 
	 	
" 
": :  $    
 
 
 ( A
 A
H&
 &
R  % % @" "Jg 
 
W   #!!&3: r   