%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/reportlab/pdfbase/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/reportlab/pdfbase/__pycache__/pdfutils.cpython-312.pyc

�

��d�'����dZdZddlZddlZddlmZddlmZddlm	Z	m
Z
ddlmZm
Z
gdfd	�Zd
ddd
�Zdddd
�Zdd�Zdd�Zdd�Zd�Zd�Zdd�Zd�Zd�Zd d�Zd�ZGd�d�Zy)!z3.3.0��N)�BytesIO)�	rl_config)�ImageReader�	isUnicode)�asciiBase85Encode�asciiBase85Decode�<c�j�tdt|�|�D]}|j||||z��|S�Nr)�range�len�append)�src�dst�	chunkSize�is    �</usr/lib/python3/dist-packages/reportlab/pdfbase/pdfutils.py�_chunkerrs:��
�1�S��X�i�
(�'���
�
�3�q��9��%�&�'��J��RGB�CMYK�G)rr�L���c	���ddl}t|�}|�$|j|�|r|j�ry|j	�\}}|j�}g}|j}	|	d�|	d|�d|�dt|j�d��|	d�t|�||zt|jzk(sJd��|j|�}
t|
�}t||�|	d	�|S)
Nr�BI�/W � /H �
 /BPC 8 /CS /z /F [/A85 /Fl]�ID�Wrong amount of data for image�EI)
�zlibrr�jpeg_fh�getSize�
getRGBData�_mode2cs�moder�	_mode2bpp�compressrr)�filename�IMG�
detectJpegr&�img�imgwidth�	imgheight�raw�coder�
compressed�encodeds            r�makeA85Imager8s����
�h�
�C�
���
�
�3���#�+�+�-���+�+�-��H�i�

�.�.�
�C�
�D�
�[�[�F�
�4�L�
��9�X�VY�V^�V^�M_�`�a�
�4�L��s�8�x�)�+�I�c�h�h�,?�?�?�a�Aa�a�?����s�#�J��
�+�G�
�W�T��
�4�L��Krc	���ddl}t|�}|�$|j|�|r|j�ry|j	�\}}|j�}g}|j}	|	d�|	d|�d|�dt|j�d��|	d�t|�||zt|jzk(sJd��|j|�}
t|
|�|	d	�|S)
Nrrr r!r"z	 /F [/Fl]r#r$r%)r&rrr'r(r)r*r+rr,r-r)r.r/r0r&r1r2r3r4r5rr6s           r�makeRawImager:9s����
�h�
�C�
���
�
�3���#�+�+�-���+�+�-��H�i�

�.�.�
�C�
�D�
�[�[�F�
�4�L�
�H�i��QT�QY�QY�HZ�[�\�
�4�L��s�8�x�)�+�I�c�h�h�,?�?�?�a�Aa�a�?����s�#�J�
�Z���
�4�L��Krc�<�tjj|�dtjxrdxsdz}||k(rQt|�r7ddlm}|r=td||�j�jd��Std|z��ytjr
t||�}nt||�}|r|St|d�}|jdj!|�dz�|j#�tj$rt'd	|z�yy)
zHProcesses image as if for encoding, saves to a file with .a85 extension.r�.a85z.bin)�
open_for_readN�
zNo such cached image %s�wbzcached image as %s)�os�path�splitextr�useA85�cachedImageExists�reportlab.lib.utilsr=�filter�read�split�IOErrorr8r:�open�write�join�close�verbose�print)r.�returnInMemoryr/�
cachednamer=r5�fs       r�cacheImageFilerSTs������!�!�(�+�A�.�)�2B�2B�2M�v�2W�QW�X�J�����X�&�9��f�T�-�
�2K�2P�2P�2R�2X�2X�Y_�2`�&a�a��3�h�>�?�?��������-�D����-�D��$�;�
��D�!��	������D�!�&�(�)�	���	�����&��3�4�rc���ddl}t|t�r|j|�}n|}|D]8}t|�r tj
s�t
d|z��.t|��:y)z�Preprocesses one or more image files.

    Accepts either a filespec ('C:\mydir\*.jpg') or a list
    of image filenames, crunches them all to save time.  Run this
    to save huge amounts of time when repeatedly building image
    documents.rNz#cached version of %s already exists)�glob�
isinstance�strrDrrNrOrS)�specrU�filelistr.s    r�preProcessImagesrZmsY����$�s���9�9�T�?�����%���X�&�� � ��;�h�F�G��8�$�%rc�&�tjj|�dtjxrdxsdz}tjj|�r7tj|�d}tj|�d}||kDryyy)z�Determines if a cached image already exists for a given file.

    Determines if a cached image exists which has the same name
    and equal or newer date to the given file.rr<�bin�r)r@rArBrrC�isfile�stat)r.rQ�
original_date�cached_dates    rrDrD�sz��
���!�!�(�+�A�.�)�2B�2B�2M�v�2V�QV�W�J�	�w�w�~�~�j�!�����)�!�,�
��g�g�j�)�!�,���;�&���rc��|jd|�jd|�jd|�j||�S)zzNormalizes different line end character(s).

    Ensures all instances of CR, LF and CRLF end up as
    the specified one.r>�
�
)�replace)�text�desired�unlikelys   r�_normalizeLineEndsri�s<��
�
�W�V�X�
&�
�W�T�8�
$�
�W�T�8�
$�
�W�X�w�
'�	)rc���t|�r|jd�}t�}|jt	j
|��|jd�|j
�S)z�Encodes input using ASCII-Hex coding.

    This is a verbose encoding used for binary data within
    a PDF file.  One byte binary becomes two bytes of ASCII.
    Helper function used by images.�utf-8�>)r�encoderrK�binascii�b2a_hex�getvalue)�input�outputs  r�_AsciiHexEncoders�sQ��������W�%��
�Y�F�
�L�L��!�!�%�(�)�
�L�L����?�?��rc
�r�t|�s|jd�}dj|j��}|ddk(sJd��|dd}t	|�dzdk(sJd	��djtdt	|�d�D�cgc]}t
t|||dzd
����c}�Scc}w)zeDecodes input using ASCII-Hex coding.

    Not used except to provide a test of the inverse function.rkr����>z'Invalid terminator for Ascii Hex StreamN�rz(Ascii Hex stream has odd number of bytes�)r�decoderLrHrr
�chr�int)rq�strippedrs   r�_AsciiHexDecoder}�s����U�����W�%���w�w�u�{�{�}�%�H��B�<�3��I� I�I�����}�H��x�=�1���!�M�#M�M�!�
�7�7�%��#�h�-�PQ�:R�S�Q�C��H�Q�q��s�O�B�/�0�S�T�T��Ss�"B4c��g}t|�}d}||z}||kr'|j||||z�|dz}||z}||kr�'t|d�dk(r|ddd|dd|dzg|dddj|�S)z>Wraps input at a given column size by inserting 
 characters.rrru���Nr>)rrrL)rq�columnsrr�lengthr�poss      r�_wrapr��s���
�F�
��Z�F�	�A�
�A�+�C�

��,��
�
�e�C��G��,�-�
��E����k����,�
�6�"�:�����b�z�#�2��v�b�z�"�~�f�R�j�'@�A��r�s���;�;�v��rc�f�ddl}ddlm}gd�}gd�}gd�}d}d}|�s|jd|j	d	��}|dd
k(�r�|jd|j	d	��}|d|vr�|jdd	�|jd|j	d	��}|ddk7r|d
��|jd|j	d��}	|	ddz|	d	z}
|jd|j	d��}	|	ddz|	d	z}|jd|j	d	��}	|	d}||
||fS|ddk(r�|jd|j	d��}|ddz|d	zdz
}
|j	|
�}|jd|dd�}	|jd|dd�}|ddz|d	z|	ddz|	d	zf}n^|d|vr|d|dz��|d|vrB|jd|j	d��}|j|ddz|d	zdz
d	�|s��yy)z@Read width, height and number of components from open JPEG file.rN)�PDFError)����)
������������������r)����������������������)�Hr��Br�rwr]z#JPEG must have 8 bits per component�BB���
�z#JPEG Unsupported JPEG marker: %0.2x)�struct�reportlab.pdfbase.pdfdocr��unpackrG�seek)�imager�r��validMarkers�noParamMarkers�unsupportedMarkers�dpi�done�x�y�height�width�color�ns              r�readJPEGInfor��sY���1�&�L�	G��
	M���C��D���M�M�#�u�z�z�!�}�-���Q�4�4�<��
�
�c�5�:�:�a�=�1�A���t�|�#��
�
�1�a� ��M�M�#�u�z�z�!�}�5���Q�4�1�9�"�#H�I�I��M�M�$��
�
�1�
�6���A�$�!�)�q��t�+���M�M�$��
�
�1�
�6���A�$�!�)�q��t�+���M�M�#�u�z�z�!�}�5���1����f�e�S�0�0��1��t���M�M�$��
�
�1�
�6���q�T�Q�Y�!�A�$�&��*���J�J�q�M���M�M�$��"�R��1���M�M�$��!�B��0���!��a��1�Q�4�'��1��q��!�A�$��7���1��+�+��D�q��t�K�L�L��1��^�+��M�M�$��
�
�1�
�6���
�
�Q�q�T�Q�Y�!�A�$�.��2�A�6�=rc�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�_fuscc�l�|sJd��||_t|�|_t|�xsd|_y)Nz'Argument k should be a non empty string�)�_kr�_klenr{�_n)�self�kr�s   r�__init__z_fusc.__init__s1���;�;�;�q������V��
��a�&�+�A��rc���|jtdjtt|jt
tt|������|j�S�Nr)	�
_fusc__rotaterrL�maprz�_fusc__fusc�list�ordr��r��ss  r�encryptz
_fusc.encryptsH���}�}�.�r�w�w�s�3�t�{�{�4�PS�TW�XY�PZ�K[�?\�7]�/^�_�`d�`g�`g�h�hrc���djtt|jt	tt
t
|j||j�������Sr�)	rLr�rzr�r�r�r	r�r�r�s  r�decryptz
_fusc.decryptsI���w�w�s�3�t�{�{�4��C�8I�$�-�-�XY�[_�[b�[b�Zb�Jc�8d�0e�+f�g�h�i�irc�\�t|�}|dkr||z}||z}|s|S||d|d||z
zSr)r)r�r�r��ls    r�__rotatez_fusc.__rotate!sF����F���Q�3�A�a�C��	�Q�����(��!���v�a���1��g�~�rc���t|�}ttd�|tttt	||j
z�dz|jzd|����S)Nc��||zS)N�)r�r�s  r�<lambda>z_fusc.__fusc.<locals>.<lambda>*s
��A��E�rr)rr�r�r�r{r�r�)r�r��slens   r�__fuscz_fusc.__fusc(sT���1�v���C�)�!�D��S�3�t�D�J�J��;O�PQ�;Q�SW�SZ�SZ�:Z�\a�]a�9b�1c�,d�e�f�frN)�__name__�
__module__�__qualname__r�r�r�r�r�r�rrr�r�s���i�j��grr�)NF)rN)r>z)r
)�__version__�__doc__r@rn�ior�	reportlabrrErr�reportlab.lib.rl_accelrr	rr*r,r8r:rSrZrDrirsr}r�r�r�r�rr�<module>r�s���
��
��
����6�G��"����c�2���a�Q�'�	��6�65�2%�.�0
)��
U�
�437�jg�gr

Zerion Mini Shell 1.0