
    %hQ'                         S SK JrJrJr  SSKJrJrJrJrJ	r	  SSK
JrJr  SSKJrJr  SSKJr  SSKJr   " S S	5      rg
)    )OptionalTupleUnion   )BooleanObjectFloatObject
NameObjectNumberObjectTextStringObject)ArrayObjectDictionaryObject)DEFAULT_FITFit)RectangleObject)
hex_to_rgbc                      \ rS rSrSrSSKJrJr  \  S S\	\
\\\\\4   4   S\S\S\S	\4
S
 jj5       r\       S!S\S\	\
\\\\\4   4   S\S\S\S\S\S\S\S	\4S jj5       r\  S"S\\\4   S\\\4   S\	\
\\\\\4   4   S\S\S	\4S jj5       r\ S#S\	\
\\\\\4   4   S\\   S	\4S jj5       r\SSS\4S\	\
\\\\\4   4   S\\   S\\   S\\   S\S	\4S jj5       rSrg)$AnnotationBuilder   a&  
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                    [        [        S5      [        S5      [        S5      [        S5      [        S5      [        U 5      [        S5      [        U5      [        S5      [	        U5      [        S5      [        U5      05      nU$ )	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        S/var/www/auris/envauris/lib/python3.13/site-packages/PyPDF2/generic/_annotations.pyr   AnnotationBuilder.text   su    " $7#Z%9:&
7(;7#_T%:;')9$)?7#]4%88$l5&9	
     fontbolditalic	font_size
font_colorborder_colorbackground_colorc	                 H   Sn	USL a  U	S-   n	USL a  U	S-   n	X-   S-   U-   n	U	S-   U-   n	Sn
[        U5       H  nU
[        U5      -   S-   n
M     U
S-   n
[        5       nUR                  [	        S	5      [	        S
5      [	        S5      [	        S5      [	        S5      [        U5      [	        S5      [        U 5      [	        S5      [        U	5      [	        S5      [        U
5      [	        S5      [        [        U5       Vs/ s H  n[        U5      PM     sn5      05        U$ s  snf )aA  
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$   r7   AnnotationBuilder.free_text:   s0   4 4<')HT>)+H?S(9488:E\*B'#b'1C7L +#d*$&	7#Z%9:&
;(?7#_T%:;')9$)?5!#3H#=5!#3L#A4 +-78H-IJ-I[^-IJ#	
  	 Ks   <D&p1p2	title_barc                 (   [        [        S5      [        S5      [        S5      [        S5      [        S5      [        U5      [        S5      [        U5      [        S5      [	        [        U S   5      [        U S	   5      [        US   5      [        US	   5      /5      [        S
5      [	        [        S5      [        S5      /5      [        S5      [	        [        S5      [        S5      [        S5      /5      [        S5      [        U5      05      nU$ )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   )r:   r;   r   r   r<   line_objs         r$   lineAnnotationBuilder.linet   s   ( $7#Z%9:&
7(;7#_T%:4 "29"=4 +#BqE*#BqE*#BqE*#BqE*	# 5!;"4("4($ 5!;#C(#C(#C($ ;')9$)?5
< r&   Ninteriour_colorc           
          [        [        S5      [        S5      [        S5      [        S5      [        S5      [        U 5      05      nU(       a:  [        [	        U5       Vs/ s H  n[        U5      PM     sn5      U[        S5      '   U$ s  snf )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   rB   
square_objr8   s       r$   	rectangleAnnotationBuilder.rectangle   s     &7#Z%9:&
9(=7#_T%:

 ,7)3O)DE)DAQ)DE-Jz%()  Fs   !Bborderurltarget_page_indexfitc                    SSK Jn  USLnUSLnU(       d  U(       d  [        S5      eU(       a  U(       a  [        SU SU 35      eUbg  USS  Vs/ s H  n[        U5      PM     n	n[	        U5      S:X  a9  [        US    Vs/ s H  n[        U5      PM     sn5      n
U	R                  U
5        O[        S	5      /S-  n	[        [        S
5      [        S5      [        S5      [        S5      [        S5      [        U 5      [        S5      [        U	5      05      nU(       aS  [        [        S5      [        S5      [        S
5      [        S5      [        S5      [        U5      05      U[        S5      '   U(       aB  [        [        U5      [        UR                  5      UR                  S.5      nX[        S5      '   U$ s  snf s  snf )ab  
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)rI   rJ   fit_argsz/Dest)typesrL   
ValueErrorr	   lenr   appendr
   r   r   r   fit_typerO   )r   rG   rH   rI   rJ   rL   is_externalis_internalr8   
border_arrdash_patternlink_objdest_deferreds                r$   linkAnnotationBuilder.link   s   @ 	,o't3;Z  ;OPSuThizh{| 
 17<A*Q-J<6{a*6!9+M9aJqM9+MN!!,/&q/*Q.J#7#Z%9:&
7(;7#_T%:9%{:'>	
 )9t$j&8w'I)>v&(8(=*HZ%& ,)56G)H%cll3 #M -:Z()C =+Ms   G G )Fr   )	HelveticaFF14pt000000r`   ffffff)r0   r0   )N)__name__
__module____qualname____firstlineno____doc__rP   r   r   staticmethodr   r   r   floatr2   boolintr   r   r7   r@   r   rE   r   r   r   r[   __static_attributes__r]   r&   r$   r   r      se    - 	OU5%+E%FFG  	
 
 8   "$ (77OU5%+E%FFG7 7 	7
 7 7 7 7 7 
7 7r 
 1%,1%,1 OU5%+E%FFG1 	1
 1 
1 1f  *.OU5%+E%FFG!# 
 4  )-!+/OOU5%+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   r]   r&   r$   <module>rr      s/    ) )  < " ' C Cr&   