
    TAi9                     r   S r SSKrSSKr SSKJr  SrSSKr	SSK
Jr  SSKJr  SSKJr  \R                  " S	5      r\R#                  \R$                  5        S
\\   4S jr\" 5       =(       d    Sr " S S5      r\R.                  " \5      r\R2                  " S	S9\R4                  " \S9\R6                  " SSSSSS9\R6                  " SSSSS9\R6                  " SSSSS9\R6                  " SSSS9\R6                  " S S!S"S9\R6                  " S#S$\R8                  " / S%Q5      S&S'9\R6                  " S(S)SS*S+9\R6                  " S,S-SS.S+9\R6                  " S/S0SS1S+9\R6                  " S2S3S4S9\R6                  " S5S6S7S8S9S:9\R:                  S; 5       5       5       5       5       5       5       5       5       5       5       5       5       5       r\R?                  S<5      \R6                  " S=S>/ SS?S@9\R6                  " SASB/ SSCS@9\R6                  " SDSESSFS+9\R6                  " SGSHSISJS9\R6                  " SKSL/ \R8                  " SMSN/5      SSOSP9\R6                  " SQSRSSST/\R8                  " / SUQ5      SSVSP9\R6                  " SWSXSYSZS9\R6                  " S[S\SYS]S9\R6                  " S^S_S`SaS9\R6                  " SbScSdSeS9\R6                  " SfSgSShS9\R6                  " SiSjSkSlS9\R6                  " SmSn\R8                  " / SoQ5      SpS'9\R@                  " Sq\RB                  " SSr9Ss9\St 5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       r"\R?                  Su5      \R6                  " S=S>/ SS?S@9\R6                  " SASB/ SSCS@9\R6                  " SvSw/ SSxS@9\R6                  " SySzS{S|S9\R6                  " S}S~SYSS9\R6                  " SSSSS9\R6                  " SmSn\R8                  " / SQ5      SpS'9\R@                  " Sq\RB                  " SSr9Ss9\S 5       5       5       5       5       5       5       5       5       5       r#\R?                  S5      \R6                  " S=S>/ SS?S@9\R6                  " SASB/ SSCS@9\R6                  " SvSw/ SSxS@9\R6                  " SySzS{S|S9\R6                  " S}S~SYSS9\R6                  " SSSSS9\R6                  " SmSn\R8                  " / SQ5      SpS'9\R@                  " Sq\RB                  " SSr9Ss9\S 5       5       5       5       5       5       5       5       5       5       r$\R?                  S5      \R6                  " S=S>/ SS?S@9\R6                  " SASB/ SSCS@9\R6                  " SvSw/ SSxS@9\R6                  " SySzS{S|S9\R6                  " S}S~SYSS9\R6                  " SSSSS9\R6                  " SmSn\R8                  " / SQ5      SpS'9\R@                  " Sq\RB                  " SSr9Ss9\S 5       5       5       5       5       5       5       5       5       5       r%g! \ a    Sr GN!f = f)z-Implementation of the command line interface.    NTF)Optional   )plot)read_pdfcamelotreturnc                       [         R                  R                  S5      $ ! [         R                  R                   a     gf = f)zGet the version information.z
camelot-pyN)	importlibmetadataversionPackageNotFoundError     G/var/www/html/land-ocr/venv/lib/python3.13/site-packages/camelot/cli.pyget_versionr      s<    !!)),7722 s   ! AAz0.0.0+unknownc                   $    \ rS rSrSrS rS rSrg)Config&   z&Class method for creating a new class.c                     0 U l         g)zInitialize the configuration.Nconfig)selfs    r   __init__Config.__init__)   s	    r   c                      X R                   U'   g)z*Set a configuration value for a given key.Nr   )r   keyvalues      r   
set_configConfig.set_config-   s     Cr   r   N)__name__
__module____qualname____firstlineno____doc__r   r   __static_attributes__r   r   r   r   r   &   s    0!r   r   )name)r   z-qz--quietzSuppress logs and warnings.)is_flagdefaulthelpz-pz--pages1z?Comma-separated page numbers. Example: 1,3,4 or 1,4-end or all.)r(   r)   z
--parallelz/Read pdf pages in parallel using all CPU cores.z-pwz
--passwordzPassword for decryption.)r)   z-oz--outputzOutput file path.z-fz--format)csvexcelhtmljsonmarkdownsqlitezOutput file format.)typer)   z-zz--zipzCreate ZIP archive.)r'   r)   z-splitz--split_textz,Split text that spans across multiple cells.z-flagz--flag_sizez@Flag text based on font size. Useful to detect super/subscripts.z-stripz--strip_textzOCharacters that should be stripped from a string before assigning it to a cell.z-Mz	--margins   )g      ?g      ?g?z2PDFMiner char_margin, line_margin and word_margin.)nargsr(   r)   c                     [        5       U l        UR                  5        H   u  p4U R                  R                  X45        M"     g)z)Camelot: PDF Table Extraction for Humans.N)r   objitemsr   )ctxargskwargsr   r   s        r   clir:   5   s2    l hCGlln
3& %r   latticez-Rz--table_regionszbPage regions to analyze. Example: x1,y1,x2,y2 where x1, y1 -> left-top and x2, y2 -> right-bottom.)r(   multipler)   z-Tz--table_areaszaTable areas to process. Example: x1,y1,x2,y2 where x1, y1 -> left-top and x2, y2 -> right-bottom.z-backz--process_backgroundzProcess background lines.z-scalez--line_scale(   zOLine size scaling factor. The larger the value, the smaller the detected lines.z-copyz--copy_texthvz?Direction in which text in a spanning cell will be copied over.)r(   r1   r<   r)   z-shiftz--shift_textlt) r@   rrA   bz5Direction in which text in a spanning cell will flow.z-lz
--line_tol   zFTolerance parameter used to merge close vertical and horizontal lines.z-jz--joint_tolzaTolerance parameter used to decide whether the detected lines and points lie close to each other.z-blockz--threshold_blocksize   zFor adaptive thresholding, size of a pixel neighborhood that is used to calculate a threshold value for the pixel. Example: 3, 5, 7, and so on.z-constz--threshold_constantzFor adaptive thresholding, constant subtracted from the mean or weighted mean. Normally, it is positive but may be zero or negative as well.z-Iz--iterationsz5Number of times for erosion/dilation will be applied.z-resz--resolutioni,  z*Resolution used for PDF to PNG conversion.z-plotz--plot_type)textgridcontourjointlinez5Plot elements found on PDF page for visual debugging.filepath)exists)r1   c                 l   U R                   nUR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      n	UR                  S5      n
UR                  U5        [        US   5      nU(       d  S	OUUS'   [        US
   5      nU(       d  S	OUUS
'   [        US   5      nU(       d  S	OUUS'   [        US   5      US'   U	b  [        (       d  [        S5      eO2Uc  [        R                  " S5      eUc  [        R                  " S5      e[        U
4USUS.UD6n[        R                  " SUR                   S35        U	b(  U H!  n[        XS9  [        R                  " 5         M#     g	UR                  XVUS9  g	)z*Use lines between text to parse the table.pagesoutputformatzipquiet	plot_typerM   table_regionsNtable_areas	copy_text
shift_text$matplotlib is required for plotting..Please specify output file path using --output0Please specify output file format using --formatr;   rP   flavorsuppress_stdoutFound  tableskindfcompressr   popupdatelist_HAS_MPLImportErrorclick
UsageErrorr   echonr   pltshowexport)cr8   r9   confrP   rQ   re   rf   rT   rU   rM   rV   rW   rX   tablestables                   r   r;   r;   p   s   | 88DHHWEXXhFAxxHHHWE

;'Izz*%H
MM$01M*7d]F?vm,-K(3DF=VK()I&/$YF;| 45F<xDEE  >""#STT9""#UVViJPF 
JJz)*E'HHJ  	fH5r   streamz-Cz	--columnsz#X coordinates of column separators.z-ez
--edge_tol2   z7Tolerance parameter for extending textedges vertically.z-rz	--row_tolzFTolerance parameter used to combine text vertically, to generate rows.z-cz--column_tolzKTolerance parameter used to combine text horizontally, to generate columns.)rH   rI   rJ   textedgec                    U R                   nUR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      n	UR                  S5      n
UR                  U5        [        US   5      nU(       d  S	OUUS'   [        US
   5      nU(       d  S	OUUS
'   [        US   5      nU(       d  S	OUUS'   UR                  S5      nUc  0 nOUS   US   US   S.nU	b  [        (       d  [        S5      eO2Uc  [        R                  " S5      eUc  [        R                  " S5      e[        U
4USUUS.UD6n[        R                  " SUR                   S35        U	b)  U H"  n[        UU	S9  [        R                  " 5         M$     g	UR                  XVUS9  g	)z+Use spaces between text to parse the table.rP   rQ   rR   rS   rT   rU   rM   rV   NrW   columnsmarginsr   r   rE   )char_marginline_marginword_marginrZ   r[   r\   rx   )rP   r^   r_   layout_kwargsr`   ra   rb   rd   rg   )rt   r8   r9   ru   rP   rQ   re   rf   rT   rU   rM   rV   rW   r|   r}   r   rv   rw   s                     r   rx   rx      s   j 88DHHWEXXhFAxxHHHWE

;'Izz*%H
MM$01M*7d]F?vm,-K(3DF=6)$%G$+F9hhy!G #1:"1:"1:
 xDEE  >""#STT9""#UVV# F 
JJz)*EY'HHJ  	fH5r   hybridc                 J   U R                   nUR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      n	UR                  S5      n
UR                  U5        [        US   5      nU(       d  S	OUUS'   [        US
   5      nU(       d  S	OUUS
'   [        US   5      nU(       d  S	OUUS'   U	b  [        (       d  [        S5      eO2Uc  [        R                  " S5      eUc  [        R                  " S5      e[        U
4USUS.UD6n[        R                  " SUR                   S35        U	b(  U H!  n[        XS9  [        R                  " 5         M#     g	UR                  XVUS9  g	)zBCombines the strengths of both the Network and the Lattice parser.rP   rQ   rR   rS   rT   rU   rM   rV   NrW   r|   rZ   r[   r\   r   r]   r`   ra   rb   rd   rg   rt   r8   r9   ru   rP   rQ   re   rf   rT   rU   rM   rV   rW   r|   rv   rw   s                   r   r   r   `  s   j 88DHHWEXXhFAxxHHHWE

;'Izz*%H
MM$01M*7d]F?vm,-K(3DF=6)$%G$+F9xDEE  >""#STT9""#UVVhIOF 
JJz)*E'HHJ  	fH5r   networkc                 J   U R                   nUR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      n	UR                  S5      n
UR                  U5        [        US   5      nU(       d  S	OUUS'   [        US
   5      nU(       d  S	OUUS
'   [        US   5      nU(       d  S	OUUS'   U	b  [        (       d  [        S5      eO2Uc  [        R                  " S5      eUc  [        R                  " S5      e[        U
4USUS.UD6n[        R                  " SUR                   S35        U	b(  U H!  n[        XS9  [        R                  " 5         M#     g	UR                  XVUS9  g	)z'Use text alignments to parse the table.rP   rQ   rR   rS   rT   rU   rM   rV   NrW   r|   rZ   r[   r\   r   r]   r`   ra   rb   rd   rg   r   s                   r   r   r     s   j 88DHHWEXXhFAxxHHHWE

;'Izz*%H
MM$01M*7d]F?vm,-K(3DF=6)$%G$+F9xDEE  >""#STT9""#UVViJPF 
JJz)*E'HHJ  	fH5r   )&r$   loggingrm   matplotlib.pyplotpyplotrq   rk   rl   importlib.metadatar
   typingr   rB   r   r   	getLoggerloggersetLevelINFOstrr   __version__r   make_pass_decoratorpass_configgroupversion_optionoptionChoicepass_contextr:   commandargumentPathr;   rx   r   r   r   r   r   <module>r      s   3  # H     
		9	%  Xc]  m.	! 	! ''/ )k*)UE8U 	M	 	:	 e\(BCdJ%89	L	M		 dGT0EF	7	 	N	 
 
	= '  G : D + h' Y
< 
< #T8S 
'	 	sCj	!	M #J	.	/	@ 	T	 
>	 
/	 
(	 	@	 
	5	 	B	C	@	 
4!89&6  : x&6R X
< 
< 	. 	E	 	T	 
?	 	=	>	@	 
4!8956  : f56p X
< 
< 	. 	E	 	T	 
?	 	=	>	@	 
4!89%6  : f%6P Y
< 
< 	. 	E	 	T	 
?	 	=	>	@	 
4!89%6  : f%6I  Hs   X* *X65X6