a
    �˜ëjý  ã                   @   sº   d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlm	Z	m
Z
mZ e
eƒZG dd„ dƒZeƒ Zdd	d
ddddddddddœZdd„ Ze jdd… fdd„Zdd„ Zedkr¶eƒ  dS )é    N)Úbasename)Úimport_module)Úsetup_logging)Úcached_propertyÚkeydefaultdictÚArgparseCompatParserc                   @   s   e Zd Zedd„ ƒZdS )Ú_LocalLazyClassc                 C   s8   ddl m}m} ddlm} d|› d|› d|d j› �S )Nr   )ÚPYPDFIUM_INFOÚPDFIUM_INFO)Ú_libsz
pypdfium2 z
pdfium z at Zpdfium)Zpypdfium2.versionr	   r
   Zpypdfium2_raw.bindingsr   Ú_name)Úselfr	   r
   r   © r   úU/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/pypdfium2_cli/__main__.pyÚversion_str   s    z_LocalLazyClass.version_strN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r      s   r   zRearrange/merge documentsz List/extract/edit embedded fileszExtract imageszExtract textzConvert images to PDFzPrint info on pageobjectsz Print info on document and pageszList a document's fontszDump info about default fontszRasterize pageszTile pages (N-up)zPrint table of contents)ZarrangeÚattachmentszextract-imageszextract-textZimgtopdfZpageobjectsZpdfinfoZfontszdefault-fontsÚrenderZtileZtocc           
      C   sî   t dtjdtttjƒd� d�}|jdddtj	d� |j
d	d
�}d }| rP| d pRd }t ¡ }|tv rÆ||= td| dd¡› � }t| }t|dd ƒ}|r¤|d | n|}|j|||tjd�}| |¡ | ¡ D ]\}	}|j|	|d� qÎ||fS )NZ	pypdfium2aT  pypdfium2 is a Python binding to PDFium, a PDF processing library.
This is the command-line interface. Invoke as `pypdfium2` or `%(py_exe)s -m pypdfium2_cli`.

pypdfium2's CLI mainly serves testing purposes, similar to pdfium_test upstream.
It is not meant as a feature-complete PDF toolkit for end users.
There are no API stability promises; backward incompatible changes may be made.

Environment variables:
- PYPDFIUM_LOGLEVEL {debug,info,warning,error,critical} = debug
  Controls the logging level.
- DEBUG_AUTOCLOSE {-1,0,1} = 0
  Whether to print info about (auto-)closing of PDFium objects.
  Defaults to 0, which means warnings only. 1 enables debugging. -1 silences even warnings.
- DEBUG_UNSUPPORTED {0,1} = 1
  Whether to enable or disable the unsupported feature handler.
- DEBUG_SYSFONTS {0,1} = 0
  Whether to install a sysfont listener.)Zpy_exe)ÚprogÚformatter_classÚdescriptionz-vz	--versionÚversion)Úactionr   Ú
subcommand)Údestr   zpypdfium2_cli.ú-Ú_ZPARSER_DESCz

)Úhelpr   r   )r   )r   ÚargparseÚRawTextHelpFormatterÚdictr   ÚsysÚ
executableÚadd_argumentÚ	LocalLazyr   Úadd_subparsersÚSubCommandsÚcopyÚModuleLoaderÚreplaceÚgetattrÚ
add_parserÚattachÚitems)
ÚargvÚmain_parserZ
subparsersÚmodZsc_nameZ	other_scsr   ÚdescZ	subparserÚnamer   r   r   Ú
get_parser-   s<    îýýþ
r5   é   c                 C   s6   t | ƒ\}}| | ¡}|js(| ¡  d S | |¡ d S ©N)r5   Ú
parse_argsr   Ú
print_helpÚmain)r0   Úparserr2   Úargsr   r   r   Úapi_mainc   s    
r=   c                   C   s   t ƒ  tƒ  d S r7   )r   r=   r   r   r   r   Úcli_maino   s    r>   Ú__main__)r#   r    Úos.pathr   Ú	importlibr   Zpypdfium2_cli._setupr   Zpypdfium2_cfg.stlr   r   r   r*   r   r&   r(   r5   r0   r=   r>   r   r   r   r   r   Ú<module>   s4   ô6