
    )i                        S SK r S SKrS SKJrJrJrJrJrJrJ	r	  S SK
Jr  SSKJr  SSKJrJrJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  \R8                  " \5      r\" S5      r\" S5      r  " S S5      r!g)    N)BinaryIO	ContainerDictIteratorListOptionalTuple)Rect   )settings)PDFDocumentPDFTextExtractionNotAllowedPDFNoPageLabels)	PDFParser)PDFObjectNotFound)
dict_value)	int_value)
list_value)resolve1)LITPagePagesc                       \ rS rSrSrS\S\S\S\\   SS4
S	 jr	S\4S
 jr
1 Skr\S\S\S    4S j5       r\     SS\S\\\      S\S\S\S\S\S    4S jj5       rSrg)PDFPage   a'  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 dictionary 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.
  label: the page's label (typically, the logical page number).
docpageidattrslabelreturnNc                 (   Xl         X l        [        U5      U l        X@l        [        U R                  R                  S5      5      U l        [        U R                  R                  S[        5       5      5      U l	        [        U R                  S   5      U l
        SU R                  ;   a  [        U R                  S   5      U l        OU R                  U l        [        U R                  R                  SS5      5      S-   S-  U l        U R                  R                  S5      U l        U R                  R                  S	5      U l        S
U R                  ;   a  [        U R                  S
   5      nO/ n[!        U["        5      (       d  U/nXPl        g)zInitialize a page object.

doc: a PDFDocument object.
pageid: any Python object that can uniquely identify the page.
attrs: a dictionary of page attributes.
label: page label string.
LastModified	ResourcesMediaBoxCropBoxRotater   ih  AnnotsBContentsN)r   r   r   r   r   r   getlastmoddict	resourcesmediaboxcropboxr   rotateannotsbeads
isinstancelistcontents)selfr   r   r   r   r5   s         P/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/pdfminer/pdfpage.py__init__PDFPage.__init__-   s%    &



~ >?/7JJNN;/0
 'tzz*'=>

"!)$**Y*?!@DL==DL !!<=CsJjjnnX.ZZ^^C(
#

: 67HH(D)) zH&.    c                 N    SR                  U R                  U R                  5      $ )Nz(<PDFPage: Resources={!r}, MediaBox={!r}>)formatr-   r.   )r6   s    r7   __repr__PDFPage.__repr__O   s"    9@@NNDMM
 	
r:   >   r&   r%   r$   r#   documentc              #     ^ ^^	#    S[         S[        [        [         4   S[        [        [
        [        [         [        [         [         4   4   4      4U UU	4S jjm	 TR                  5       nSnSTR                  ;   aB  T	" TR                  S   TR                  5      nU H  u  pVT " TXV[        U5      5      v   SnM     U(       d  TR                   Hr  nUR                  5        H[  n TR                  U5      n[        U[         5      (       a1  UR#                  S5      [$        L a  T " TXX[        U5      5      v   MY  M[  M]     Mt     g ! [         a    [        R                  " S 5      n GNf = f! [&         a     M  f = f7f)	Nobjparentr    c              3     >#    [        U [        5      (       a+  U n[        T	R                  U5      5      R	                  5       nO%U R
                  n[        U 5      R	                  5       nUR                  5        H"  u  pEUTR                  ;   d  M  XC;  d  M  XSU'   M$     UR                  S5      nUc&  [        R                  (       d  UR                  S5      nU[        L aE  SU;   a?  [        R                  SUS   5        [        US   5       H  nT
" Xs5       S h  vN   M     g U[        L a  [        R                  SU5        X#4v   g g  N/7f)NTypetypeKidszPages: Kids=%rzPage: %r)r3   intr   getobjcopyobjiditemsINHERITABLE_ATTRSr*   r   STRICTLITERAL_PAGESlogdebugr   LITERAL_PAGE)rA   rB   rJ   treekv	tree_typecclsr?   searchs           r7   rX   $PDFPage.create_pages.<locals>.searchX   s     #s##!(//%"89>>@ 		!#++- ,,.---!-G ) (I  HHV,	M)fn		*DL9#DL1A%a.. 2l*		*d+m# + /s   B	EEBEE0EFr   TrD   )objectr   strr   r	   rG   get_page_labelsr   	itertoolsrepeatcatalognextxrefs
get_objidsrH   r3   r,   r*   rQ   r   )
rW   r?   page_labelspagesobjectsrJ   rR   xrefrA   rX   s
   ``       @r7   create_pagesPDFPage.create_pagesV   se    	$	$!%c6k!2	$eCfd66>.B&B!CCDE	$ 	$6	13;3K3K3MK h&&&X--g68H8HIG!((Ek1BCC ")  !__.E&ooe4%c400SWWV_5T"%hD<M"NN 6U0 / ' 	'  	1#**40K	1" - sP   AFE .A=F,AE3?F E0,F/E00F3
F=F FFfppagenosmaxpagespasswordcachingcheck_extractablec              #   J  #    [        U5      n[        XtUS9nUR                  (       d1  U(       a  SU-  n	[        U	5      eSU-  n
[        R                  U
5        [        U R                  U5      5       H*  u  pU(       a  X;  a  M  Uv   U(       d  M   X;S-   ::  d  M*    g    g 7f)N)rl   rm   z"Text extraction is not allowed: %rzThe PDF %r contains a metadata field indicating that it should not allow text extraction. Ignoring this field and proceeding. Use the check_extractable if you want to raise an error in this caser   )r   r   is_extractabler   rO   warning	enumeraterg   )rW   ri   rj   rk   rl   rm   rn   parserr   	error_msgwarning_msgpagenopages                r7   	get_pagesPDFPage.get_pages   s      2&WE !! @2E	1)<<A DF	F  K('(8(8(=>NVF1JxH
2 ? 	s   BB#B#B#)r1   r   r2   r5   r/   r   r   r+   r.   r   r-   r0   )Nr    TF)__name__
__module____qualname____firstlineno____doc__r   rZ   r   r[   r8   r=   rL   classmethodr   rg   r   r   rG   boolrx   __static_attributes__ r:   r7   r   r      s    * / /(. /7= /FNsm /	 /D
# 

 G1K 1HY4G 1 1f  -1"'## )C.)# 	#
 # #  # 
)	# #r:   r   )"r]   loggingtypingr   r   r   r   r   r   r	   pdfminer.utilsr
   rz   r   pdfdocumentr   r   r   	pdfparserr   pdftypesr   r   r   r   r   psparserr   	getLoggerr{   rO   rQ   rN   r   r   r:   r7   <module>r      se      M M M   R R   '       ! 6{GW Wr:   