Ë
    =²XjQ'  ã                   ó€   — d dl mZmZmZ ddlmZmZmZmZm	Z	 ddl
mZmZ ddlmZmZ ddlmZ ddlmZ  G d„ d	«      Zy
)é    )ÚOptionalÚTupleÚUnioné   )ÚBooleanObjectÚFloatObjectÚ
NameObjectÚNumberObjectÚTextStringObject)ÚArrayObjectÚDictionaryObject)ÚDEFAULT_FITÚFit)ÚRectangleObject)Ú
hex_to_rgbc                   óÀ  — e Zd ZdZddlmZmZ e	 	 ddee	e
eeeef   f   dedededef
d	„«       Ze	 	 	 	 	 	 	 ddedee	e
eeeef   f   d
edededededededefd„«       Ze	 	 d de
eef   de
eef   dee	e
eeeef   f   dededefd„«       Ze	 d!dee	e
eeeef   f   dee   defd„«       Zedddefdee	e
eeeef   f   dee   dee   dee   dedefd„«       Zy)"ÚAnnotationBuildera>  
    The AnnotationBuilder creates dictionaries representing PDF annotations.

    Those dictionaries can be modified before they are added to a PdfWriter
    instance via `writer.add_annotation`.

    See `adding PDF annotations <../user/adding-pdf-annotations.html>`_ for
    it's usage combined with PdfWriter.
    é   )ÚFitTypeÚZoomArgTypeÚrectÚtextÚopenÚflagsÚreturnc                 ó  — t        t        d«      t        d«      t        d«      t        d«      t        d«      t        | «      t        d«      t        |«      t        d«      t	        |«      t        d«      t        |«      i«      }|S )	zÿ
        Add text annotation.

        :param Tuple[int, int, int, int] rect:
            or array of four integers specifying the clickable rectangular area
            ``[xLL, yLL, xUR, yUR]``
        :param bool open:
        :param int flags:
        ú/Typeú/Annotú/Subtypez/Textú/Rectú	/Contentsz/Openz/Flags)r   r	   r   r   r   r
   )r   r   r   r   Útext_objs        úa/var/www/html/content_generation/venv/lib/python3.12/site-packages/PyPDF2/generic/_annotations.pyr   zAnnotationBuilder.text   su   € ô" $ä˜7Ó#¤Z°Ó%9Ü˜:Ó&¬
°7Ó(;Ü˜7Ó#¤_°TÓ%:Ü˜;Ó'Ô)9¸$Ó)?Ü˜7Ó#¤]°4Ó%8Ü˜8Ó$¤l°5Ó&9ðó	
ˆð ˆó    ÚfontÚboldÚitalicÚ	font_sizeÚ
font_colorÚborder_colorÚbackground_colorc	                 ó<  — d}	|du r|	dz   }	|du r|	dz   }	|	|z   dz   |z   }	|	dz   |z   }	d}
t        |«      D ]  }|
t        |«      z   dz   }
Œ |
dz   }
t        «       }|j                  t	        d	«      t	        d
«      t	        d«      t	        d«      t	        d«      t        |«      t	        d«      t        | «      t	        d«      t        |	«      t	        d«      t        |
«      t	        d«      t        t        |«      D �cg c]  }t        |«      ‘Œ c}«      i«       |S c c}w )a¡  
        Add text in a rectangle to a page.

        :param str text: Text to be added
        :param RectangleObject rect: or array of four integers
            specifying the clickable rectangular area ``[xLL, yLL, xUR, yUR]``
        :param str font: Name of the Font, e.g. 'Helvetica'
        :param bool bold: Print the text in bold
        :param bool italic: Print the text in italic
        :param str font_size: How big the text will be, e.g. '14pt'
        :param str font_color: Hex-string for the color
        :param str border_color: Hex-string for the border color
        :param str background_color: Hex-string for the background of the annotation
        zfont: Tzbold zitalic Ú z;text-align:left;color:#Ú Úrgr   r   r   z	/FreeTextr    r!   z/DSz/DAz/C)	r   Ústrr   Úupdater	   r   r   r   r   )r   r   r%   r&   r'   r(   r)   r*   r+   Úfont_strÚbg_color_strÚstÚ	free_textÚns                 r#   r5   zAnnotationBuilder.free_text:   s2  € ð4 ˆØ�4‰<Ø 'Ñ)ˆHØ�T‰>Ø )Ñ+ˆHØ˜d‘? SÑ(¨9Ñ4ˆØÐ8Ñ8¸:ÑEˆàˆÜ˜\Ö*ˆBØ'¬#¨b«'Ñ1°CÑ7‰Lð +à# dÑ*ˆä$Ó&ˆ	Ø×Ñä˜7Ó#¤Z°Ó%9Ü˜:Ó&¬
°;Ó(?Ü˜7Ó#¤_°TÓ%:Ü˜;Ó'Ô)9¸$Ó)?ä˜5Ó!Ô#3°HÓ#=ä˜5Ó!Ô#3°LÓ#Aä˜4Ó ¤+Ü-7Ð8HÔ-IÓJÑ-I¨”[ •^Ð-IÑJó#ðô	
ð  Ðùò	 Ks   Ã9D&Úp1Úp2Ú	title_barc                 ó(  — t        t        d«      t        d«      t        d«      t        d«      t        d«      t        |«      t        d«      t        |«      t        d«      t	        t        | d   «      t        | d	   «      t        |d   «      t        |d	   «      g«      t        d
«      t	        t        d«      t        d«      g«      t        d«      t	        t        d«      t        d«      t        d«      g«      t        d«      t        |«      i«      }|S )a  
        Draw a line on the PDF.

        :param Tuple[float, float] p1: First point
        :param Tuple[float, float] p2: Second point
        :param RectangleObject rect: or array of four
                integers specifying the clickable rectangular area
                ``[xLL, yLL, xUR, yUR]``
        :param str text: Text to be displayed as the line annotation
        :param str title_bar: Text to be displayed in the title bar of the
            annotation; by convention this is the name of the author
        r   r   r   z/Liner    z/Tz/Lr   r   z/LENú/ICg      à?r!   )r   r	   r   r   r   r   )r7   r8   r   r   r9   Úline_objs         r#   ÚlinezAnnotationBuilder.linet   s  € ô( $ä˜7Ó#¤Z°Ó%9Ü˜:Ó&¬
°7Ó(;Ü˜7Ó#¤_°TÓ%:Ü˜4Ó Ô"2°9Ó"=Ü˜4Ó ¤+ä# B q¡EÓ*Ü# B q¡EÓ*Ü# B q¡EÓ*Ü# B q¡EÓ*ð	ó#ô ˜5Ó!¤;ä" 4Ó(Ü" 4Ó(ðó$ô ˜5Ó!¤;ä# CÓ(Ü# CÓ(Ü# CÓ(ðó$ô ˜;Ó'Ô)9¸$Ó)?ð5ó
ˆð< ˆr$   NÚinteriour_colorc           
      ó  — t        t        d«      t        d«      t        d«      t        d«      t        d«      t        | «      i«      }|r7t        t	        |«      D �cg c]  }t        |«      ‘Œ c}«      |t        d«      <   |S c c}w )zÑ
        Draw a rectangle on the PDF.

        :param RectangleObject rect: or array of four
                integers specifying the clickable rectangular area
                ``[xLL, yLL, xUR, yUR]``
        r   r   r   z/Squarer    r;   )r   r	   r   r   r   r   )r   r>   Ú
square_objr6   s       r#   Ú	rectanglezAnnotationBuilder.rectangle¨   s„   € ô &ä˜7Ó#¤Z°Ó%9Ü˜:Ó&¬
°9Ó(=Ü˜7Ó#¤_°TÓ%:ðó
ˆ
ñ Ü,7Ü)3°OÔ)DÓEÑ)D A”˜Q•Ð)DÑEó-ˆJ”z %Ó(Ñ)ð Ðùò Fs   ÁBÚborderÚurlÚtarget_page_indexÚfitc                 óJ  — ddl m} |du}|du}|s|st        d«      ‚|r|rt        d|› d|› �«      ‚|�`|dd D �cg c]  }t        |«      ‘Œ }	}t	        |«      dk(  rFt        |d   D �cg c]  }t        |«      ‘Œ c}«      }
|	j                  |
«       nt        d	«      gdz  }	t        t        d
«      t        d«      t        d«      t        d«      t        d«      t        | «      t        d«      t        |	«      i«      }|rSt        t        d«      t        d«      t        d
«      t        d«      t        d«      t        |«      i«      |t        d«      <   |rCt        t        |«      t        |j                  «      |j                  dœ«      }||t        d«      <   |S c c}w c c}w )aú  
        Add a link to the document.

        The link can either be an external link or an internal link.

        An external link requires the URL parameter.
        An internal link requires the target_page_index, fit, and fit args.


        :param RectangleObject rect: or array of four
            integers specifying the clickable rectangular area
            ``[xLL, yLL, xUR, yUR]``
        :param border: if provided, an array describing border-drawing
            properties. See the PDF spec for details. No border will be
            drawn if this argument is omitted.
            - horizontal corner radius,
            - vertical corner radius, and
            - border width
            - Optionally: Dash
        :param str url: Link to a website (if you want to make an external link)
        :param int target_page_index: index of the page to which the link should go
                                (if you want to make an internal link)
        :param Fit fit: Page fit or 'zoom' option.
        r   )ÚBorderArrayTypeNzHEither 'url' or 'target_page_index' have to be provided. Both were None.z=Either 'url' or 'target_page_index' have to be provided. url=z, target_page_index=é   é   r   r   r   r   z/Linkr    z/Borderz/Sz/URIz/Actionz/A)rD   rE   Úfit_argsz/Dest)ÚtypesrG   Ú
ValueErrorr	   Úlenr   Úappendr
   r   r   r   Úfit_typerJ   )r   rB   rC   rD   rE   rG   Úis_externalÚis_internalr6   Ú
border_arrÚdash_patternÚlink_objÚdest_deferreds                r#   ÚlinkzAnnotationBuilder.linkÃ   s°  € õ@ 	,à �oˆØ'¨tÐ3ˆÙ¡;ÜØZóð ñ ™;ÜØOÐPSÈuÐThÐizÐh{Ð|óð ð
 ÐØ17¸¸±Ó<±¨Aœ* Q�-°ˆJÐ<Ü�6‹{˜aÒÜ*À6È!Â9Ó+MÁ9¸a¬J°q­MÀ9Ñ+MÓN�Ø×!Ñ! ,Õ/ä& q›/Ð*¨QÑ.ˆJä#ä˜7Ó#¤Z°Ó%9Ü˜:Ó&¬
°7Ó(;Ü˜7Ó#¤_°TÓ%:Ü˜9Ó%¤{°:Ó'>ð	ó
ˆñ Ü)9ä˜tÓ$¤j°Ó&8Ü˜wÓ'¬°IÓ)>Ü˜vÓ&Ô(8¸Ó(=ðó*ˆH”Z Ó%Ñ&ñ ä,ä)5Ð6GÓ)HÜ% c§l¡lÓ3Ø #§¡ñóˆMð -:ˆH”Z Ó(Ñ)ØˆùòC =ùâ+Ms   ¼FÁ*F )Fr   )Ú	HelveticaFFÚ14ptÚ000000rY   Úffffff)r.   r.   )N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rK   r   r   Ústaticmethodr   r   r   Úfloatr0   ÚboolÚintr   r   r5   r=   r   rA   r   r   r   rV   © r$   r#   r   r      se  „ ñ÷ -àð Øñ	Ø�O U¨5°%¸ÀÐ+EÑ%FÐFÑGðàðð ðð ð	ð
 
òó ðð8 ð  ØØØØ"Ø$Ø (ñ7Øð7à�O U¨5°%¸ÀÐ+EÑ%FÐFÑGð7ð ð7ð ð	7ð
 ð7ð ð7ð ð7ð ð7ð ð7ð 
ò7ó ð7ðr ð
 Øñ1Ø�%˜�,Ñð1à�%˜�,Ñð1ð �O U¨5°%¸ÀÐ+EÑ%FÐFÑGð1ð ð	1ð
 ð1ð 
ò1ó ð1ðf ð *.ñØ�O U¨5°%¸ÀÐ+EÑ%FÐFÑGðà! #™ðð 
òó ðð4 ð )-Ø!Ø+/ØñOØ�O U¨5°%¸ÀÐ+EÑ%FÐFÑGðOà˜Ñ%ðOð �c‰]ðOð $ C™=ð	Oð
 ðOð 
òOó ñOr$   r   N)Útypingr   r   r   Ú_baser   r   r	   r
   r   Ú_data_structuresr   r   Ú_fitr   r   Ú
_rectangler   Ú_utilsr   r   rc   r$   r#   Ú<module>rj      s/   ðß )Ñ )÷õ ÷ <ß "Ý 'Ý ÷Cò Cr$   