HEX
Server: Apache
System: Linux srv1.prosuiteplus.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: prosuiteplus (1001)
PHP: 8.3.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/pdfminer/__pycache__/pdfpage.cpython-38.pyc
U

�R�]��@s�ddlZddlmZddlmZddlmZddlmZddlmZddlm	Z	dd	lm
Z
dd
lmZddl
mZddl
mZddlZe�e�Zed
�Zed�ZGdd�de�ZdS)�N�)�settings)�LIT)�PDFObjectNotFound)�resolve1)�	int_value)�
list_value)�
dict_value)�	PDFParser)�PDFDocument)�PDFTextExtractionNotAllowedZPage�Pagesc@sJeZdZdZdd�Zdd�Zedddd	g�Zed
d��Z	eddd��Z
dS)�PDFPagea!An object that holds the information about a page.

    A PDFPage object is merely a convenience class that has a set
    of keys and values, which describe the properties of a page
    and point to its contents.

    Attributes:
      doc: a PDFDocument object.
      pageid: any Python object that can uniquely identify the page.
      attrs: a dictionary of page attributes.
      contents: a list of PDFStream objects that represents the page content.
      lastmod: the last modified time of the page.
      resources: a list of resources used by the page.
      mediabox: the physical size of the page.
      cropbox: the crop rectangle of the page.
      rotate: the page rotation (in degree).
      annots: the page annotations.
      beads: a chain that represents natural reading order.
    cCs�||_||_t|�|_t|j�d��|_t|j�dt���|_t|jd�|_	d|jkrjt|jd�|_
n|j	|_
t|j�dd��dd|_|j�d�|_
|j�d	�|_d
|jkr�t|jd
�}ng}t|t�s�|g}||_dS)z�Initialize a page object.

        doc: a PDFDocument object.
        pageid: any Python object that can uniquely identify the page.
        attrs: a dictionary of page attributes.
        ZLastModified�	Resources�MediaBox�CropBox�RotaterihZAnnots�BZContentsN)�doc�pageidr	�attrsr�getZlastmod�dict�	resources�mediaboxZcropboxr�rotateZannotsZbeads�
isinstance�list�contents)�selfrrrr�r �2/usr/lib/python3/dist-packages/pdfminer/pdfpage.py�__init__.s&



zPDFPage.__init__cCsd|j|jfS)Nz$<PDFPage: Resources=%r, MediaBox=%r>)rr)rr r r!�__repr__KszPDFPage.__repr__rrrrc
#s����fdd��d}d�jkrL��jd�j�D]\}}��||�Vd}q0|s��jD]\}|��D]N}z4��|�}t|t�r�|�d�tkr���||�VWqbtk
r�YqbXqbqVdS)Nc	3s�t|t�r"|}t��|����}n|j}t|���}t�|�D]"\}}|�jkr>||kr>|||<q>|�	d�}|dkr�t
js�|�	d�}|tkr�d|kr�t
�d|d�t|d�D]}�||�D]
}|Vq�q�n|tkr�t
�d|�||fVdS)N�Type�typeZKidszPages: Kids=%rzPage: %r)r�intr	�getobj�copy�objid�sixZ	iteritems�INHERITABLE_ATTRSrrZSTRICT�
LITERAL_PAGES�log�infor�LITERAL_PAGE)	�obj�parentr)�tree�k�vZ	tree_type�c�x��document�klass�searchr r!r:Rs&



z$PDFPage.create_pages.<locals>.searchFr
Tr$)	ZcatalogZxrefsZ
get_objidsr'rrrr/r)r9r8Zpagesr)r2Zxrefr0r r7r!�create_pagesPs 



zPDFPage.create_pagesNr�Tccspt|�}t|||d�}|r,|js,td|��t|�|��D]0\}	}
|rP|	|krPq:|
V|r:||	dkr:qlq:dS)N)�password�cachingz"Text extraction is not allowed: %rr)r
rZis_extractabler�	enumerater;)r9�fpZpagenosZmaxpagesr=r>Zcheck_extractable�parserrZpagenoZpager r r!�	get_pageszs
zPDFPage.get_pages)Nrr<TT)�__name__�
__module__�__qualname__�__doc__r"r#�setr+�classmethodr;rBr r r r!rs
)�r)Zloggingr<rZpsparserrZpdftypesrrrrr	Z	pdfparserr
Zpdfdocumentrrr*Z	getLoggerrCr-r/r,�objectrr r r r!�<module>s