
    Csi6                         d dl mZ d dlmZmZ d dlmZ ddlmZm	Z	 ddgZ
 ed	       G d
 de	             Z G d de      Zy)    )	dataclass)contentlayout)BasePdfFileWriter   )	BaseStampBaseStampStyleStaticContentStampStaticStampStyleT)frozenc                   f    e Zd ZU dZdZeed<   	 e	 d	 dd       Zde	de
j                  dedd	fd
Zy)r   za
    Stamp style that does not include any custom parts; it only renders
    the background.
    g      ?background_opacityreturnc                 F    t        ddt        j                  ||      i|S )a  
        Create a :class:`StaticStampStyle` from a page from an external PDF
        document. This is a convenience wrapper around
        :class:`~content.ImportedPdfContent`.

        The remaining keyword arguments are passed to
        :class:`StaticStampStyle`'s init method.

        :param file_name:
            File name of the external PDF document.
        :param page_ix:
            Page index to import. The default is ``0``, i.e. the first page.
        
background)page_ix )r   r   ImportedPdfPage)cls	file_namer   kwargss       `/var/www/python-projects/worksol/worksolenv/lib/python3.12/site-packages/pyhanko/stamp/static.pyfrom_pdf_filezStaticStampStyle.from_pdf_file   s.    "   
..y'J

 	
    writerboxtext_paramsr
   c                     t        || |      S )N)r   styler   )r
   )selfr   r   r   s       r   create_stampzStaticStampStyle.create_stamp.   s     "tEEr   N)r   )r   r   )__name__
__module____qualname____doc__r   float__annotations__classmethodr   r   r   BoxConstraintsdictr!   r   r   r   r   r      sn    
 !$#
  !
	
 
*F!F ""F 	F
 
Fr   c                   J     e Zd ZdZdededej                  f fdZd Z	 xZ
S )r
   z.Class representing stamps with static content.r   r   r   c                     |r|j                   r|j                  st        j                  d      t        |   |||       y )Nz9StaticContentStamp requires a predetermined bounding box.)r   r   r   )height_definedwidth_definedr   LayoutErrorsuper__init__)r    r   r   r   	__class__s       r   r1   zStaticContentStamp.__init__:   sD     **s/@/@$$K  	Sf=r   c                     g S )Nr   )r    s    r   _render_inner_contentz(StaticContentStamp._render_inner_contentF   s    	r   )r"   r#   r$   r%   r   r   r   r)   r1   r4   __classcell__)r2   s   @r   r
   r
   7   s2    8
>!
>  
> ""	
>r   N)dataclassesr   pyhanko.pdf_utilsr   r   pyhanko.pdf_utils.writerr   baser   r	   __all__r   r
   r   r   r   <module>r;      sL    ! - 6 +!3
4 $(F~ (F (FV r   