+
    f0i9                        R t ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	H
t
 ^ RIHtHtHt ^ RIt^ RIHtHtHt ^ RIHtHtHtHt ^ RIHt ^ RIHt ^ R	IHtHtH t H!t! ^ R
I"H#t#H$t$H%t% ^ RI&H't' ]PP                  ! 4        ]PR                  ! ]*4      t+]PX                  ! R4      t-R R lt.R"R R llt/R#R R llt0R$R R llt1R%R R llt2]#! R4      t3]#! R4      t4R R lt5R&R R llt6R R lt7R"R R  llt8]*R!8X  d
   ]8! 4        R# R# )'z#Extract pdf structure in XML formatNArgumentParser)	ContainerIterable)AnyTextIOcast)PDFDocumentPDFNoOutlinesPDFXRefFallback)
PDFIOErrorPDFObjectNotFoundPDFTypeErrorPDFValueError)PDFPage)	PDFParser)	PDFObjRef	PDFStreamresolve1stream_value)LIT	PSKeyword	PSLiteral)isnumberz&[\000-\037&<>()"\042\047\134\177-\377]c                F    V ^8  d   QhR\         \        ,          R\         /# )   sreturn)strbytes)formats   "Z/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/../../../bin/dumppdf.py__annotate__r"       s     > >cEk >c >    c                 x    \        V \        4      '       d   \        V R 4      MT p\        P	                  R V4      # )zlatin-1c                 >    R \        V P                  ^ 4      4       R2# )z&#;)ordgroup)ms   &r!   <lambda>escape.<locals>.<lambda>"   s    2c!''!*o%6a!8r#   )
isinstancer   r   ESC_PATsub)r   uss   & r!   escaper0       s.    (E22Q		B;;8"==r#   c                N    V ^8  d   QhR\         R\        R\        R,          RR/# )r   outobjcodecNr   )r   objectr   )r    s   "r!   r"   r"   %   s,     > > >f >S4Z >4 >r#   c                 n   Vf   V P                  R4       R # \        V\        4      '       d   V P                  R\        V4       R24       VP	                  4        FG  w  r4V P                  RV R24       V P                  R4       \        W4       V P                  R4       KI  	  V P                  R4       R # \        V\        4      '       dW   V P                  R	\        V4       R24       V F  p\        W4       V P                  R
4       K!  	  V P                  R4       R # \        V\        \        34      '       d-   V P                  R\        V4       R\        V4       R24       R # \        V\        4      '       d   VR8X  d"   V P                  VP                  4       4       R # VR8X  d"   V P                  VP                  4       4       R # V P                  R4       \        WP                  4       V P                  R4       VR8X  d;   VP                  4       pV P                  R\        V4       R\        V4       R24       V P                  R4       R # \        V\        4      '       d"   V P                  RVP                   R24       R # \        V\         4      '       d"   V P                  RVP"                   R24       R # \        V\$        4      '       d"   V P                  RVP"                   R24       R # \'        V4      '       d   V P                  RV R24       R # \)        V4      h)Nz<null />z<dict size="">
z<key>z</key>
z<value>z	</value>
z</dict>z<list size="
z</list>z<string size="z">z	</string>rawbinaryz<stream>
<props>
z

</props>
textz<data size="z</data>
z	</stream>z	<ref id="z" />z	<keyword>z
</keyword>z	<literal>z
</literal>z<number>z	</number>)writer,   dictlenitemsdumpxmllistr   r   r0   r   get_rawdataget_dataattrsr   objidr   namer   r   r   )r2   r3   r4   kvdatas   &&&   r!   r@   r@   %   s|   
{		*#t		LS
$/0IIKDAIIaS)*IIi COIIl#	  
 			)#t		LS
$/0ACOIIdO  			)#U|$$		N3s8*Bvc{m9EF#y!!E>IIcoo'( 	 hIIclln% 	 II+,C#IIn%||~		LT2fTl^9MNIIk"#y!!		Icii[-.#y!!		IchhZz23#y!!		IchhZz23}}		HSE+,
s
r#   c                @    V ^8  d   QhR\         R\        R\        RR/# )r   r2   docshow_fallback_xrefr   N)r   r	   bool)r    s   "r!   r"   r"   f   s0      		  
	r#   c                    VP                    F^  p\        V\        4      '       d   V'       g   K#  V P                  R 4       \	        WP                  4       4       V P                  R4       K`  	  \        ;QJ d&    R VP                    4       F  '       d   K   RM	  RM! R VP                    4       4      pV'       d$   V'       g   Rp\        P                  V4       R# R# R# )z
<trailer>
z
</trailer>

c              3   B   "   T F  p\        V\        4      x  K  	  R # 5iN)r,   r   ).0xrefs   & r!   	<genexpr>dumptrailers.<locals>.<genexpr>p   s     K:dO44s   FTzThis PDF does not have an xref. Use --show-fallback-xref if you want to display the content of a fallback xref that contains all objects.N)	xrefsr,   r   r<   r@   get_trailerallloggerwarning)r2   rK   rL   rR   no_xrefsmsgs   &&&   r!   dumptrailersr\   f   s    
 		$004F4FIIm$C))+,II()	 
 sKKsssKKKH*$ 	
 	s +xr#   c          
      Z    V ^8  d   QhR\         R\        R\        R,          R\        RR/# )r   r2   rK   r4   NrL   r   )r   r	   r   rM   )r    s   "r!   r"   r"   z   s>      		 : 	
 
r#   c                    \        4       pV P                  R 4       VP                   F~  pVP                  4        Fg  pWd9   d   K  VP	                  V4        VP                  V4      pVf   K4  V P                  RV R24       \        WVR7       V P                  R4       Ki  	  K  	  \        WV4       V P                  R4       R#   \         d   p\        RT: 24        Rp?K  Rp?ii ; i)z<pdf>Nz<object id="r7   r4   z
</object>

znot found: z</pdf>)
setr<   rU   
get_objidsaddgetobjr@   r   printr\   )	r2   rK   r4   rL   visitedrR   rE   r3   es	   &&&&     r!   dumpallobjsrg   z   s     eGIIg		__&EKK+jj';		Lt45.		+, '  -.IIh % +A5)**+s   C	/3C		C.C))C.c                    V ^8  d   QhR\         R\        R\        R\        \        ,          R\        R\
        R\        R,          R	\        R,          R
R/	# )r   outfpfnameobjidspagenospassworddumpallr4   N
extractdirr   )r   r   r   r   intrM   )r    s   "r!   r"   r"      sn     8 888 8 s^	8
 8 8 :8 d
8 
8r#   c           
      h  a \        VR 4      ;_uu_ 4       p\        V4      p	\        W4      o\        \        P
                  ! S4      ^4       U
Uu/ uF  w  rVP                  V
bK  	  pp
pR V3R llp SP                  4       pV P                  R4       V EFA  w  pppppRp
V'       d$   V! V4      pVV^ ,          P                  ,          p
MV'       d   Tp\        V\        4      '       dj   VP                  R4      pV'       dQ   \        V4      R8X  dA   VP                  R4      '       d*   V! VR,          4      pVV^ ,          P                  ,          p
\        V4      pV P                  RV: R	V R
24       Ve/   V P                  R4       \        V V4       V P                  R4       V
e   V P                  RV
: R24       V P                  R4       EKD  	  V P                  R4       V	P#                  4        RRR4       R# u upp
i   \          d     L-i ; i  + '       g   i     R# ; i)rbc                0    V ^8  d   QhR\         R\        /# )r   destr   )r5   r   )r    s   "r!   r"   !dumpoutline.<locals>.__annotate__   s     		 		v 		# 		r#   c                 t  < \        V \        \        34      '       d   \        SP	                  V 4      4      p M:\        V \
        4      '       d%   \        SP	                  V P                  4      4      p \        V \        4      '       d
   V R ,          p \        V \        4      '       d   V P                  4       p V # )D)
r,   r   r   r   get_destr   rF   r=   r   resolve)rt   rK   s   &r!   resolve_dest!dumpoutline.<locals>.resolve_dest   s~    $e--T 23D),,TYY 78$%%Cy$	**||~Kr#   z<outlines>
NSz/'GoTo'rw   z<outline level="z	" title="r7   z<dest>z</dest>
z<pageno>z
</pageno>
z</outline>
z</outlines>
)openr   r	   	enumerater   create_pagespageidget_outlinesr<   rE   r,   r=   getreprr0   r@   r
   close)ri   rj   rk   rl   rm   rn   r4   ro   fpparserpagenopagepagesrz   outlinesleveltitlert   a_seactionsubtyper   rK   s   &&&&&&&&               @r!   dumpoutliner      s    
eT		b2&+ #,G,@,@,Eq"I
"I KK"I 	 

		 			'')HKK'.6*udAs'-D"47==1FF!&$//"(**S/"tG}	'AfjjQToo#/s#<D%*47==%9F5M.uiy4HI#KK)E4(KK,%KK(6*K @AN+) /7* KK( 	] 
	
R  		Y 
		sU   :H H	
(H 5A!H0H&H/C H/H 	H HH HH  H1	FilespecEmbeddedFilec                @    V ^8  d   QhR\         R\         R\         RR/# )r   rj   rm   ro   r   N)r   )r    s   "r!   r"   r"      s(     $) $)3 $)# $)3 $)4 $)r#   c                   aa
 R  V
V3R llp\        V R4      ;_uu_ 4       p\        V4      p\        WQ4      o
\        4       pS
P                   F  pVP                  4        Fh  pS
P                  V4      p	W9  g   K  \        V	\        4      '       g   K4  V	P                  R4      \        J g   KO  VP                  V4       V! W4       Kj  	  K  	  RRR4       R#   + '       g   i     R# ; i)c                V    V ^8  d   QhR\         R\        \        \        3,          RR/# )r   rE   r3   r   N)rp   r=   r   r   )r    s   "r!   r"   %extractembedded.<locals>.__annotate__   s)     * * *$sCx. *T *r#   c                   < \         P                  P                  VP                  R 4      ;'       g.    \	        \
        VP                  R4      4      P                  4       4      pVR,          P                  R 4      ;'       g    VR,          P                  R4      pSP                  VP                  4      p\        V\        4      '       g   RV: R2p\        V4      hVP                  R4      \        Jd   \        RV: R24      h\         P                  P                  S	V R RV 24      p\         P                  P                  V4      '       d   \        R	V: 24      h\!        R
V: 24       \         P"                  ! \         P                  P%                  V4      RR7       \'        VR4      ;_uu_ 4       pVP)                  VP+                  4       4       RRR4       R#   + '       g   i     R# ; i)UFFEFz%unable to process PDF: reference for z is not a PDFStreamTypez is not an EmbeddedFile06d-zfile exists: zextracting: T)exist_okwbN)ospathbasenamer   r   r   decoderc   rE   r,   r   r   LITERAL_EMBEDDEDFILEjoinexistsr   rd   makedirsdirnamer}   r<   rC   )
rE   r3   filenamefilereffileobj	error_msgr   r2   rK   ro   s
   &&      r!   extract1!extractembedded.<locals>.extract1   sz   77##CGGDM$W$WT%5N5U5U5WXd)--%;;Ts);**W]]+'9--7|CVW   	**;;v&::7| D) )  ww||J5+Qxj(AB77>>$}TH566TH%&
BGGOOD)D9$IIg&&() s   ; G%%G6	rr   r   N)r}   r   r	   r`   rU   ra   rc   r,   r=   r   LITERAL_FILESPECrb   )rj   rm   ro   r   r   r   extracted_objidsrR   rE   r3   rK   s   &&f       @r!   extractembeddedr      s    * *, 
eT		b2&+5IID*jj'1"3--+;;$((/U( + 	 
			s   AC=CC0!CC,	c                    V ^8  d   QhR\         R\        R\        \        ,          R\        \        ,          R\        R\
        R\        R,          R	\        R,          R
\
        RR/
# )r   ri   rj   rk   rl   rm   rn   r4   Nro   rL   r   )r   r   r   rp   r   rM   )r    s   "r!   r"   r"      s|           SM  s^	 
     :  d
    
 r#   c	           
         \        VR 4      ;_uu_ 4       p	\        V	4      p
\        W4      pV'       d(   V F!  pVP                  V4      p\	        WVR7       K#  	  V'       d{   \        \        P                  ! V4      4       FW  w  rW9   g   K  V'       d.   VP                   F  p\        V4      p\	        WVR7       K  	  KB  \	        WP                  4       KY  	  V'       d   \        WWh4       V'       g   V'       g   V'       g   \        WV4       RRR4       VR9  d   V P                  R4       R# R#   + '       g   i     L,; i)rr   r_   Nr8   )r9   r:   )r}   r   r	   rc   r@   r~   r   r   contentsr   rD   rg   r\   r<   )ri   rj   rk   rl   rm   rn   r4   ro   rL   r   r   rK   rE   r3   r   r   s   &&&&&&&&&       r!   dumppdfr      s     
eT		b2&+jj'%0    )'*>*>s*C D$#'==C".s"3C#Ee< $1  zz2 !E E>7%78' 
( %%D &) 
	s7   AD9#'D9D9AD9%D99D9D9	D99E		c                $    V ^8  d   QhR\         /# )r   r   r   )r    s   "r!   r"   r"     s     x x~ xr#   c                     \        \        R R7      p V P                  R\        RRRR7       V P                  RRR	R
\        P
                   2R7       V P                  RRRRRR7       V P                  4       pVP                  RRRRRR7       VP                  RR\        RR7       V P                  RRR7      pVP                  R\        RRRR7       VP                  RR\        R R7       VP                  R!R"\        R#R7       VP                  R$R%RRR&R7       VP                  R'RR(R)7       VP                  R*R+\        R,R-R.7       V P                  R/R0R7      pVP                  R1R2\        R3R4R.7       VP                  4       pVP                  R5R6RRR7R7       VP                  R8R9RRR:R7       VP                  R;R<RRR=R7       V # )>T)descriptionadd_helpfilesN+zOne or more paths to PDF files.)typedefaultnargshelpz	--versionz-vversionzpdfminer.six v)r   r   z--debugz-dF
store_truezUse debug logging level.)r   r   r   z--extract-tocz-TzExtract structure of outlinez--extract-embeddedz-EzExtract embedded files)r   r   ParserzUsed during PDF parsing)r   z--page-numbersz0A space-seperated list of page numbers to parse.z	--pagenosz-pzA comma-separated list of page numbers to parse. Included for legacy applications, use --page-numbers for more idiomatic argument entry.z	--objectsz-iz1Comma separated list of object numbers to extractz--allz-az3If the structure of all objects should be extractedz--show-fallback-xrefzAdditionally show the fallback xref. Use this if the PDF has zero or only invalid xref's. This setting is ignored if --extract-toc or --extract-embedded is used.)r   r   z
--passwordz-P z,The password to use for decrypting PDF file.)r   r   r   OutputzUsed during output generation.z	--outfilez-or   zJPath to file where output is written. Or "-" (default) to write to stdout.z--raw-streamz-rz%Write stream objects without encodingz--binary-streamz-bz)Write stream objects with binary encodingz--text-streamz-tz"Write stream objects as plain text)	r   __doc__add_argumentr   pdfminer__version__add_mutually_exclusive_groupadd_argument_grouprp   )r   procedure_parserparse_paramsoutput_paramscodec_parsers        r!   create_parserr     s   $?F
.    !5!5 67	   '   ::<!!+ "  !!%	 "  ,,- - L ?   	   @	   B   7   ;   --4 . M    !==?L4   8   1   Mr#   c                L    V ^8  d   QhR\         \        ,          R,          RR/# )r   argvNr   )rA   r   )r    s   "r!   r"   r"     s#     8 8tCy4 84 8r#   c                 
   \        4       pVP                  V R 7      pVP                  '       d3   \        P                  ! 4       P                  \        P                  4       VP                  '       d5   VP                  P                  R4       Uu. uF  p\        V4      NK  	  upM. pVP                  '       d#   VP                   Uu0 uF  q3^,
          kK  	  ppMWVP                  '       d<   VP                  P                  R4       Uu0 uF  p\        V4      ^,
          kK  	  ppM
\        4       pVP                  pVP                  '       d   RpM,VP                  '       d   RpMVP                   '       d   RpMRpVP"                  R8X  d   \$        P&                  M\)        VP"                  R4      ;_uu_ 4       pVP*                   F  p	VP,                  '       d    \/        VV	VVVVP0                  VRR7       K4  VP2                  '       d   \5        WVP2                  R	7       K_  \7        VV	VVVVP0                  VRVP8                  R
7	       K  	  RRR4       R# u upi u upi u upi   + '       g   i     R# ; i))args,r9   r:   r;   Nr   w)rm   rn   r4   ro   )rm   ro   )rm   rn   r4   ro   rL   )r   
parse_argsdebuglogging	getLoggersetLevelDEBUGobjectssplitrp   page_numbersrl   r`   rm   
raw_streambinary_streamtext_streamoutfilesysstdoutr}   r   extract_tocr   rW   extract_embeddedr   r   rL   )
r   r   r   xrk   rl   rm   r4   ri   rj   s
   &         r!   mainr     s   _F$'Dzzz$$W]]3:>,,,dll00565c!f56BF"&"3"34"3Qq55"34	'+||'9'9#'>?'>!3q6A::'>?%}}H!								 ||s*T\\30G	G	G5ZZE% HH#	 &&&9N9N % HH#'+'>'>
#   
H	G+ 7 5?  
H	G	Gs&   I"	I'I, AI1AI11J	__main__rP   )F)NF)r   FNN)r   FNNF)9r   r   os.pathr   rer   argparser   collections.abcr   r   typingr   r   r   r   pdfminer.pdfdocumentr	   r
   r   pdfminer.pdfexceptionsr   r   r   r   pdfminer.pdfpager   pdfminer.pdfparserr   pdfminer.pdftypesr   r   r   r   pdfminer.psparserr   r   r   pdfminer.utilsr   basicConfigr   __name__rX   compiler-   r0   r@   r\   rg   r   r   r   r   r   r   r    r#   r!   <module>r      s    )   	 
 # / $ $  L L  % ( J J 7 7 #    			8	$
**>
?>
>B(48v z? >* $)N Fxv8v zF r#   