a
    ¥Q•h«Z  ã                   @   sÄ   d Z ddlZddlZddlZddlmZ ddlmZ ddlm	Z	m
Z
 ddlmZ d ZZdd	„ ZG d
d„ dƒZG dd„ deeƒZG dd„ deƒZG dd„ deƒZG dd„ deeƒZG dd„ dƒZdS )z
A low-level PDF generator.

é    N)ÚBOM_UTF16_BE)Úmd5)ÚceilÚlog)Úwarnz0.11.0c                 C   sf   t | tƒr| S t | tƒrH|  ¡ r2tt| ƒƒ d¡S | d› d¡ d¡S nt | tƒrX| j	S t| ƒ d¡S )zConvert item to bytes.ÚasciiÚfÚ0)
Ú
isinstanceÚbytesÚfloatÚ
is_integerÚstrÚintÚencodeÚrstripÚObjectÚdata)Úitem© r   úG/var/www/sistema_ama/venv/lib/python3.9/site-packages/pydyf/__init__.pyÚ	_to_bytes   s    


r   c                   @   sH   e Zd ZdZdd„ Zedd„ ƒZedd„ ƒZedd	„ ƒZed
d„ ƒZ	dS )r   zBase class for PDF objects.c                 C   s   d | _ d| _d| _d| _d S )Nr   Ún)ÚnumberÚoffsetÚ
generationÚfree©Úselfr   r   r   Ú__init__!   s    zObject.__init__c                 C   s&   | j › d| j› d� ¡ }|| j d S )z%Indirect representation of an object.ú z obj
s   
endobj)r   r   r   r   )r   Úheaderr   r   r   Úindirect,   s    zObject.indirectc                 C   s   | j › d| j› d� ¡ S )zObject identifier.r    z R)r   r   r   r   r   r   r   Ú	reference2   s    zObject.referencec                 C   s
   t ƒ ‚dS )z@Data contained in the object. Shall be defined in each subclass.N)ÚNotImplementedErrorr   r   r   r   r   7   s    zObject.datac                 C   s   | j  ot| tƒ S )z7Whether the object can be included in an object stream.)r   r
   ÚStreamr   r   r   r   Úcompressible<   s    zObject.compressibleN)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úpropertyr"   r#   r   r&   r   r   r   r   r      s   


r   c                   @   s&   e Zd ZdZddd„Zedd„ ƒZdS )Ú
DictionaryzPDF Dictionary object.Nc                 C   s   t  | ¡ t | |pi ¡ d S ©N)r   r   Údict)r   Úvaluesr   r   r   r   D   s    
zDictionary.__init__c                 C   s$   dd„ |   ¡ D ƒ}dd |¡ d S )Nc                 S   s(   g | ] \}}d t |ƒ d t |ƒ ‘qS )ó   /ó    ©r   )Ú.0ÚkeyÚvaluer   r   r   Ú
<listcomp>J   s   ÿz#Dictionary.data.<locals>.<listcomp>ó   <<ó    ó   >>)ÚitemsÚjoin)r   Úresultr   r   r   r   H   s    þzDictionary.data)N©r'   r(   r)   r*   r   r+   r   r   r   r   r   r,   B   s   
r,   c                       s   e Zd ZdZd`‡ fdd„	Zdadd„Zdd	„ Zdbd
d„Zdd„ Zdcdd„Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdddd„Zded d!„Zdfd"d#„Zd$d%„ Zd&d'„ Zd(d)„ Zd*d+„ Zd,d-„ Zd.d/„ Zd0d1„ Zd2d3„ Zd4d5„ Zdgd6d7„Zdhd8d9„Zdid:d;„Zd<d=„ Z d>d?„ Z!d@dA„ Z"dBdC„ Z#dDdE„ Z$dFdG„ Z%dHdI„ Z&dJdK„ Z'dLdM„ Z(dNdO„ Z)dPdQ„ Z*dRdS„ Z+dTdU„ Z,dVdW„ Z-dXdY„ Z.dZd[„ Z/d\d]„ Z0e1d^d_„ ƒZ2‡  Z3S )jr%   zPDF Stream object.NFc                    s(   t ƒ  ¡  |pg | _|pi | _|| _d S r-   )Úsuperr   ÚstreamÚextraÚcompress)r   r?   r@   rA   ©Ú	__class__r   r   r   R   s    


zStream.__init__c                 C   sD   | j  d|› �¡ |du r(| j  d¡ n| j  |¡ | j  d¡ dS )zBegin marked-content sequence.ú/Ns   BMCs   BDC©r?   Úappend)r   ÚtagZproperty_listr   r   r   Úbegin_marked_content[   s
    zStream.begin_marked_contentc                 C   s   | j  d¡ dS )zBegin a text object.s   BTNrE   r   r   r   r   Ú
begin_textd   s    zStream.begin_textc                 C   s   | j  |rdnd¡ dS )a  Modify current clipping path by intersecting it with current path.

        Use the nonzero winding number rule to determine which regions lie
        inside the clipping path by default.

        Use the even-odd rule if ``even_odd`` set to ``True``.

        s   W*ó   WNrE   ©r   Zeven_oddr   r   r   Úcliph   s    	zStream.clipc                 C   s   | j  d¡ dS )z�Close current subpath.

        Append a straight line segment from the current point to the starting
        point of the subpath.

        ó   hNrE   r   r   r   r   Úcloses   s    zStream.closec                 C   s   t tjjtƒ |  ||¡ dS )z7color_space is deprecated, use set_color_space instead.N)r   r%   Úcolor_spacer*   ÚDeprecationWarningÚset_color_space©r   ÚspaceÚstroker   r   r   rO   |   s    zStream.color_spacec                 C   s<   | j  d t|ƒt|ƒt|ƒt|ƒt|ƒt|ƒdf¡¡ dS )u¯   Add cubic BÃ©zier curve to current path.

        The curve shall extend from ``(x3, y3)`` using ``(x1, y1)`` and ``(x2,
        y2)`` as the BÃ©zier control points.

        r1   ó   cN©r?   rF   r;   r   )r   Úx1Úy1Úx2Úy2Úx3Úy3r   r   r   Úcurve_to�   s
    
ýzStream.curve_toc              	   C   s0   | j  d t|ƒt|ƒt|ƒt|ƒdf¡¡ dS )u±   Add cubic BÃ©zier curve to current path

        The curve shall extend to ``(x3, y3)`` using the current point and
        ``(x2, y2)`` as the BÃ©zier control points.

        r1   ó   vNrV   )r   rY   rZ   r[   r\   r   r   r   Úcurve_start_to�   s    
þzStream.curve_start_toc              	   C   s0   | j  d t|ƒt|ƒt|ƒt|ƒdf¡¡ dS )u«   Add cubic BÃ©zier curve to current path

        The curve shall extend to ``(x3, y3)`` using `(x1, y1)`` and ``(x3,
        y3)`` as the BÃ©zier control points.

        r1   ó   yNrV   )r   rW   rX   r[   r\   r   r   r   Úcurve_end_to˜   s    
þzStream.curve_end_toc                 C   s   | j  dt|ƒ d ¡ dS )zDraw object given by reference.r0   s    DoN©r?   rF   r   )r   r#   r   r   r   Údraw_x_object£   s    zStream.draw_x_objectc                 C   s   | j  d¡ dS )z%End path without filling or stroking.ó   nNrE   r   r   r   r   Úend§   s    z
Stream.endc                 C   s   | j  d¡ dS )zEnd marked-content sequence.s   EMCNrE   r   r   r   r   Úend_marked_content«   s    zStream.end_marked_contentc                 C   s   | j  d¡ dS )zEnd text object.s   ETNrE   r   r   r   r   Úend_text¯   s    zStream.end_textc                 C   s   | j  |rdnd¡ dS )znFill path using nonzero winding rule.

        Use even-odd rule if ``even_odd`` is set to ``True``.

        s   f*ó   fNrE   rK   r   r   r   Úfill³   s    zStream.fillc                 C   s   | j  |rdnd¡ dS )zyFill and stroke path usign nonzero winding rule.

        Use even-odd rule if ``even_odd`` is set to ``True``.

        s   B*ó   BNrE   rK   r   r   r   Úfill_and_stroke»   s    zStream.fill_and_strokec                 C   s   | j  |rdnd¡ dS )z€Fill, stroke and close path using nonzero winding rule.

        Use even-odd rule if ``even_odd`` is set to ``True``.

        s   b*ó   bNrE   rK   r   r   r   Úfill_stroke_and_closeÃ   s    zStream.fill_stroke_and_closec                 C   s~   | j rt  |¡n|}t |¡d }| j d ddt|ƒdt|ƒdt|ƒddt|ƒ d	| j r^d
nddtt|ƒƒd|df¡¡ dS )a¾  Add an inline image.

        :param width: The width of the image.
        :type width: :obj:`int`
        :param height: The height of the image.
        :type height: :obj:`int`
        :param colorspace: The color space of the image, f.e. RGB, Gray.
        :type colorspace: :obj:`str`
        :param bpc: The bits per component. 1 for BW, 8 for grayscale.
        :type bpc: :obj:`int`
        :param raw_data: The raw pixel data.

        s   ~>r1   s   BIs   /Ws   /Hs   /BPCs   /CSs   /Devices   /Fs
   [/A85 /Fl]s   /A85s   /Ls   IDs   EIN)	rA   ÚzlibÚbase64Ú	a85encoder?   rF   r;   r   Úlen)r   ÚwidthÚheightrO   ZbpcÚraw_datar   Za85_datar   r   r   Úinline_imageË   s     

ôzStream.inline_imagec                 C   s$   | j  d t|ƒt|ƒdf¡¡ dS )z0Add line from current point to point ``(x, y)``.r1   ó   lNrV   ©r   ÚxÚyr   r   r   Úline_toê   s    zStream.line_toc                 C   s$   | j  d t|ƒt|ƒdf¡¡ dS )z8Begin new subpath by moving current point to ``(x, y)``.r1   ó   mNrV   rw   r   r   r   Úmove_toî   s    zStream.move_toc                 C   s$   | j  d t|ƒt|ƒdf¡¡ dS )zAMove text to next line at ``(x, y)`` distance from previous line.r1   s   TdNrV   rw   r   r   r   Úmove_text_toò   s    zStream.move_text_toc                 C   s   t tjjtƒ |  |¡ dS )z1shading is deprecated, use paint_shading instead.N)r   r%   Úshadingr*   rP   Úpaint_shading©r   Únamer   r   r   r~   ö   s    zStream.shadingc                 C   s   | j  dt|ƒ d ¡ dS )z@Paint shape and color shading using shading dictionary ``name``.r0   s    shNrb   r€   r   r   r   r   û   s    zStream.paint_shadingc                 C   s   | j  d¡ dS )zRestore graphic state.ó   QNrE   r   r   r   r   Ú	pop_stateÿ   s    zStream.pop_statec                 C   s   | j  d¡ dS )zSave graphic state.ó   qNrE   r   r   r   r   Ú
push_state  s    zStream.push_statec              	   C   s0   | j  d t|ƒt|ƒt|ƒt|ƒdf¡¡ dS )z–Add rectangle to current path as complete subpath.

        ``(x, y)`` is the lower-left corner and width and height the
        dimensions.

        r1   s   reNrV   )r   rx   ry   rr   rs   r   r   r   Ú	rectangle  s    
þzStream.rectanglec                 C   s2   | j  d t|ƒt|ƒt|ƒ|r$dndf¡¡ dS )z”Set RGB color for nonstroking operations.

        Set RGB color for stroking operations instead if ``stroke`` is set to
        ``True``.

        r1   s   RGs   rgNrV   )r   ÚrÚgÚbrT   r   r   r   Úset_color_rgb  s    

þzStream.set_color_rgbc                 C   s(   | j  dt|ƒ d |rdnd ¡ dS )zwSet the nonstroking color space.

        If stroke is set to ``True``, set the stroking color space instead.

        r0   r1   s   CSs   csNrb   rR   r   r   r   rQ     s    ÿzStream.set_color_spacec                 G   sJ   |rg |¢dt |ƒ ‘R }| j d dd„ |D ƒ¡d |r>dnd ¡ dS )z‹Set special color for nonstroking operations.

        Set special color for stroking operation if ``stroke`` is set to ``True``.

        r0   r1   c                 s   s   | ]}t |ƒV  qd S r-   r2   )r3   Úoperandr   r   r   Ú	<genexpr>/  r8   z+Stream.set_color_special.<locals>.<genexpr>s   SCNs   scnN)r   r?   rF   r;   )r   r�   rT   Úoperandsr   r   r   Úset_color_special&  s    
ÿÿzStream.set_color_specialc                 C   s&   | j  d t|ƒjt|ƒdf¡¡ dS )zÊSet dash line pattern.

        :param dash_array: Dash pattern.
        :type dash_array: :term:`iterable`
        :param dash_phase: Start of dash phase.
        :type dash_phase: :obj:`int`

        r1   ó   dN)r?   rF   r;   ÚArrayr   r   )r   Z
dash_arrayZ
dash_phaser   r   r   Úset_dash2  s    	
ÿzStream.set_dashc                 C   s(   | j  dt|ƒ d t|ƒ d ¡ dS )zSet font name and size.r0   r1   s    TfNrb   )r   ÚfontÚsizer   r   r   Úset_font_size>  s    ÿzStream.set_font_sizec                 C   s   | j  t|ƒd ¡ dS )zSet text rendering mode.s    TrNrb   )r   Úmoder   r   r   Úset_text_renderingC  s    zStream.set_text_renderingc                 C   s   | j  t|ƒd ¡ dS )zSet text rise.s    TsNrb   )r   rs   r   r   r   Úset_text_riseG  s    zStream.set_text_risec                 C   s   | j  t|ƒd ¡ dS )zSet line cap style.s    JNrb   )r   Zline_capr   r   r   Úset_line_capK  s    zStream.set_line_capc                 C   s   | j  t|ƒd ¡ dS )zSet line join style.s    jNrb   )r   Z	line_joinr   r   r   Úset_line_joinO  s    zStream.set_line_joinc                 C   s   | j  t|ƒd ¡ dS )zSet line width.s    wNrb   )r   rr   r   r   r   Úset_line_widthS  s    zStream.set_line_widthc                 C   s<   | j  d t|ƒt|ƒt|ƒt|ƒt|ƒt|ƒdf¡¡ dS )am  Set current transformation matrix.

        :param a: Top left number in the matrix.
        :type a: :obj:`int` or :obj:`float`
        :param b: Top middle number in the matrix.
        :type b: :obj:`int` or :obj:`float`
        :param c: Middle left number in the matrix.
        :type c: :obj:`int` or :obj:`float`
        :param d: Middle middle number in the matrix.
        :type d: :obj:`int` or :obj:`float`
        :param e: Bottom left number in the matrix.
        :type e: :obj:`int` or :obj:`float`
        :param f: Bottom middle number in the matrix.
        :type f: :obj:`int` or :obj:`float`

        r1   s   cmNrV   ©r   Úar‰   ÚcÚdÚer   r   r   r   Ú
set_matrixW  s    
þzStream.set_matrixc                 C   s   | j  t|ƒd ¡ dS )zSet miter limit.s    MNrb   )r   Zmiter_limitr   r   r   Úset_miter_limitl  s    zStream.set_miter_limitc                 C   s   | j  dt|ƒ d ¡ dS )zkSet specified parameters in graphic state.

        :param state_name: Name of the graphic state.

        r0   s    gsNrb   )r   Z
state_namer   r   r   Ú	set_statep  s    zStream.set_statec                 C   s<   | j  d t|ƒt|ƒt|ƒt|ƒt|ƒt|ƒdf¡¡ dS )a€  Set current text and text line transformation matrix.

        :param a: Top left number in the matrix.
        :type a: :obj:`int` or :obj:`float`
        :param b: Top middle number in the matrix.
        :type b: :obj:`int` or :obj:`float`
        :param c: Middle left number in the matrix.
        :type c: :obj:`int` or :obj:`float`
        :param d: Middle middle number in the matrix.
        :type d: :obj:`int` or :obj:`float`
        :param e: Bottom left number in the matrix.
        :type e: :obj:`int` or :obj:`float`
        :param f: Bottom middle number in the matrix.
        :type f: :obj:`int` or :obj:`float`

        r1   s   TmNrV   r›   r   r   r   Úset_text_matrixx  s    
þzStream.set_text_matrixc                 C   s&   t tjjtƒ |  ||||||¡ dS )z7text_matrix is deprecated, use set_text_matrix instead.N)r   r%   Útext_matrixr*   rP   r£   r›   r   r   r   r¤   �  s    zStream.text_matrixc                 C   s&   t tjjtƒ |  ||||||¡ dS )z0transform is deprecated, use set_matrix instead.N)r   r%   Ú	transformr*   rP   r    r›   r   r   r   r¥   ’  s    zStream.transformc                 C   s   | j  dt|ƒ d ¡ dS )z4Show text strings with individual glyph positioning.ó   [s   ] TJNrb   ©r   Útextr   r   r   Ú	show_text—  s    zStream.show_textc                 C   s   | j  t|ƒjd ¡ dS )zShow single text string.s    TjN)r?   rF   ÚStringr   r§   r   r   r   Úshow_text_string›  s    zStream.show_text_stringc                 C   s   | j  d¡ dS )zStroke path.ó   SNrE   r   r   r   r   rT   Ÿ  s    zStream.strokec                 C   s   | j  d¡ dS )zStroke and close path.ó   sNrE   r   r   r   r   Ústroke_and_close£  s    zStream.stroke_and_closec                 C   st   d  dd„ | jD ƒ¡}t| j ¡ ƒ}| jrTd|d< tjdd�}| |¡}|| ¡ 7 }t	|ƒ|d< d  |j
d	|d
f¡S )Nó   
c                 s   s   | ]}t |ƒV  qd S r-   r2   )r3   r   r   r   r   rŒ   ©  r8   zStream.data.<locals>.<genexpr>z/FlateDecodeÚFilteré	   )ÚlevelÚLengths   streams	   endstream)r;   r?   r,   r@   ÚcopyrA   rn   ÚcompressobjÚflushrq   r   )r   r?   r@   rµ   r   r   r   r   §  s    
zStream.data)NNF)N)F)F)F)F)F)F)F)F)4r'   r(   r)   r*   r   rH   rI   rL   rN   rO   r]   r_   ra   rc   re   rf   rg   ri   rk   rm   ru   rz   r|   r}   r~   r   rƒ   r…   r†   rŠ   rQ   rŽ   r‘   r”   r–   r—   r˜   r™   rš   r    r¡   r¢   r£   r¤   r¥   r©   r«   rT   r®   r+   r   Ú__classcell__r   r   rB   r   r%   P   s`   	
	
	





	
r%   c                       s.   e Zd ZdZd‡ fdd„	Zedd„ ƒZ‡  ZS )rª   zPDF String object.Ú c                    s   t ƒ  ¡  || _d S r-   )r>   r   Ústring)r   r¹   rB   r   r   r   ¶  s    
zString.__init__c                 C   sb   z"t  ddt| jƒ¡}d| d W S  ty\   tt| jƒ d¡ }d| ¡  ¡  d  Y S 0 d S )Ns
   ([\\\(\)])s   \\\1ó   (ó   )z	utf-16-beó   <ó   >)	ÚreÚsubr   r¹   ÚUnicodeEncodeErrorr   r   r   Úhex)r   ÚescapedÚencodedr   r   r   r   »  s    zString.data)r¸   )r'   r(   r)   r*   r   r+   r   r·   r   r   rB   r   rª   ´  s   rª   c                   @   s&   e Zd ZdZddd„Zedd„ ƒZdS )r�   zPDF Array object.Nc                 C   s   t  | ¡ t | |pg ¡ d S r-   )r   r   Úlist)r   Úarrayr   r   r   r   Ë  s    
zArray.__init__c                 C   s   dd  dd„ | D ƒ¡ d S )Nr¦   r1   c                 s   s   | ]}t |ƒV  qd S r-   r2   )r3   Úchildr   r   r   rŒ   Ñ  r8   zArray.data.<locals>.<genexpr>ó   ])r;   r   r   r   r   r   Ï  s    z
Array.data)Nr=   r   r   r   r   r�   É  s   
r�   c                   @   sF   e Zd ZdZdd„ Zdd„ Zdd„ Zedd	„ ƒZd
d„ Z	ddd„Z
dS )ÚPDFzPDF document.c                 C   sŠ   g | _ tƒ }d|_d|_|  |¡ tdtg ƒddœƒ| _|  | j¡ ti ƒ| _|  | j¡ td| jj	dœƒ| _
|  | j
¡ d| _d| _dS )	zCreate a PDF document.iÿÿ  r   z/Pagesr   )ÚTypeÚKidsÚCountz/Catalog)rÉ   ÚPagesN)Úobjectsr   r   r   Ú
add_objectr,   r�   ÚpagesÚinfor#   ÚcatalogÚcurrent_positionÚxref_position)r   Zzero_objectr   r   r   r   Ö  s(    
ý

þ
zPDF.__init__c                 C   s8   | j d  d7  < |  |¡ | j d  |jddg¡ dS )zfAdd page to the PDF.

        :param page: New page.
        :type page: :class:`Dictionary`

        rË   é   rÊ   r   ÚRN)rÏ   rÎ   Úextendr   )r   Úpager   r   r   Úadd_pageù  s    
zPDF.add_pagec                 C   s   t | jƒ|_| j |¡ dS )zAdd object to the PDF.N)rq   rÍ   r   rF   )r   Úobject_r   r   r   rÎ     s    zPDF.add_objectc                 C   s"   t dd„ | jd d d d… D ƒƒS )Nc                 s   s   | ]}|› d �  d¡V  qdS )z 0 Rr   N)r   )r3   Zobject_numberr   r   r   rŒ     s   ÿz&PDF.page_references.<locals>.<genexpr>rÊ   é   )ÚtuplerÏ   r   r   r   r   Úpage_references	  s    þzPDF.page_referencesc                 C   s(   |  j t|ƒd 7  _ | |d ¡ dS )zÅWrite line to output.

        :param content: Content to write.
        :type content: :obj:`bytes`
        :param output: Output stream.
        :type output: binary :term:`file object`

        rÔ   r¯   N)rÒ   rq   Úwrite)r   ÚcontentÚoutputr   r   r   Ú
write_line  s    	zPDF.write_lineó   1.7Fc              	      sv  t |pdƒ}|dvrt |ƒ}|  d| |¡ |  d|¡ |dk�rÞ|�rÞg }| jD ]8}|jdkrbqR|jrt| |¡ qR| j|_|  |j|¡ qRg g}d}t	|ƒD ]F\}	}|j
}
| |
¡ |d  |j¡ |d  |¡ |t|
ƒd 7 }qžd	 d
d„ |d D ƒ¡|d< dt|ƒt|d ƒd dœ}t|||ƒ}| j|_|  |¡ |  |j|¡ g }d}| jD ]D}|j�r€| d|j|f¡ |d7 }n| t|jƒ|j|jf¡ �qX| d| jdf¡ tt| jd dƒƒ}tdd„ | jD ƒƒ}ttt|t|ƒƒd dƒƒ}d||f‰ d ‡ fdd„|D ƒ¡}dtdt| jƒd fƒtˆ ƒt| jƒd | jj| jjdœ}|�r¦d dd„ | jD ƒ¡}
t|
ƒ ¡  ¡ }|du �rŠ|}tt|ƒj
t|ƒj
fƒ|d< t|g||ƒ}| j | _|_|  |¡ |  |j|¡ �nh| jD ],}|jdk�rø�qä| j|_|  |j|¡ �qä| j| _|  d|¡ |  dt| jƒ› � ¡ |¡ | jD ]2}|  |jd›d	|jd›d	|j› d	� ¡ |¡ �qH|  d|¡ |  d|¡ |  dt| jƒ› � ¡ |¡ |  d| jj |¡ |  d | jj |¡ |�r:d d!d„ | jD ƒ¡}
t|
ƒ ¡  ¡ }|du �r|}|  d"t|ƒj
 d# t|ƒj
 d$ |¡ |  d%|¡ |  d&|¡ |  | j›  ¡ |¡ |  d'|¡ d(S ))aÛ  Write PDF to output.

        :param output: Output stream.
        :type output: binary :term:`file object`
        :param bytes version: PDF version.
        :param identifier: PDF file identifier. Default is :obj:`False`
          to include no identifier, can be set to :obj:`True` to generate an
          automatic identifier.
        :type identifier: :obj:`bytes` or :obj:`bool`
        :param bool compress: whether the PDF uses a compressed object stream.

        rá   )FTNs   %PDF-s   %ðŸ–¤s   1.5r   r   rÔ   r    c                 s   s   | ]}t |ƒV  qd S r-   )r   )r3   Úir   r   r   rŒ   F  r8   zPDF.write.<locals>.<genexpr>z/ObjStm)rÉ   ÚNÚFirsté   é   c                 s   s   | ]}|j V  qd S r-   )r   )r3   rÙ   r   r   r   rŒ   _  s   r8   c                 3   s.   | ]&}t ˆ |ƒD ]\}}| |d ¡V  qqdS )ÚbigN)ÚzipÚto_bytes)r3   ÚlineÚlengthr5   ©Zxref_lengthsr   r   rŒ   d  s   ÿz/XRef)rÉ   ÚIndexÚWÚSizeÚRootÚInfoc                 s   s   | ]}|j d kr|jV  qdS ©r   N©r   r   ©r3   Úobjr   r   r   rŒ   p  s   TÚIDs   xrefz0 Z010Z05s   trailerr7   z/Size s   /Root s   /Info c                 s   s   | ]}|j d kr|jV  qdS rò   ró   rô   r   r   r   rŒ   “  s   s   /ID [r1   rÇ   r9   s	   startxrefs   %%EOFN)r   rà   rÍ   r   r&   rF   rÒ   r   r"   Ú	enumerater   r   rq   r;   r%   rÎ   Úboolr   r   r   Úmaxr�   rÑ   r#   rÐ   r   Ú	hexdigestr   rª   rÓ   )r   rß   ÚversionÚ
identifierrA   Zcompressed_objectsrÙ   r?   Úpositionrâ   r   r@   Zobject_streamÚxrefZ
dict_indexZfield2_sizeZmax_generationZfield3_sizeZxref_streamZ	data_hashZdict_streamr   rì   r   rÝ     sâ    


ý


þ
ÿÿ
þú
ÿ
ÿ



ÿ
þ
ÿ
ÿÿþz	PDF.writeN)rá   FF)r'   r(   r)   r*   r   rØ   rÎ   r+   rÜ   rà   rÝ   r   r   r   r   rÈ   Ô  s   #
rÈ   )r*   ro   r¾   rn   Úcodecsr   Úhashlibr   Úmathr   r   Úwarningsr   ÚVERSIONÚ__version__r   r   r.   r,   r%   rª   rÄ   r�   rÈ   r   r   r   r   Ú<module>   s"   #  f