o
    @@id                     @   sD   d Z ddlZddlmZ ddlmZ ddlmZ G dd deZdS )z]
    This class represents the meta-information belonging to a single page in a PDF document
    N)Decimal)
Dictionary)PageSizec                       s   e Zd ZdZd fddZdeje fddZdeje fd	d
Z	dej
eef fddZdeje fddZdeje fddZdeje fddZdeje fddZdeje fddZdeje fddZdeje fddZ  ZS )PageInfoza
    This class represents the meta-information belonging to a single page in a PDF document
    pagePagec                    s   t t|   || _d S )N)superr   __init___page)selfr   	__class__ U/home/ubuntu/transcripts/venv/lib/python3.10/site-packages/borb/pdf/page/page_info.pyr	      s   
zPageInfo.__init__returnc                 C      | j d d S )aW  
        Return the height of the MediaBox. This is a rectangle (see 7.9.5, "Rectangles"),
        expressed in default user space units, that shall define the
        boundaries of the physical medium on which the page shall be
        displayed or printed (see 14.11.2, "Page Boundaries").
        :return:    the height of the Page
        MediaBox   r
   r   r   r   r   
get_height#      zPageInfo.get_heightc                 C   sZ   | j   d}t| j   d}td|D ]}|| | j kr*t|  S qdS )z[
        This function returns the page number
        :return:    the page number
        KidsCountr   N)r
   
get_parentgetintranger   )r   kidslir   r   r   get_page_number-   s   zPageInfo.get_page_numberc                 C   s    |   ptd|  ptdfS )a  
        Return the (width, height) of the MediaBox. This is a rectangle (see 7.9.5, "Rectangles"),
        expressed in default user space units, that shall define the
        boundaries of the physical medium on which the page shall be
        displayed or printed (see 14.11.2, "Page Boundaries").
        :return:    the width, height (as typing.Tuple[Decimal, Decimal]) of the Page
        r   )	get_widthr   r   r   r   r   r   get_size9   s    zPageInfo.get_sizec                 C   s~   |   }|  }|du s|du rdS |dusJ |dusJ tD ]}t||jd  dkr<t||jd  dkr<|  S q dS )a  
        Return the size of the MediaBox as a convenient, well-known,
        well-defined property (e.g. A4_PORTRAIT).
        This is a rectangle (see 7.9.5, "Rectangles"),
        expressed in default user space units, that shall define the
        boundaries of the physical medium on which the page shall be
        displayed or printed (see 14.11.2, "Page Boundaries").
        :return:    the width, height (as PageSize) of the Page
        N   )r"   r   r   absvalue)r   whpr   r   r   get_size_as_enumC   s   
,zPageInfo.get_size_as_enumc                 C   r   )aU  
        Return the width of the MediaBox. This is a rectangle (see 7.9.5, "Rectangles"),
        expressed in default user space units, that shall define the
        boundaries of the physical medium on which the page shall be
        displayed or printed (see 14.11.2, "Page Boundaries").
        :return:    the width of the Page
        r      r   r   r   r   r   r"   X   r   zPageInfo.get_widthc                 C      d| j d d v S )u  
        The PDF operators used in content streams are grouped into categories of related operators called procedure
        sets (see Table 314). Each procedure set corresponds to a named resource containing the implementations of
        the operators in that procedure set. The ProcSet entry in a content stream’s resource dictionary (see 7.8.3,
        “Resource Dictionaries”) shall hold an array consisting of the names of the procedure sets used in that content
        stream.
        This method returns whether this PDF uses operators from the "ImageC" procedure set.
        :return:    True if the Page uses color images, False otherwise
        ImageC	ResourcesProcSetr   r   r   r   r   uses_color_imagesb      
zPageInfo.uses_color_imagesc                 C   r,   )u  
        The PDF operators used in content streams are grouped into categories of related operators called procedure
        sets (see Table 314). Each procedure set corresponds to a named resource containing the implementations of
        the operators in that procedure set. The ProcSet entry in a content stream’s resource dictionary (see 7.8.3,
        “Resource Dictionaries”) shall hold an array consisting of the names of the procedure sets used in that content
        stream.
        This method returns whether this PDF uses operators from the "ImageB" procedure set.
        :return:    True if the Page uses grayscale images, False otherwise
        ImageBr.   r/   r   r   r   r   r   uses_grayscale_imagesn   r1   zPageInfo.uses_grayscale_imagesc                 C   r,   )u  
        The PDF operators used in content streams are grouped into categories of related operators called procedure
        sets (see Table 314). Each procedure set corresponds to a named resource containing the implementations of
        the operators in that procedure set. The ProcSet entry in a content stream’s resource dictionary (see 7.8.3,
        “Resource Dictionaries”) shall hold an array consisting of the names of the procedure sets used in that content
        stream.
        This method returns whether this PDF uses operators from the "ImageI" procedure set.
        :return:    True if the Page uses indexed images, False otherwise
        ImageIr.   r/   r   r   r   r   r   uses_indexed_imagesz   r1   zPageInfo.uses_indexed_imagesc                 C   r,   )uM  
        The PDF operators used in content streams are grouped into categories of related operators called procedure
        sets (see Table 314). Each procedure set corresponds to a named resource containing the implementations of
        the operators in that procedure set. The ProcSet entry in a content stream’s resource dictionary (see 7.8.3,
        “Resource Dictionaries”) shall hold an array consisting of the names of the procedure sets used in that content
        stream.
        This method returns whether this PDF uses operators from the "PDF" procedure set.
        PDFr.   r/   r   r   r   r   r    uses_painting_and_graphics_state      	z)PageInfo.uses_painting_and_graphics_statec                 C   r,   )uN  
        The PDF operators used in content streams are grouped into categories of related operators called procedure
        sets (see Table 314). Each procedure set corresponds to a named resource containing the implementations of
        the operators in that procedure set. The ProcSet entry in a content stream’s resource dictionary (see 7.8.3,
        “Resource Dictionaries”) shall hold an array consisting of the names of the procedure sets used in that content
        stream.
        This method returns whether this PDF uses operators from the "Text" procedure set.
        Textr.   r/   r   r   r   r   r   	uses_text   r8   zPageInfo.uses_text)r   r   )__name__
__module____qualname____doc__r	   typingOptionalr   r   r!   Tupler#   r   r*   r"   boolr0   r3   r5   r7   r:   __classcell__r   r   r   r   r      s    


r   )	r>   r?   decimalr   borb.io.read.typesr   borb.pdf.page.page_sizer   r   r   r   r   r   <module>   s   