§
    Å‡tje\  ã                   ó  — d Z ddlZddlZddlZddlZddlmZ ddlm	Z
 ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ej        Z ej        e¦  «        Z G d„ d	e
j        ¦  «        Zd
„ Z	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z G d„ d¦  «        Zd„ ZdS ))ÚPdfPageÚPdfColorSchemeé    N)ÚPdfiumError)Ú	PdfBitmap)ÚPdfTextPage)Ú	PdfObject)ÚPDFIUM_INFOc                   ó  ‡ — e Zd ZdZˆ fd„Zed„ ¦   «         Zed„ ¦   «         Zd„ Z	d„ Z
d„ Zd„ Zd	„ Zd
„ Zd$d„Zd„ Zd$d„Zd„ Zd$d„Zd„ Zd$d„Zd„ Zd$d„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd%d„Zej         fd„Z!d dd!de"j#        dd"fd#„Z$ˆ xZ%S )&r   ah  
    Page helper class.
    
    Attributes:
        raw (FPDF_PAGE):
            The underlying PDFium page handle.
        pdf (PdfDocument):
            Reference to the document this page belongs to.
        formenv (PdfFormEnv | None):
            Formenv handle, if the parent pdf had an active formenv at the time of page retrieval. None otherwise.
    c                 ó”   •— || _         || _        || _        t          ¦   «                              t
          j        | j        ¦  «         d S ©N)ÚrawÚpdfÚformenvÚsuperÚ__init__r   Ú_close_impl)Úselfr   r   r   Ú	__class__s       €úU/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/pypdfium2/_helpers/page.pyr   zPdfPage.__init__#   s=   ø€ ØˆŒØˆŒØˆŒÝ‰Œ×Ò�Ô,¨d¬lÑ;Ô;Ð;Ð;Ð;ó    c                 ó\   — |rt          j        | |¦  «         t          j        | ¦  «         d S r   )Úpdfium_cÚFORM_OnBeforeClosePageÚFPDF_ClosePage)r   r   s     r   r   zPdfPage._close_impl*   s4   € àð 	:ÝÔ+¨C°Ñ9Ô9Ð9ÝÔ Ñ$Ô$Ð$Ð$Ð$r   c                 ó   — | j         S r   )r   ©r   s    r   ÚparentzPdfPage.parent1   s	   € àŒxˆr   c                 ó*   — t          j        | ¦  «        S )z`
        Returns:
            float: Page width (horizontal size), in PDF canvas units.
        )r   ÚFPDF_GetPageWidthFr   s    r   Ú	get_widthzPdfPage.get_width6   s   € õ
 Ô*¨4Ñ0Ô0Ð0r   c                 ó*   — t          j        | ¦  «        S )z_
        Returns:
            float: Page height (vertical size), in PDF canvas units.
        )r   ÚFPDF_GetPageHeightFr   s    r   Ú
get_heightzPdfPage.get_height=   s   € õ
 Ô+¨DÑ1Ô1Ð1r   c                 óR   — |                       ¦   «         |                      ¦   «         fS )zb
        Returns:
            (float, float): Page width and height, in PDF canvas units.
        )r    r#   r   s    r   Úget_sizezPdfPage.get_sizeD   s#   € ð
 —’Ñ Ô  $§/¢/Ñ"3Ô"3Ð4Ð4r   c                 óx   — t          j        | ¦  «        }|dk    rt          d¦  «        ‚t          j        |         S )zO
        Returns:
            int: Clockwise page rotation in degrees.
        éÿÿÿÿzFailed to get page rotation.)r   ÚFPDFPage_GetRotationr   Úpdfium_iÚRotationToDegrees)r   Úraw_rotations     r   Úget_rotationzPdfPage.get_rotationN   s<   € õ
  Ô4°TÑ:Ô:ˆØ˜2ÒÐÝÐ<Ñ=Ô=Ð=ÝÔ)¨,Ô7Ð7r   c                 óP   — t          j        | t          j        |         ¦  «         dS )z\
        Define the absolute, clockwise page rotation (0, 90, 180, or 270 degrees).
        N)r   ÚFPDFPage_SetRotationr)   ÚRotationToConst)r   Úrotations     r   Úset_rotationzPdfPage.set_rotationX   s%   € õ 	Ô% d­HÔ,DÀXÔ,NÑOÔOÐOÐOÐOr   c                 óê   — t          ¦   «         t          ¦   «         t          ¦   «         t          ¦   «         f\  }}}} || ||||¦  «        }|s|r
 |¦   «         nd S |j        |j        |j        |j        fS r   )Úc_floatÚvalue)	r   Úbox_funcÚfallback_funcÚfallback_okÚleftÚbottomÚrightÚtopÚoks	            r   Ú_get_boxzPdfPage._get_box_   st   € Ý#*¡9¤9­g©i¬i½¹¼ÅGÁIÄIÐ#MÑ ˆˆf�e˜SØˆX�d˜D &¨%°Ñ5Ô5ˆØð 	>Ø'2Ð<�M�M‘O”O�O¸Ð=Ø”
˜FœL¨%¬+°s´yÐAÐAr   Tc                 óF   — |                       t          j        d„ |¦  «        S )aø  
        Returns:
            (float, float, float, float) | None:
            The page MediaBox in PDF canvas units, consisting of four coordinates (usually x0, y0, x1, y1).
            If MediaBox is not defined, returns ANSI A (0, 0, 612, 792) if ``fallback_ok=True``, None otherwise.
        
        .. admonition:: Known issue

            Due to quirks in PDFium, all ``get_*box()`` functions except :meth:`.get_bbox` do not inherit from parent nodes in the page tree (as of PDFium 5418).
        c                  ó   — dS )N)r   r   id  i  © r@   r   r   ú<lambda>z&PdfPage.get_mediabox.<locals>.<lambda>s   s   € ÐDT€ r   )r=   r   ÚFPDFPage_GetMediaBox©r   r7   s     r   Úget_mediaboxzPdfPage.get_mediaboxh   s"   € ð �}Š}�XÔ:Ð<TÐ<TÐVaÑbÔbÐbr   c                 ó6   — t          j        | ||||¦  «         dS )zn
        Set the page's MediaBox by passing four :class:`float` coordinates (usually x0, y0, x1, y1).
        N)r   ÚFPDFPage_SetMediaBox©r   ÚlÚbÚrÚts        r   Úset_mediaboxzPdfPage.set_mediaboxu   ó#   € õ 	Ô% d¨A¨q°!°QÑ7Ô7Ð7Ð7Ð7r   c                 óN   — |                       t          j        | j        |¦  «        S )zc
        Returns:
            The page's CropBox (If not defined, falls back to MediaBox).
        )r=   r   ÚFPDFPage_GetCropBoxrD   rC   s     r   Úget_cropboxzPdfPage.get_cropbox{   s    € ð
 �}Š}�XÔ9¸4Ô;LÈkÑZÔZÐZr   c                 ó6   — t          j        | ||||¦  «         dS )z)
        Set the page's CropBox.
        N)r   ÚFPDFPage_SetCropBoxrG   s        r   Úset_cropboxzPdfPage.set_cropbox‚   ó#   € õ 	Ô$ T¨1¨a°°AÑ6Ô6Ð6Ð6Ð6r   c                 óN   — |                       t          j        | j        |¦  «        S )zc
        Returns:
            The page's BleedBox (If not defined, falls back to CropBox).
        )r=   r   ÚFPDFPage_GetBleedBoxrP   rC   s     r   Úget_bleedboxzPdfPage.get_bleedboxˆ   s    € ð
 �}Š}�XÔ:¸DÔ<LÈkÑZÔZÐZr   c                 ó6   — t          j        | ||||¦  «         dS )z*
        Set the page's BleedBox.
        N)r   ÚFPDFPage_SetBleedBoxrG   s        r   Úset_bleedboxzPdfPage.set_bleedbox�   rM   r   c                 óN   — |                       t          j        | j        |¦  «        S )zb
        Returns:
            The page's TrimBox (If not defined, falls back to CropBox).
        )r=   r   ÚFPDFPage_GetTrimBoxrP   rC   s     r   Úget_trimboxzPdfPage.get_trimbox•   s    € ð
 �}Š}�XÔ9¸4Ô;KÈ[ÑYÔYÐYr   c                 ó6   — t          j        | ||||¦  «         dS )z)
        Set the page's TrimBox.
        N)r   ÚFPDFPage_SetTrimBoxrG   s        r   Úset_trimboxzPdfPage.set_trimboxœ   rT   r   c                 óN   — |                       t          j        | j        |¦  «        S )za
        Returns:
            The page's ArtBox (If not defined, falls back to CropBox).
        )r=   r   ÚFPDFPage_GetArtBoxrP   rC   s     r   Ú
get_artboxzPdfPage.get_artbox¢   s    € ð
 �}Š}�XÔ8¸$Ô:JÈKÑXÔXÐXr   c                 ó6   — t          j        | ||||¦  «         dS )z(
        Set the page's ArtBox.
        N)r   ÚFPDFPage_SetArtBoxrG   s        r   Ú
set_artboxzPdfPage.set_artbox©   s#   € õ 	Ô# D¨!¨Q°°1Ñ5Ô5Ð5Ð5Ð5r   c                 ó¨   — t          j        ¦   «         }t          j        | |¦  «        }|st          d¦  «        ‚|j        |j        |j        |j        fS )zz
        Returns:
            The bounding box of the page (the intersection between its media box and crop box).
        z Failed to get page bounding box.)r   ÚFS_RECTFÚFPDF_GetPageBoundingBoxr   r8   r9   r:   r;   )r   Úrectr<   s      r   Úget_bboxzPdfPage.get_bbox°   sS   € õ
 Ô Ñ"Ô"ˆÝÔ-¨d°DÑ9Ô9ˆØð 	BÝÐ@ÑAÔAÐAØ”	˜4œ;¨¬
°D´HÐ=Ð=r   c                 óš   — t          j        | ¦  «        }|st          d¦  «        ‚t          || ¦  «        }|                      |¦  «         |S )zY
        Returns:
            PdfTextPage: A new text page handle for this page.
        zFailed to load text page.)r   ÚFPDFText_LoadPager   r   Ú_add_kid)r   Úraw_textpageÚtextpages      r   Úget_textpagezPdfPage.get_textpage¿   sQ   € õ
  Ô1°$Ñ7Ô7ˆØð 	;ÝÐ9Ñ:Ô:Ð:Ý˜|¨TÑ2Ô2ˆØ�Š�hÑÔÐØˆr   c                 ó4  — |j         rt          d¦  «        ‚|j        r|j        | j        urt          d¦  «        ‚t          j        | |¦  «        }|st
          j        dk    rt          d¦  «        ‚|                     ¦   «          | |_         | j        |_        dS )a¾  
        Insert a pageobject into the page.
        
        The pageobject must not belong to a page yet. If it belongs to a PDF, the target page must be part of that PDF.
        
        Position and form are defined by the object's matrix.
        If it is the identity matrix, the object will appear as-is on the bottom left corner of the page.
        
        Parameters:
            pageobj (PdfObject): The pageobject to insert.
        zAThe pageobject you attempted to insert already belongs to a page.zBThe pageobject you attempted to insert belongs to a different PDF.i�  zFailed to insert object.N)	ÚpageÚ
ValueErrorr   r   ÚFPDFPage_InsertObjectr	   Úbuildr   Ú_detach_finalizer©r   Úpageobjr<   s      r   Ú
insert_objzPdfPage.insert_objÌ   s¢   € ð Œ<ð 	bÝÐ`ÑaÔaÐaØŒ;ð 	c˜GœK¨t¬xÐ7Ð7ÝÐaÑbÔbÐbåÔ+¨D°'Ñ:Ô:ˆØð 	:•kÔ'¨4Ò/Ð/ÝÐ8Ñ9Ô9Ð9Ø×!Ò!Ñ#Ô#Ð#ØˆŒØ”hˆŒˆˆr   c                 óF  — |j         | urt          d¦  «        ‚|j        dk    r3|j        €J ‚t	          j        |j        |¦  «        }d\  |_        |_        n|j        �J ‚t	          j        | |¦  «        }|st          d¦  «        ‚d|_         |                     ¦   «          dS )a#  
        Remove a pageobject from the page.
        As of PDFium 5692, detached pageobjects may be only re-inserted into existing pages of the same document.
        If the pageobject is not re-inserted into a page, its ``close()`` method may be called.
        
        Note:
            If the object's :attr:`~.PdfObject.type` is :data:`FPDF_PAGEOBJ_TEXT`, any :class:`.PdfTextPage` handles to the page should be closed before removing the object.
        
        Parameters:
            pageobj (PdfObject): The pageobject to remove.
        z@The pageobject you attempted to remove is not part of this page.r   N)r   NzFailed to remove pageobject.)	rs   rt   ÚlevelÚ	containerr   ÚFPDFFormObj_RemoveObjectÚFPDFPage_RemoveObjectr   Ú_attach_finalizerrx   s      r   Ú
remove_objzPdfPage.remove_objæ   sº   € ð Œ<˜tÐ#Ð#ÝÐ_Ñ`Ô`Ð`àŒ=˜1ÒÐØÔ$Ð0Ð0Ð0ÝÔ2°7Ô3DÀgÑNÔNˆBØ/6Ñ,ˆGŒM˜7Ô,Ð,àÔ$Ð,Ð,Ð,ÝÔ/°°gÑ>Ô>ˆBàð 	>ÝÐ<Ñ=Ô=Ð=àˆŒØ×!Ò!Ñ#Ô#Ð#Ð#Ð#r   c                 óP   — t          j        | ¦  «        }|st          d¦  «        ‚dS )zê
        Generate page content to apply additions, removals or modifications of pageobjects.
        
        If page content was changed, this function should be called once before saving the document or re-loading the page.
        z Failed to generate page content.N)r   ÚFPDFPage_GenerateContentr   )r   r<   s     r   Úgen_contentzPdfPage.gen_content  s8   € õ Ô.¨tÑ4Ô4ˆØð 	BÝÐ@ÑAÔAÐAð	Bð 	Br   Né   r   c           	   #   ó  K  — |rt           j        }t           j        }|}n4t           j        }t           j        }| }|r|j        | urt          d¦  «        ‚ ||¦  «        }	|	dk     rt          d¦  «        ‚t          |	¦  «        D ]‰}
 |||
¦  «        }|st          d¦  «        ‚t          || | j
        |||¬¦  «        }|r	|j        |v r|V — |j        t           j        k    r,||dz
  k     r#|                      ||||dz   |¬¦  «        E d{V —† ŒŠdS )	a¸  
        Iterate through the pageobjects on this page.
        
        Parameters:
            filter (list[int] | None):
                An optional list of pageobject types to filter (:attr:`FPDF_PAGEOBJ_*`).
                Any objects whose type is not contained will be skipped.
                If None or empty, all objects will be provided, regardless of their type.
            max_depth (int):
                Maximum recursion depth to consider when descending into Form XObjects.
            textpage (PdfTextPage | None):
                Text page to pass through to any :class:`.PdfTextObj` instances.
        
        Yields:
            :class:`.PdfObject`: A pageobject.
        z0The given textpage does not belong to this page.r   z$Failed to get number of pageobjects.zFailed to get pageobject.)rs   r   r}   r|   rp   é   )ÚfilterÚ	max_depthÚformr|   rp   N)r   ÚFPDFFormObj_CountObjectsÚFPDFFormObj_GetObjectÚFPDFPage_CountObjectsÚFPDFPage_GetObjectrs   rt   r   Úranger   r   ÚtypeÚFPDF_PAGEOBJ_FORMÚget_objects)r   rˆ   r‰   rŠ   r|   rp   Úcount_objectsÚ
get_objectr   Ú	n_objectsÚiÚraw_objÚ
helper_objs                r   r’   zPdfPage.get_objects  s  è è € ð$ ð 		UÝ$Ô=ˆMÝ!Ô7ˆJØˆFˆFå$Ô:ˆMÝ!Ô4ˆJØˆFØð U˜HœM°Ð5Ð5Ý Ð!SÑTÔTÐTà!�M &Ñ)Ô)ˆ	Ø�qŠ=ˆ=ÝÐDÑEÔEÐEå�yÑ!Ô!ð 	ð 	ˆAà �j ¨Ñ+Ô+ˆGØð ?Ý!Ð"=Ñ>Ô>Ð>õ # 7°¸4¼8ÈtÐ[`ÐksÐtÑtÔtˆJØð !˜Zœ_°Ð6Ð6Ø Ð Ð Ð àŒ¥(Ô"<Ò<Ð<ÀÈÐSTÉÒATÐATØ×+Ò+Ø#Ø )Ø%Ø! A™IØ'ð ,ñ ô ð ð ð ð ð ð ð øð	ð 	r   c                 óš   — | j         st          d¦  «        ‚t          j        | |¦  «        }|t          j        k    rt          d¦  «        ‚|S )aƒ  
        Flatten form fields and annotations into page contents.
        
        Attention:
            * :meth:`~.PdfDocument.init_forms` must have been called on the parent pdf, before the page was retrieved, for this method to work. In other words, :attr:`.PdfPage.formenv` must be non-null.
            * Flattening may invalidate existing handles to the page, so you'll want to re-initialize these afterwards.
        
        Parameters:
            flag (int): PDFium flattening target (:attr:`FLAT_*`)
        Returns:
            int: PDFium flattening status (:attr:`FLATTEN_*`). :attr:`FLATTEN_FAIL` is handled internally.
        zFpage.flatten() requires prior pdf.init_forms(), before page retrieval.z,Failed to flatten annotations / form fields.)r   ÚRuntimeErrorr   ÚFPDFPage_FlattenÚFLATTEN_FAILr   )r   ÚflagÚrcs      r   ÚflattenzPdfPage.flattenH  sR   € ð Œ|ð 	iÝÐgÑhÔhÐhÝÔ& t¨TÑ2Ô2ˆØ•Ô&Ò&Ð&ÝÐLÑMÔMÐMØˆ	r   r‡   )r   r   r   r   Fc                 ó  ‡— t          j        |                      ¦   «         ‰z  ¦  «        }	t          j        |                      ¦   «         ‰z  ¦  «        }
|dv r|
|	}
}	ˆfd„|D ¦   «         }|	|d         z
  |d         z
  }|
|d         z
  |d         z
  }t	          d„ ||fD ¦   «         ¦  «        rt          d¦  «        ‚t          | fi |¤Ž\  }}}}|�|r|t          j        z  } |||||¬
¦  «        }| 	                    |dd||¦  «         |d          |d          |	|
t          j        |         f}|| g|¢|‘R }|€t          j        |Ž  nˆt          j        d¬¦  «        }t          j        |dt          ¦  «         |                     |¦  «        }t          j        g |¢|‘|‘R Ž }|t          j        k    s
J d¦   «         ‚t          j        | ¦  «         |r| j        rt          j        | j        g|¢R Ž  t-          j        | ¦  «        |f|_        |S )a  
        Rasterize the page to a :class:`.PdfBitmap`.
        
        Parameters:
            
            scale (float):
                A factor scaling the number of pixels per PDF canvas unit. This defines the resolution of the image.
                To convert a DPI value to a scale factor, multiply it by the size of 1 canvas unit in inches (usually 1/72in). [#user_unit]_
            
            rotation (int):
                Additional rotation in degrees (0, 90, 180, or 270).
            
            crop (tuple[float, float, float, float]):
                Amount to cut off from view (left, bottom, right, top), in PDF canvas units.
                Rendering crop applies on bitmap level (i.e. after rotation), unlike changing the page cropbox using :meth:`.set_cropbox`.
                Negative crop is not supported (though no exception will be raised). It may produce a larger canvas but not actually expand the rendering area, as of PDFium 7825.
            
            may_draw_forms (bool):
                If True, render form fields (provided the document has forms and :meth:`~.PdfDocument.init_forms` was called).
            
            bitmap_maker (typing.Callable):
                Callback function used to create the :class:`.PdfBitmap`.
            
            fill_color (tuple[int, int, int, int]):
                Color the bitmap will be filled with before rendering. This uses RGBA syntax regardless of the pixel format used, with values from 0 to 255.
                If the fill color is not opaque (i.e. has transparency), ``{BGR,RGB}A`` will be used.
            
            grayscale (bool):
                If True, render in grayscale mode.
            
            optimize_mode (None | str):
                Page rendering optimization mode (None, "lcd", "print").
            
            draw_annots (bool):
                If True, render page annotations.
            
            no_smoothtext (bool):
                If True, disable text anti-aliasing. Overrides ``optimize_mode="lcd"``.
            
            no_smoothimage (bool):
                If True, disable image anti-aliasing.
            
            no_smoothpath (bool):
                If True, disable path anti-aliasing.
            
            force_halftone (bool):
                If True, always use halftone for image stretching.
            
            limit_image_cache (bool):
                If True, limit image cache size.
            
            rev_byteorder (bool):
                If True, render with reverse byte order, leading to ``RGB{A/x}`` output rather than ``BGR{A/x}``.
                Other pixel formats are not affected.
            
            prefer_bgrx (bool):
                If True, use 4-byte ``{BGR/RGB}x`` rather than 3-byte ``{BGR/RGB}`` (i.e. add an unused byte).
                Other pixel formats are not affected.
            
            maybe_alpha (bool):
                If True, use a pixel format with alpha channel (i.e. ``{BGR/RGB}A``) if page content has transparency.
                This is recommended for performance in these cases, but as page-dependent format selection can be unexpected, it is not enabled by default.
            
            force_bitmap_format (int | None):
                If given, override automatic pixel format selection and enforce use of the given format (one of the :attr:`FPDFBitmap_*` constants). In this case, you should not pass any other format selection options, except potentially *rev_byteorder*.
            
            extra_flags (int):
                Additional PDFium rendering flags. May be combined with bitwise OR (``|`` operator).
            
            color_scheme (PdfColorScheme | None):
                A custom pdfium color scheme. Note that this may flatten different colors into one, so the usability of this is limited.
            
            fill_to_stroke (bool):
                If a *color_scheme* is given, whether to only draw borders around fill areas using the `path_stroke` color, instead of filling with the `path_fill` color.
        
        Returns:
            PdfBitmap: Bitmap of the rendered page.
        
        .. admonition:: Format selection
            
            This is the format selection hierarchy used by :meth:`.render`, from lowest to highest priority:
            
            * default: ``BGR``
            * ``prefer_bgrx=True``: ``BGRx``
            * ``grayscale=True``: ``L``
            * ``maybe_alpha=True``: ``BGRA`` if the page has transparency, else the format selected otherwise
            * ``fill_color[3] < 255``: ``BGRA`` (background color with transparency)
            * ``force_bitmap_format=...`` -> any supported by pdfium
            
            Additionally, ``rev_byteorder=True`` will swap ``BGR{A/x}`` to ``RGB{A/x}`` if applicable.
        
        .. [#user_unit] Since PDF 1.6, pages may define an additional user unit factor. In this case, 1 canvas unit is equivalent to ``user_unit * (1/72)`` inches. PDFium does not currently provide an API to get the user unit, so this is not taken into account.
        )éZ   i  c                 ó>   •— g | ]}t          j        |‰z  ¦  «        ‘ŒS r@   )ÚmathÚceil)Ú.0ÚcÚscales     €r   ú
<listcomp>z"PdfPage.render.<locals>.<listcomp>Ð  s'   ø€ Ð1Ð1Ð1 q•”	˜!˜E™'Ñ"Ô"Ð1Ð1Ð1r   r   é   r‡   é   c              3   ó"   K  — | ]
}|d k     V — ŒdS )r‡   Nr@   )r¥   Úds     r   ú	<genexpr>z!PdfPage.render.<locals>.<genexpr>Ó  s&   è è € Ð.Ð.˜ˆq�1ŠuÐ.Ð.Ð.Ð.Ð.Ð.r   zCrop exceeds page dimensionsN)ÚformatÚrev_byteorder)ÚversionÚNeedToPauseNowz0Progressive render return code indicates failure)r£   r¤   r    r#   Úanyrt   Ú_parse_renderoptsr   ÚFPDF_CONVERT_FILL_TO_STROKEÚ	fill_rectr)   r/   ÚFPDF_RenderPageBitmapÚIFSDK_PAUSEÚset_callbackÚ_pause_noopÚconvertÚ*FPDF_RenderPageBitmapWithColorScheme_StartÚFPDF_RENDER_FAILEDÚFPDF_RenderPage_Closer   ÚFPDF_FFLDrawÚweakrefÚrefÚ_render_args)r   r§   r0   ÚcropÚmay_draw_formsÚbitmap_makerÚcolor_schemeÚfill_to_strokeÚkwargsÚ	src_widthÚ
src_heightÚwidthÚheightÚ	cl_formatr¯   Ú
fill_colorÚflagsÚbitmapÚpos_argsÚrender_argsÚpauseÚfpdf_csÚstatuss    `                     r   ÚrenderzPdfPage.renderb  sa  ø€ õR ”Y˜tŸ~š~Ñ/Ô/°5Ñ8Ñ9Ô9ˆ	Ý”Y˜tŸšÑ0Ô0°5Ñ8Ñ9Ô9ˆ
Ø�yÐ Ð Ø$.°	�zˆIà1Ð1Ð1Ð1¨DÐ1Ñ1Ô1ˆØ˜d 1œgÑ%¨¨Q¬Ñ/ˆØ˜d 1œgÑ%¨¨Q¬Ñ/ˆÝÐ.Ð.˜u f˜oÐ.Ñ.Ô.Ñ.Ô.ð 	=ÝÐ;Ñ<Ô<Ð<å6GÈÐ6WÐ6WÐPVÐ6WÐ6WÑ3ˆ	�= *¨eØÐ$¨.Ð$Ø•XÔ9Ñ9ˆEà�˜e V°IÈ]Ð[Ñ[Ô[ˆØ×Ò˜ Q¨¨5°&Ñ9Ô9Ð9à˜!”W�H˜t Aœw˜h¨	°:½xÔ?WÐX`Ô?aÐbˆØ˜tÐ6 hÐ6°Ð6Ð6ˆàÐÝÔ*¨KÐ8Ð8Ð8åÔ(°Ð3Ñ3Ô3ˆEÝÔ! %Ð)9½;ÑGÔGÐGØ"×*Ò*¨=Ñ9Ô9ˆGÝÔHÐfÈ+ÐfÐW^ÐfÐ`eÐfÐfÐfˆFØ�XÔ8Ò8Ð8Ð8Ð:lÑ8Ô8Ð8ÝÔ*¨4Ñ0Ô0Ð0àð 	>˜dœlð 	>ÝÔ! $¤,Ð=°Ð=Ð=Ð=Ð=å&œ{¨4Ñ0Ô0°(Ð;ˆÔØˆr   )T)Nr…   Nr   N)&Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ústaticmethodr   Úpropertyr   r    r#   r%   r,   r1   r=   rD   rL   rP   rS   rW   rZ   r]   r`   rc   rf   rk   rq   rz   r�   r„   r’   r   ÚFLAT_NORMALDISPLAYrŸ   r   Ú
new_nativerÕ   Ú__classcell__)r   s   @r   r   r      sQ  ø€ € € € € ð
ð 
ð<ð <ð <ð <ð <ð ð%ð %ñ „\ð%ð ðð ñ „Xðð1ð 1ð 1ð2ð 2ð 2ð5ð 5ð 5ð8ð 8ð 8ðPð Pð PðBð Bð Bðcð cð cð cð8ð 8ð 8ð[ð [ð [ð [ð7ð 7ð 7ð[ð [ð [ð [ð8ð 8ð 8ðZð Zð Zð Zð7ð 7ð 7ðYð Yð Yð Yð6ð 6ð 6ð	>ð 	>ð 	>ð
ð 
ð 
ðð ð ð4$ð $ð $ðBBð Bð Bð3ð 3ð 3ð 3ðl $Ô6ð ð ð ð ð8 ØØØ!Ø$Ô/ØØ"ðLð Lð Lð Lð Lð Lð Lð Lr   r   c                 ó®   — |d         dk     s|r t          j        | ¦  «        rt           j        S |rt           j        S |rt           j        S t           j        S )Nrª   éÿ   )r   ÚFPDFPage_HasTransparencyÚFPDFBitmap_BGRAÚFPDFBitmap_GrayÚFPDFBitmap_BGRxÚFPDFBitmap_BGR)rs   rÍ   Ú	grayscaleÚprefer_bgrxÚmaybe_alphas        r   Ú_auto_bitmap_formatré   ñ  s]   € ð �!„}�sÒÐ˜{Ð­xÔ/PÐQUÑ/VÔ/VÐÝÔ'Ð'Ø	ð 'ÝÔ'Ð'Ø	ð 'ÝÔ'Ð'åÔ&Ð&r   ©rà   rà   rà   rà   FTc                 ó  — |€t          | ||||¦  «        }n|}|t          j        k    rd}
|}|r|t          j        z  }|r|t          j        z  }|r|t          j        z  }|r|t          j        z  }|r|t          j        z  }|r|t          j        z  }|	r|t          j	        z  }|
r|t          j
        z  }|rR|                     ¦   «         }|dk    r|t          j        z  }n(|dk    r|t          j        z  }nt          d|› �¦  «        ‚||
||fS )NFÚlcdÚprintzInvalid optimize_mode )ré   r   rã   ÚFPDF_GRAYSCALEÚ
FPDF_ANNOTÚFPDF_RENDER_NO_SMOOTHTEXTÚFPDF_RENDER_NO_SMOOTHIMAGEÚFPDF_RENDER_NO_SMOOTHPATHÚFPDF_RENDER_FORCEHALFTONEÚFPDF_RENDER_LIMITEDIMAGECACHEÚFPDF_REVERSE_BYTE_ORDERÚlowerÚFPDF_LCD_TEXTÚFPDF_PRINTINGrt   )rs   rÍ   ræ   Úoptimize_modeÚdraw_annotsÚno_smoothtextÚno_smoothimageÚno_smoothpathÚforce_halftoneÚlimit_image_cacher¯   rç   rè   Úforce_bitmap_formatÚextra_flagsrÌ   rÎ   s                    r   r³   r³   þ  s]  € ð$ Ð"Ý'¨¨j¸)À[ÐR]Ñ^Ô^ˆ	ˆ	à'ˆ	à•HÔ,Ò,Ð,Øˆà€EØð )Ø•Ô(Ñ(ˆØð %Ø•Ô$Ñ$ˆØð 4Ø•Ô3Ñ3ˆØð 5Ø•Ô4Ñ4ˆØð 4Ø•Ô3Ñ3ˆØð 4Ø•Ô3Ñ3ˆØð 8Ø•Ô7Ñ7ˆØð 2Ø•Ô1Ñ1ˆàð GØ%×+Ò+Ñ-Ô-ˆØ˜EÒ!Ð!Ø•XÔ+Ñ+ˆEˆEØ˜gÒ%Ð%Ø•XÔ+Ñ+ˆEˆEåÐE°mÐEÐEÑFÔFÐFð �m Z°Ð6Ð6r   c                   ó$   — e Zd ZdZd„ Zd„ Zd„ ZdS )r   z�
    Rendering color scheme.
    Each color shall be provided as a list of values for red, green, blue and alpha, ranging from 0 to 255.
    c                 ó6   — t          ||||¬¦  «        | _        d S )N)Úpath_fill_colorÚpath_stroke_colorÚtext_fill_colorÚtext_stroke_color)ÚdictÚcolors)r   Ú	path_fillÚpath_strokeÚ	text_fillÚtext_strokes        r   r   zPdfColorScheme.__init__=  s&   € ÝØ%¸Ø%¸ð
ñ 
ô 
ˆŒˆˆr   c                 ó@   — t          | ¦  «        j        › d| j        › d�S )Nz(**ú))r�   rÖ   r	  r   s    r   Ú__repr__zPdfColorScheme.__repr__C  s$   € Ý�t‘*”*Ô%Ð8Ð8¨$¬+Ð8Ð8Ð8Ð8r   c           	      ó²   — t          j        ¦   «         }| j                             ¦   «         D ])\  }}t	          ||t          j        ||¦  «        ¦  «         Œ*|S )z\
        Returns:
            The color scheme as :class:`FPDF_COLORSCHEME` object.
        )r   ÚFPDF_COLORSCHEMEr	  ÚitemsÚsetattrr)   Úcolor_tohex)r   r¯   rÓ   Úkeyr4   s        r   rº   zPdfColorScheme.convertF  s\   € õ
 Ô+Ñ-Ô-ˆØœ+×+Ò+Ñ-Ô-ð 	Nð 	N‰JˆC�Ý�G˜S¥(Ô"6°u¸mÑ"LÔ"LÑMÔMÐMÐMØˆr   N)rÖ   r×   rØ   rÙ   r   r  rº   r@   r   r   r   r   7  sK   € € € € € ðð ð

ð 
ð 
ð9ð 9ð 9ðð ð ð ð r   r   c                 ó   — dS )NFr@   )Úargs    r   r¹   r¹   Q  s   € Øˆ5r   )rê   FNTFFFFFFFFNr   )Ú__all__r£   ÚctypesÚloggingr¿   Úpypdfium2.rawr   r   Úpypdfium2.internalÚinternalr)   Úpypdfium2._helpers.miscr   Úpypdfium2._helpers.bitmapr   Úpypdfium2._helpers.textpager   Úpypdfium2._helpers.pageobjectsr   Úpypdfium2.versionr	   r3   Ú	getLoggerrÖ   ÚloggerÚAutoCloseabler   ré   r³   r   r¹   r@   r   r   ú<module>r'     sŽ  ðð (€à €€€Ø €€€Ø €€€Ø €€€Ø  Ð  Ð  Ð  Ð  Ð  Ø %Ð %Ð %Ð %Ð %Ð %Ø /Ð /Ð /Ð /Ð /Ð /Ø /Ð /Ð /Ð /Ð /Ð /Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø )Ð )Ð )Ð )Ð )Ð )à
Œ.€Ø	ˆÔ	˜8Ñ	$Ô	$€ðXð Xð Xð Xð XˆxÔ%ñ Xô Xð Xðv
'ð 
'ð 
'ð *ØØØØØØØØ!ØØØØ"Øð67ð 67ð 67ð 67ðrð ð ð ð ñ ô ð ð4ð ð ð ð r   