%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/reportlab/platypus/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/reportlab/platypus/__pycache__/doctemplate.cpython-312.pyc

�

��d�����dZdZdZddl�ddlmZddlmZddlmZddl	m
Z
dd	lmZm
Z
dd
lZddlmZddlmZmZmZmZmZ	edd
lZdd
lZej<d�ZGd�de �Z!d�Z"d�Z#Gd�de$�Z%Gd�de&�Z'Gd�de&�Z(Gd�de(�Z)Gd�de(�Z*Gd�de(�Z+Gd�d e*�Z,Gd!�de(�Z)Gd"�d#e*�Z-e-d$�Z.e*d%�Z/d&�Z0Gd'�d(e&�Z1Gd)�d*e1�Z2Gd+�d,e1�Z3Gd-�d.e(�Z4Gd/�d0�Z5d1�Z6Gd2�d3e7�Z8Gd4�d5�Z9d6�Z:Gd7�d8�Z;Gd9�d:e;�Z<d;�Z=e>d<k(rdd=l?m@Z@mAZAd>�ZBd?�ZCd@�ZDeD�y
y
#e$r
dd
lmZY��7wxYw)A)�ActionFlowable�BaseDocTemplate�CurrentFrameFlowable�FrameActionFlowable�
FrameBreak�Indenter�IndexingFlowable�LayoutError�LCActionFlowable�NextFrameFlowable�NextPageTemplate�NotAtTopPageBreak�NullActionFlowable�PageAccumulator�	PageBegin�PageTemplate�SimpleDocTemplatez3.5.20a>
This module contains the core structure of platypus.

rlatypus constructs documents.  Document styles are determined by DocumentTemplates.

Each DocumentTemplate contains one or more PageTemplates which defines the look of the
pages of the document.

Each PageTemplate has a procedure for drawing the "non-flowing" part of the page
(for example the header, footer, page number, fixed logo graphic, watermark, etcetera) and
a set of Frames which enclose the flowing part of the page (for example the paragraphs,
tables, or non-fixed diagrams of the text).

A document is built when a DocumentTemplate is fed a sequence of Flowables.
The action of the build consumes the flowables in order and places them onto
frames on pages as space allows.  When a frame runs out of space the next frame
of the page is used.  If no frame remains a new page is created.  A new page
can also be created if a page break is forced.

The special invisible flowable NextPageTemplate can be used to specify
the page template for the next page (which by default is the one being used
for the current frame).
�)�*)�_ContainerSpace)�inch)�	Paragraph)�Frame)�defaultPageSize�verboseN)�canvas)�isSeq�encode_label�decode_label�annotateException�strTypes)�Setzreportlab.platypusc��eZdZy)r	N)�__name__�
__module__�__qualname__���@/usr/lib/python3/dist-packages/reportlab/platypus/doctemplate.pyr	r	Ds��r'r	c���t|dd�}|�
t|dd�}t|dd�}|�
t|dd�}t|d�rd|j�z}nd}|�|�|�d}|�d}d	|�d
|�d|��Sy)N�width�_width�height�_height�_culpritz, %s, �z???�(z x �))�getattr�hasattrr.)�f�w�h�cs    r(�_fSizeStringr8Gs���
�a����A��y�
�!�H�T�
"��
�a����A��y�
�!�I�d�
#���q�*���q�z�z�|�#�����}��
��9��a��9��a�� !�!�A�&�&�
r'c��y)zDummy callback for onPageNr&)r�docs  r(�
_doNothingr;[s��r'c�2�eZdZd�Zed��Zed��Zy)�PTCyclec�T�tj|g|��i|��}d|_d|_|S�Nr)�list�__new__�_restart�_idx)�cls�args�kwds�selfs    r(rAzPTCycle.__new__`s-���|�|�C�-��-��-����
���	��r'c��||j}|xjdz
c_|jt|�k\r|j|_|S�N�)rC�lenrB)rG�vs  r(�
next_valuezPTCycle.next_valuefs<������O���	�	�Q��	��9�9�c�$�i���
�
�D�I��r'c� �||jS�N)rC�rGs r(�peekzPTCycle.peekns���D�I�I��r'N)r#r$r%rA�propertyrMrQr&r'r(r=r=_s/����������r'r=c�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)rz�Abstract interface definition for flowables which might
    hold references to other pages or themselves be targets
    of cross-references.  XRefStart, XRefDest, Table of Contents,
    Indexes etc.c��yrIr&rPs r(�
isIndexingzIndexingFlowable.isIndexingw���r'c��yrIr&rPs r(�isSatisfiedzIndexingFlowable.isSatisfiedzrVr'c��y)z�This will be called by the framework wherever 'stuff' happens.
        'kind' will be a value that can be used to decide whether to
        pay attention or not.Nr&)rG�kind�stuffs   r(�notifyzIndexingFlowable.notify}���	
r'c��y)zMCalled by multiBuild before it starts; use this to clear
        old contentsNr&rPs r(�beforeBuildzIndexingFlowable.beforeBuild����	
r'c��y)z.Called after build ends but before isSatisfiedNr&rPs r(�
afterBuildzIndexingFlowable.afterBuild����r'N)	r#r$r%�__doc__rUrXr\r_rbr&r'r(rrrs �����
�
�

r'rc�,�eZdZdZdd�Zd�Zd�Zdd�Zy)	rz�This Flowable is never drawn, it can be used for data driven controls
       For example to change a page template (from one column to two, for example)
       use NextPageTemplate which creates an ActionFlowable.
    c�j�tj|�t|�s|f}t|�|_yrO)�Flowable�__init__r�tuple�action)rGrjs  r(rhzActionFlowable.__init__�s+��	���$���V�}��Y�F��F�m��r'c	�4�|jd}t|jdd�}d|z}|dk(r	|ddk(r		t||�|�y#t$r&}|jd|k(rtd|z���d}~wt
d|�d	t|����YyxYw)
zu
        This is called by the doc.build processing to allow the instance to
        implement its behaviour
        rrJN�handle_�handle_nextPageTemplate�mainzCan't handle ActionFlowable(%s)z
handle_z args=)rjrir2�AttributeErrorrE�NotImplementedErrorr�ascii)rGr:rjrE�arn�aerrs      r(�applyzActionFlowable.apply�s���
���Q����T�[�[���_�%�������)�)�d�1�g�v�o��	J��G�C���d�#���	��y�y��|�S� �)�*K�f�*T�U�U���	J��V�E�$�K�H�I�s�A�	B�!A6�6Bc��|SrOr&rPs r(�__call__zActionFlowable.__call__�s���r'Nc�R�dt|j��|j���S)NzActionFlowable: )�strrj�
_frameName)rG�maxLens  r(�identityzActionFlowable.identity�s��),�T�[�[�)9�$�/�/�:K�L�Lr')r&rO)r#r$r%rdrhrtrvr{r&r'r(rr�s���$�J�(�Mr'rc��eZdZdZd�Zy)rz#an ActionFlowable that does nothingc��yrOr&�rGr:s  r(rtzNullActionFlowable.apply����r'N)r#r$r%rdrtr&r'r(rr�s
��-�
r'rc��eZdZdZd�Zd�Zy)r
rJc�F�td|jjz��)�Should never be called.z%s.wrap should never be called�rp�	__class__r#)rG�
availWidth�availHeights   r(�wrapzLCActionFlowable.wrap����!�"B�T�^�^�E\�E\�"\�]�]r'c�F�td|jjz��)r�z%s.draw should never be calledr�rPs r(�drawzLCActionFlowable.draw�r�r'N)r#r$r%�
locChangerr�r�r&r'r(r
r
�s���J�^�^r'r
c��eZdZdZdd�Zy)rrJc�6�tj|d||f�y)N�	nextFrame�rrh�rG�ix�resumes   r(rhzNextFrameFlowable.__init__�s������k�"�V�%<�=r'N�r�r#r$r%r�rhr&r'r(rr�s���J�>r'rc��eZdZdd�Zy)rc�6�tj|d||f�y)N�currentFramer�r�s   r(rhzCurrentFrameFlowable.__init__�s������n�R��%?�@r'Nr�)r#r$r%rhr&r'r(rr�s��Ar'rc��eZdZd�Zy)rc��yrOr&r~s  r(rtzNullActionFlowable.apply�rr'N)r#r$r%rtr&r'r(rr�s��
r'c��eZdZdZdd�Zd�Zy)�_FrameBreakz}
    A special ActionFlowable that allows setting doc._nextFrameIndex

    eg story.append(FrameBreak('mySpecialFrame'))
    Nc�R�|j|j|fz�}||_|SrO)r�rj�_ix)rGr�r��rs    r(rvz_FrameBreak.__call__�s'���N�N�4�;�;��y�0�1������r'c��t|dd�r|j|j�tj	||�y)Nr�)r2�handle_nextFramer�rrtr~s  r(rtz_FrameBreak.apply�s0���4��d�#�� � ����*����T�#�&r'r?)r#r$r%rdrvrtr&r'r(r�r��s���
�
'r'r��frameEnd�	pageBeginc�b�t|t�rddlm}||�}t	|�r|d}|S)Nr)�_numrJ)�
isinstancerx�reportlab.platypus.paraparserr�r)�nr�s  r(�_evalMeasurementr��s,���!�C��6���G����8��1��Q��Hr'c� �eZdZdxZZd�Zd�Zy)rrJc�F�td|jjz��)Nz5%s.__init__ should never be called for abstract Classr�)rG�arg�kws   r(rhzFrameActionFlowable.__init__�s ��!�"Y�Z^�Zh�Zh�Zq�Zq�"q�r�rr'c�F�td|jjz��)Nz8%s.frameAction should never be called for abstract Classr��rG�frames  r(�frameActionzFrameActionFlowable.frameAction�s ��!�"\�]a�]k�]k�]t�]t�"t�u�ur'N)r#r$r%�_fixedWidth�_fixedHeightrhr�r&r'r(rr�s��!"�"�K�,�s�vr'rc�*�eZdZdZdZdZdZdd�Zd�Zy)rz�Increases or decreases left and right margins of frame.

    This allows one to have a 'context-sensitive' indentation
    and makes nested lists way easier.
    Trc�D�t|�|_t|�|_yrO)r��left�right)rGr�r�s   r(rhzIndenter.__init__�s��$�T�*��	�%�e�,��
r'c��|xj|jz
c_|xj|jz
c_yrO)�_leftExtraIndentr��_rightExtraIndentr�r�s  r(r�zIndenter.frameAction�s,��
���$�)�)�+��
���4�:�:�-�r'N)rr)	r#r$r%rd�	_ZEROSIZEr*r,rhr�r&r'r(rr�s"���
�I�
�E��F�-�.r'rc��eZdZdZdd�Zd�Zy)r
rJNc��||_yrO��nextTemplate)rGr�s  r(rhzNotAtTopPageBreak.__init__s
��(��r'c�h�|js&|jt|j���yy)Nr�)�_atTop�add_generated_content�	PageBreakr�r�s  r(r�zNotAtTopPageBreak.frameActions'���|�|��'�'�	�t�?P�?P�(Q�R�r'rO)r#r$r%r�rhr�r&r'r(r
r
s���J�)�Sr'r
c��eZdZdZ	d�Zy)rrJc�4�tj|d|f�y)N�nextPageTemplater�)rG�pts  r(rhzNextPageTemplate.__init__s������&8��%<�=r'Nr�r&r'r(rrs���J�i�>r'rc
�>�eZdZdZdgeeddddddf
d�Zd�Zd�Zd�Zy)rz�
    essentially a list of Frames and an onPage routine to call at the start
    of a page when this is selected. onPageEnd gets called at the end.
    derived classes can also implement beforeDrawPage and afterDrawPage if they want
    Nc��|xsg}t|�s|g}|D�cgc]}t|t�r�|��c}gk(sJd��||_||_||_||_||_||_||_	||_
|	|_|
|_ycc}w)Nzframes argument error)
rr�r�id�frames�onPage�	onPageEnd�pagesize�autoNextPageTemplate�cropBox�artBox�trimBox�bleedBox)rGr�r�r�r�r�r�r�r�r�r��xs            r(rhzPageTemplate.__init__s�����2���V�}��x�f�!�=�a��A�e�)<��=�r�A�Z�CZ�Z�A����������"��� ��
�$8��!���������� ��
��>s
�B�Bc��y)z�Override this if you want additional functionality or prefer
        a class based page routine.  Called before any flowables for
        this page are processed.Nr&�rG�canvr:s   r(�beforeDrawPagezPageTemplate.beforeDrawPage-r]r'c�
�d}d}d}|jr#ttt|j��}|jr#ttt|j��}|jr#ttt|j��}||k7r>|r|j|j�n ||k7r|j|j�dD](}t
||dzd�}|s�|j||���*y)z�This gets called by the template framework
        If canv size != template size then the canv size is set to
        the template size or if that's not available to the
        doc size.
        N)�crop�art�trim�bleed�Box)�name)�	_pagesizer@�map�intr��setPageSizer2�
setCropBox)rGr�r:�cp�dp�sp�box�sizes        r(�
checkPageSizezPageTemplate.checkPageSize3s�����
��
���>�>��S��d�n�n�%=� >�2��=�=�t�C��T�]�]�$;�<�"��<�<�d�3�s�C�L�L�#9�:��
�r�6��� � ����/��R��� � ����.�.�	/�C��4��E�	�$�/�D������#��.�	/r'c��y)z�This is called after the last flowable for the page has
        been processed.  You might use this if the page header or
        footer needed knowledge of what flowables were drawn on
        this page.Nr&r�s   r(�
afterDrawPagezPageTemplate.afterDrawPageL���
	
r')	r#r$r%rdr;rhr�r�r�r&r'r(rrs7���
�R�z�Z��T�����!�*
�/�2
r'rc�2�t|dd�}|r||dd|`yy)N�_generated_contentr)r2r�)�	flowablesr��Ss   r(�_addGeneratedContentr�Ss*����*�4�0�A���	�!�A���$�	r'c��eZdZdd�Zd�Zy)�	onDrawStrNc�\�tj||�}||_||_||_|SrO)rxrA�onDrawrZ�label)rD�valuer�r�rZrGs      r(rAzonDrawStr.__new__Zs,���{�{�3�u�%�������	���
��r'c�\�t|�|j|j|jfSrO)rxr�r�rZrPs r(�__getnewargs__zonDrawStr.__getnewargs__as!���4�y����T�Z�Z��	�	�9�9r'rO)r#r$r%rAr�r&r'r(r�r�Ys���:r'r�c�R�eZdZdZdZdd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zy)rzngadget to accumulate information in a page
    and then allow it to be interrogated at the end
    of the pagerNc���|�U|jjt|jj�z}|jxjdz
c_||_g|_yrI)r�r#rx�_countr��data)rGr�s  r(rhzPageAccumulator.__init__isM���<��>�>�*�*�3�t�~�~�/D�/D�+E�E�D��N�N�!�!�Q�&�!���	���	r'c�"�g|jddyrO)r�rPs r(�resetzPageAccumulator.resetps����	�	�!�r'c�:�|jj|�yrO)r��append�rGrEs  r(�addzPageAccumulator.addss���	�	����r'c�:�d|j�dt|��d�S)Nz<onDraw name="z	" label="z" />)r�rrs  r(�
onDrawTextzPageAccumulator.onDrawTextvs��48�I�I�l�4�>P�Q�Qr'c�4�|jt|��yrO)rr)rGr�rZr�s    r(rvzPageAccumulator.__call__ys������,�u�%�&r'c���|jr|jf�fd�	}n�fd�}||_|jr|jf�fd�	}||_y�fd�}||_y)Nc�<���j||�|||�yrO�r��r�r:�ooprGs   �r(r�z4PageAccumulator.attachToPageTemplate.<locals>.onPage~s������D��%��D��
r'c�*���j||�yrOr	�r�r:rGs  �r(r�z4PageAccumulator.attachToPageTemplate.<locals>.onPage�s������D��%r'c�<���j||�|||�yrO�r�r
s   �r(r�z7PageAccumulator.attachToPageTemplate.<locals>.onPageEnd�s������t�C�(��D��
r'c�*���j||�yrOrr
s  �r(r�z7PageAccumulator.attachToPageTemplate.<locals>.onPageEnd�s������t�C�(r')r�r�)rGr�r�r�s`   r(�attachToPageTemplatez$PageAccumulator.attachToPageTemplate|sJ���
�9�9�$&�I�I�
�
&���	�
�<�<�')�|�|�
�!���
)� ��r'c�R�t||j|�|j�y)z,this will be called at the start of the pageN)�setattrr�r�r�s   r(r�zPageAccumulator.onPage�s����T�Y�Y�t�$��
�
�r'c��|j||�	t||j�|j�y#Y�xYw)z(this will be called at the end of a pageN)�
pageEndAction�delattrr�r�r�s   r(r�zPageAccumulator.onPageEnd�s:�����4��$�	��D����#�	
�
�
���	��s�;�?c��y)z0this should be overridden to do something usefulNr&r�s   r(rzPageAccumulator.pageEndAction�rcr'c�.�t||t|��SrO)r�r)rGr�rEs   r(r�zPageAccumulator.onDrawStr�s����t�L��$6�7�7r'rO)r#r$r%rdr�rhr�rrrvrr�r�rr�r&r'r(rrdsA����F����R�'�!�$�
�
�8r'rc�X�t|tttf�xs
t	|dd�S)z6return true if allowed in containers like KeepTogetherr�F)r�r�DocIf�DocWhiler2)r4s r(�_ktAllowr�s(���1�o�e�H�=�>�_�'�!�L�Y^�B_�`�`r'c
��eZdZdZide�dg�dd�de�de�de�d	e�d
d�dd
�dd
�dd
�dd
�dd
�dg�dd
�dd
�dd�idd�dd�dd
�dd
�dd
�dd
�dd
�dd
�dd
�dd
�d d
�d!d
�d"d
�d#d
�d$e�d%d
�d&d
��d
d
d
d
d
d
d
d
d
d
d
d'��Zd(ZdZ	d)�Z
d*�Zd+�Zd,�Z
d-�Zd.�Zd/�Zd0�Zd1�Zd2�Zd3�ZdTd4�ZdUd5�ZdVd6�Zd7�Zd8�Zd9�ZdVd:�ZdVd;�Zd<�Zd=�ZdWd>�Zd?�Z eZ!eZ"eZ#eZ$eZ%e Z&eZ'eZ(eZ)d
e*jVfd@�Z,d
e*jVfdA�Z-dB�Z.d
e*jVfdC�Z/dD�Z0dE�Z1dF�Z2	dXdG�Z3dH�Z4dI�Z5dJ�Z6dK�Z7dL�Z8dM�Z9dNZ:dO�Z;dP�Z<dQ�Z=dR�Z>dS�Z?y
)Yra�	
    First attempt at defining a document template class.

    The basic idea is simple.

    1)  The document has a list of data associated with it
        this data should derive from flowables. We'll have
        special classes like PageBreak, FrameBreak to do things
        like forcing a page end etc.

    2)  The document has one or more page templates.

    3)  Each page template has one or more frames.

    4)  The document class provides base methods for handling the
        story events and some reasonable methods for getting the
        story flowables into the frames.

    5)  The document instances can override the base handler routines.

    Most of the methods for this class are not called directly by the user,
    but in some advanced usages they may need to be overridden via subclassing.

    EXCEPTION: doctemplate.build(...) must be called for most reasonable uses
    since it builds a document using the page template.

    Each document template builds exactly one document into a file specified
    by the filename argument on initialization.

    Possible keyword arguments for the initialization:

    - pageTemplates: A list of templates.  Must be nonempty.  Names
      assigned to the templates are used for referring to them so no two used
      templates should have the same name.  For example you might want one template
      for a title page, one for a section first page, one for a first page of
      a chapter and two more for the interior of a chapter on odd and even pages.
      If this argument is omitted then at least one pageTemplate should be provided
      using the addPageTemplates method before the document is built.
    - pageSize: a 2-tuple or a size constant from reportlab/lib/pagesizes.pu.
      Used by the SimpleDocTemplate subclass which does NOT accept a list of
      pageTemplates but makes one for you; ignored when using pageTemplates.

    - showBoundary: if set draw a box around the frame boundaries.
    - leftMargin:
    - rightMargin:
    - topMargin:
    - bottomMargin:  Margin sizes in points (default 1 inch).  These margins may be
      overridden by the pageTemplates.  They are primarily of interest for the
      SimpleDocumentTemplate subclass.

    - allowSplitting:  If set flowables (eg, paragraphs) may be split across frames or pages
      (default: 1)
    - title: Internal title for document (does not automatically display on any page)
    - author: Internal author for document (does not automatically display on any page)
    r��
pageTemplates�showBoundaryr�
leftMargin�rightMargin�	topMargin�bottomMargin�allowSplittingrJ�titleN�author�subject�creator�producer�keywords�	invariant�pageCompression�_pageBreakQuick�rotation�_debug�encrypt�	cropMarks�enforceColorSpace�displayDocTitle�lang�initialFontName�initialFontSize�initialLeadingr�r�r�r��keepTogetherClass�hideToolbar�hideMenubar)�hideWindowUI�	fitWindow�centerWindow�nonFullScreenPageMode�	direction�viewArea�viewClip�	printArea�	printClip�printScaling�duplexr&c�B�||_t|��|_i|_|jj�D]D}||vr|j|}n!||jvrtd|z��||}t|||��F|j}g|_	|j|�i|_g|_d|_
d|_d|_d|_d|_d|_d|_d|_g|_g|_g|_|j1�|j3�y)z^create a document template bound to a filename (see class documentation for keyword arguments))r:zInvalid argument %sNr�
g)�filename�dict�
_nameSpace�
_lifetimes�	_initArgs�keys�_invalidInitArgs�
ValueErrorrr�addPageTemplates�	_pageRefs�_indexingFlowables�_onPage�_onProgress�_flowableCount�_curPageFlowableCount�_emptyPages�_emptyPagesAllowedr�r��
_topFlowables�_pageTopFlowables�	_frameBGs�_calc�	afterInit)rGrHr��krL�ps      r(rhzBaseDocTemplate.__init__s#�� ��
��4�.���������$�$�&�	�A���{��N�N�1�%����-�-�-�$�%:�Q�%>�?�?��q�E���D��1��	�
����������a� ����"$������������&'��"����"$���!$���!$������!#�������
�
�����r'c��|jd|jz
|_|jd|jz
|_|j|j
z
|_|j|jz
|_y)NrrJ)	r�r!�_rightMarginr"�
_topMarginr r*r#r,rPs r(r\zBaseDocTemplate._calc>sc�� �M�M�!�,�t�/?�/?�?����-�-��*�T�^�^�;����&�&����8��
��o�o��(9�(9�9��r'c��||_y)z>Simple progress monitor - func(pageNo) called on each new pageN)rS�rG�funcs  r(�setPageCallBackzBaseDocTemplate.setPageCallBackDs	����r'c��||_y)z=Cleverer progress monitor - func(typ, value) called regularlyN)rTrds  r(�setProgressCallBackz#BaseDocTemplate.setProgressCallBackHs
����r'c��t|j�r2|j|j�t|j�r�1yy)z!handle internal postponed actionsN)rK�_hanging�handle_flowablerPs r(�
clean_hangingzBaseDocTemplate.clean_hangingLs.���$�-�-� �� � ����/��$�-�-� r'c�d�t|�s|g}|D]}|jj|��y)z&add one or a sequence of pageTemplatesN)rrr)rGr�ts   r(rPz BaseDocTemplate.addPageTemplatesQs6���]�#�*�O�M��	)�A����%�%�a�(�	)r'c��tg|_t|jt�r,|j|j�|j
�n|j|j|_d|_	|j�y)z*implement actions at beginning of documentrN)rrjr��_firstPageTemplateIndexr@rm�_setPageTemplater�pageTemplate�page�beforeDocumentrPs r(�handle_documentBeginz$BaseDocTemplate.handle_documentBeginZsg��"���
��d�2�2�4�8��(�(��)E�)E�F��!�!�#� $� 2� 2�4�3O�3O� P�D����	����r'c��|xjdz
c_|jr"tjd|jz�|jj|j|�|jj|j|�|jj|j|�|jjD]}|j��|j�d|_t|d�r|`|jjd|_|j|j_|j!|j"��y)z\Perform actions required at beginning of page.
        shouldn't normally be called directlyrJzbeginning page %dr�_nextFrameIndex)�pageTopFlowablesN)rsr/�logger�debugrrr�r�r�r�r��_reset�
beforePagerVr3rwr��handle_frameBeginrZ)rGr4s  r(�handle_pageBeginz BaseDocTemplate.handle_pageBegines���	
�	�	�Q��	��;�;����%8�4�9�9�%D�E����(�(����4�8����'�'��	�	�$�7���� � ����4�0��"�"�)�)�5�A�1�8�8�:�5�����%&��"��4�)�*��$��&�&�-�-�a�0��
� �K�K��
�
������0F�0F��Gr'c�b�t|d�r|jj|_yt|d�r!|j|j
|_|`y|jjrD|j|jj�|j|j
|_yy)N�_nextPageTemplateCycle�_nextPageTemplateIndex)r3r�rMrrrr�r�rmrPs r(rqz BaseDocTemplate._setPageTemplatews����4�0�1� $� ;� ;� F� F�D��
�T�2�
3� $� 2� 2�4�3N�3N� O�D���+�
�
�
�
3�
3��(�(��):�):�)O�)O�P� $� 2� 2�4�3N�3N� O�D��4r'c���t|�r
t|dg�St|t�rJ|t	|d�r%|j
|jjk(S|jjk(St|t�red|cxkrt|j
�krFnyt	|d�r||jk(S||j
j|j�k(Syy)Nr�r�r)rr2r�r r3rr�r�rrr�rK�find)rG�npts  r(�_samePTzBaseDocTemplate._samePT�s�����:��4� 8��<�<��c�(�#��QX�Y]�^v�Qw�4�-�-�d�.I�.I�J�M�M�S�
S�~B�~O�~O�~R�~R�S�
S��c�#��1�c�#A�#�d�.@�.@�*A�#A��t�4�5��D�7�7�7�7���*�*�/�/��0A�0A�B�B�B�$B�r'c�.�|jd�|jj|_|jj|_|jj|_|j
dk(r|xjdz
c_nd|_|j|jk\r	d|jz}t|��|jr*|jd|jj��|jj|j|�|jj|j|�|j�|j r"t"j%d|j&z�|jj)t+|jd|j,��|jj/�|j1�|jdk(r	|j2j5t6�y)	zf show the current page
            check the next page template
            hang a page begin
        )rsr�rrJzrMore than %d pages generated without content - halting layout.  Likely that a flowable is too large for any frame.�PAGEzending page %dr.N)�_removeVarsr�r�r�r[rVrWrXr	rTr��
getPageNumberrrr�r��	afterPager/ryrzrs�setPageRotationr2r.�showPagerqrjrr)rG�idents  r(�handle_pageEndzBaseDocTemplate.handle_pageEnd�s���
	
���)�*� $�
�
� ;� ;���!%���!=�!=������-�-����%�%��*�����!�� �D�����t�6�6�6��M�PT�Pg�Pg�g��!�%�(�(����� � �����)@�)@�)B�C����+�+�D�I�I�t�<����'�'��	�	�4�8��N�N���{�{�F�L�L�)9�D�I�I�)E�F��I�I�%�%�g�d�.?�.?�
�4�=�=�&Y�Z��I�I��� ��!�!�#�����"���
�
���Y�'r'c���|jr|s|j�yt|j�}t|j�|k(r*|j	�t|j�|k(r�)yy)z+some might choose not to end all the framesN)r-r�rKrj�handle_frameEnd)rG�slowr�s   r(�handle_pageBreakz BaseDocTemplate.handle_pageBreak�sW���������!��D�M�M�"�A��d�m�m�$�a�'��$�$�&��d�m�m�$�a�'r'c���|j}|jrL|jjxs|j}|r&|jj|j|�|j
|_|j|_|j|_|r|jj|�|jr&|jj|j�yy)z&What to do at the beginning of a frameN)r�r�r�drawBoundaryr�r�r�r[rj�extendrY)rGr�rxr4�boundarys     r(r}z!BaseDocTemplate.handle_frameBegin�s����J�J���8�8��z�z�.�.�C�$�2C�2C�H���
�
�'�'��	�	�(�;�!�2�2���"�4�4����n�n�����M�M� � �!1�2�����M�M� � ��!3�!3�4�r'c��|jd�|jj|_|jj|_|jj|_t|d�rW|jj|j|_|j|j_	|`|j|�y|j}t|d�s||jjdur|j�d|_y|jj|jjj|�dz|_|j|j_	|j�y)z� Handles the semantics of the end of a frame. This includes the selection of
            the next frame or if this is the last frame then invoke pageEnd.
        )r�rw�	lastFrame���NrJ)
r�r�r�r�r[r3rrr�rwr/r}r��index)rGr�r4s   r(r�zBaseDocTemplate.handle_frameEnd�s$��	
����$� $�
�
� ;� ;���!%���!=�!=������-�-����4�)�*��*�*�1�1�$�2F�2F�G�D�J� $���D�J�J���$��"�"�6�*��
�
�A��q��%��d�.?�.?�.F�.F�r�.J�)J��#�#�%�!��
�!�.�.�5�5�d�6G�6G�6N�6N�6T�6T�UV�6W�Z[�6[�\��
�$(�K�K��
�
�!��&�&�(r'c��t|t�r^t|d�r|`|jD]3}|j
|k(s�|jj
|�|_ytd|z��t|t�rt|d�r|`||_yt|�r�t�}|D]^}d}|dk(rt|�|_
�|jD]%}|j
|k(s�|j|�d}�'|r�Rtd|z��|std��|jt|�kDrtd	��||_ytd
��)z<On endPage change to the page template with name or index ptr�N�can't find template('%s')rrrJ�#Cannot find page template called %s� No valid page templates in cycle�Invalid cycle restart position�/argument pt should be string or integer or list)r�r r3r�rr�r�r�rOr�rr=rKrBr�	TypeError�rGr�rnr7�ptn�founds      r(rmz'BaseDocTemplate.handle_nextPageTemplate�sQ���b��"��t�5�6�D�<W��'�'�
���4�4�2�:�26�2D�2D�2J�2J�1�2M�D�/��
��8��;�<�<�
��3�
��t�5�6�D�<W�*,�D�'�
�2�Y��	�A��

R������8�!$�Q��A�J���+�+�"�A��t�t�s�{������ !��"��$�%J�S�%P�Q�Q�

R�� �!C�D�D����C��F�"� �!A�B�B�+,�D�'��M�N�Nr'c�D�t|t�r2|jD]}|j|k(s�|cSt	d|z��t|t
�r|j|yt
|�r�t�}|D]^}d}|dk(rt|�|_	�|jD]%}|j|k(s�|j|�d}�'|r�Rt	d|z��|st	d��|jt|�kDrt	d��|jStd��)	Nr�rrrJr�r�r�r�)
r�r rr�rOr�rr=rKrBrrQr�r�s      r(�_peekNextPageTemplatez%BaseDocTemplate._peekNextPageTemplates���b��"��'�'�
���4�4�2�:��H�
��8��;�<�<�
��3�
����r�"�
�2�Y��	�A��

R������8�!$�Q��A�J���+�+�"�A��t�t�s�{������ !��"��$�%J�S�%P�Q�Q�

R�� �!C�D�D����C��F�"� �!A�B�B��6�6�M��M�N�Nr'c��t|d�r#|jj|jS|j}t|d�s||jjdur�t|d�r|j
j}nnt|d�r|j|j}nH|jjr&|j|jj�}n|j}|jdS|jj|jjj|�dzS)z(intended to be used by extreme flowablesrwr�r�r�r�rrJ)r3rrr�rwr�r�rQrr�r�r�r�)rGr4rrs   r(�_peekNextFramezBaseDocTemplate._peekNextFrame#s
���4�)�*��$�$�+�+�D�,@�,@�A�A��J�J���1�[�!�Q�$�*;�*;�*B�*B�2�*F�%F��t�4�5�#�:�:�?�?����6�7�#�1�1�$�2M�2M�N���"�"�7�7�#�9�9�$�:K�:K�:`�:`�a��#�0�0���&�&�q�)�)��$�$�+�+�D�,=�,=�,D�,D�,J�,J�1�,M�PQ�,Q�R�Rr'c���t|t�r�|jjD]=}|j|k(s�|jjj|�|_ytd|�d|j�d|jj�d|jjD�cgc]}||jf��c}����t|t�r||_ytd��cc}w)z5On endFrame change to the frame with name or index fxNzcan't find frame('z') in r0z) which has frames z'argument fx should be string or integer)
r�r rrr�r�r�rwrOr�r�)rG�fxr�r4s    r(r�z BaseDocTemplate.handle_nextFrame6s���b��"��&�&�-�-�
���4�4�2�:�+/�+<�+<�+C�+C�+I�+I�!�+L�D�(��
��UW�X\�Xi�Xi�jn�j{�j{�j~�j~�SW�Sd�Sd�Sk�Sk�@l�NO�BC�DE�DH�DH�AI�@l�m�n�
n�
��3�
�#%�D� ��E�F�F��	@ls�,C-c�J�|j||�|j|�y)z)change to the frame with name or index fxN)r�r�)rGr�r�s   r(�handle_currentFramez#BaseDocTemplate.handle_currentFrameCs �����b��(����V�$r'c��|d}t|d�r
t|d�yt|d�r1|jdk(r"d|_|j	dt��yt|d�rQt|jd�r;|jjdk(r"d|_|j	dt��yt|d�r1|jdk(r"d|_|j	dt��yt|d�rSt|jd�r<|jjdk(r"d|_|j	dt��yyyy)zKpreprocessing step to allow pageBreakBefore and frameBreakBefore attributesr�_skipMeNextTimeN�pageBreakBeforerJ�style�frameBreakBefore)	r3rr�r��insertr�r�r�r)rGr��firsts   r(�handle_breakBeforez"BaseDocTemplate.handle_breakBeforeHs1���!����5�+�,��E�,�-���5�*�+��0E�0E��0J�$%�E�!��L�L��I�K�(���5��!�g�e�k�k�;L�&M�RW�R]�R]�Rm�Rm�qr�Rr�$%�E�!����Q�	��,���5�+�,��1G�1G�1�1L�$%�E�!����Q�
��-���5��!�g�e�k�k�;M�&N�SX�S^�S^�So�So�st�St�$%�E�!����Q�
��-��Tu�&N�!r'c�f�d}t|�}||krM||j�r:t||�r,|dz
}||kr"||j�rt||�r�,|r�||krt||�r|dz
}|j|d|�}t	|dd�}|rZ|j
ddD]G}t
|d�r|t|d|jf�n|t|df�d|jd<�In#|j
ddD]}d|jd<�|d|�=|jd|�yy)zimplements keepWithNextrrJN�_multiBuildEditsr��keepWithNext)rK�getKeepWithNextrr8r2�_contentr3rr�r�__dict__r�)rGr��ir��K�mber4s       r(�handle_keepWithNextz#BaseDocTemplate.handle_keepWithNextds@��
���	�N����c�i��l�2�2�4��)�A�,�9O�QR�VW�QW�QR�a��c�i��l�2�2�4��)�A�,�9O����s�x�	�!��-�q�A�v�q��&�&�y��!�}�5�A��$�1�$�7�C�����C�R��3�A��q��0��W�Q�~�a�n�n�E�F��W�Q�~�6�7�12�A�J�J�~�.�3����C�R��3�A�12�A�J�J�~�.�3��"�1�"�
����Q�q�!�
r'c�V�|r||_	|j|�|r|`SS#|r|`wwxYwrO)�_framer{)rGr4rzr�s    r(�_fIdentzBaseDocTemplate._fIdentzs/���U�!�(�	#��:�:�f�%��!�(�u��u�!�(�u�s�!�(c	��|j|�|d}|r'|j|�|j|�|d}|d=|�yt|t�r�|j
}|r>|j
|�s-t|�}|j|�|j|�t|t�r|jd��n|j�|j|�yt|t�r#|j|�|j|�y|j}|j}|j|||j ��rCt|t"�s&|xj$dz
c_|j|�t'||�y|j r|j)||�}t+|�}nd}|r�tdtttt,f�s�|j|d|d��sCd||j.|j1|d|�|j1|dd|�fz}t3|��|xj$dz
c_|j|d�|dd|ddt'||�y||ddyt5|d�rzd	|j1|d|�t7|�|j.|jj8|jj;�|j<j8fz}t3|��d|_tA|d
d�}	|	r|	tB|df�|jEd|�|jG�y)z<try to handle one flowable from the front of list flowables.rNrJ)r�)�trySplitz/Splitting error(n==%d) on page %d in
%s
S[0]=%s�<�
_postponedz?Flowable %s%s too large on page %d in frame %r%s of template %rr�)$�filterFlowablesr�r�r�r�r�r�rrt�
afterFlowable�
SlowPageBreakr�rr�r�rr$rrVr��splitrK�
DDIndenterrsr�r	r3r8r��
_aSpaceStringrrr�r2rr�r�)
rGr�r4r�r�r�r�r�r�r�s
          r(rkzBaseDocTemplate.handle_flowable�s��
	
���Y�'��a�L����#�#�I�.��$�$�Y�/��!��A��a�L��9���a�	�"��.�.�C��4�<�<��,�$�S�)���	�	�$���"�"�3�'��!�M�*��%�%�1�%�-��%�%�'����q�!�
��.�
)�
�G�G�D�M����q�!��J�J�E��9�9�D��y�y��D�4�+>�+>�y�?�!�!�$7�8��.�.�!�3�.��&�&�q�)�$�Y�u�5��&�&����A�d�+�A��A��A��A��%�a��d�I�m�N�S]�+^�_�$�y�y��1��t�a�y�@�$W�[\�]a�]f�]f�gk�gs�gs�tu�vx�y~�g�AE�AM�AM�NO�PQ�NR�SU�V[�A\�[]�%]�E�"-�e�"4�4��2�2�a�7�2��*�*�1�Q�4�0�)*�1�2��	�!�A��,�Y�u�=�)*�	�!�A���q��.� a�!%���a��5�!9�,�q�/�$�)�)�UY�U_�U_�Ub�Ub�(,�
�
�(@�(@�(B�D�DU�DU�DX�DX�!Z�!Z��*�%�0�0�#$�A�L�!�$�'9�$�?�C���W�Q�|�4�5��$�$�Q�q�)��(�(�*r'c�b�tjjj�|_||xs|j
|j|j|j|j|j|j|j|j|j|j|j |j"��
}t%|dd��|j&�|j(|_|j-|j.�|j1|j2�|j5|j6�|j9|j:�|j=|j>�|jA|jB�ddl"m#}m$}|jJjM�D]I\}}t%||djO�|ddzd�}|��-||urdd	g|}|jQ||��K|jRr|jU|jR�|S)
amake and return a sample canvas. As suggested by 
        Chris Jerdonek cjerdonek @ bitbucket this allows testing of stringWidths
        etc.

        *NB* only the canvases created in self._startBuild will actually be used
        in the build process.
        )r�r+r,r2r5r6r7r�r�r�r�r4�
setEncryptc��yrOr&)r�s r(�<lambda>z-BaseDocTemplate._makeCanvas.<locals>.<lambda>�s�r'r)�ViewerPreferencesPDFDictionary�checkPDFBooleanrJN�false�true)+�	reportlab�lib�	sequencer�	Sequencer�seqrHr�r+r,r2r5r6r7r�r�r�r�r4r2r0r1�
_cropMarks�	setAuthorr&�setTitler%�
setSubjectr'�
setCreatorr(�setProducerr)�setKeywordsr*�reportlab.pdfbase.pdfdocr�r��validate�items�lower�setViewerPreferencerSrf)	rGrH�canvasmakerr��VPD�cPDFBr^�vfrLs	         r(�_makeCanvaszBaseDocTemplate._makeCanvas�s����=�=�*�*�4�4�6����8�4�t�}�}�%)�]�]�&*�n�n�,0�,@�,@�.2�.D�.D�.2�.B�.B�.2�.B�.B�-1�-@�-@�&*�l�l�%)�[�[�&*�l�l�'+�}�}�#'�9�9�
��	2���\�.�1�$�,�,�?��.�.������t�{�{�#��
�
�d�j�j�!�������%�������%�������'�������'�	��L�L�&�&�(�	.�D�A�b���Q�q�T�Z�Z�\�!�A�B�%�/��5�A��}���;� ��(��+�A��(�(��1�-�	.��<�<�� � ����.��r'c�t�|j�|j||��|_|j�y)N)rHr�)r\r�r�ru)rGrHr�s   r(�_startBuildzBaseDocTemplate._startBuilds.���
�
���$�$�h�;�$�O��	��!�!�#r'c��|jd�|jgk7r3|jdtur|jd=|j�n |j�|j	�t|dd�r|jj�|jr|jjd�yy)N)�buildrsr�r��_doSaverJ)
r�rjrrlr�r2r��saverSrfrPs r(�	_endBuildzBaseDocTemplate._endBuild
s������1�2��=�=�"�����r�!2�i�!?��
�
�b�!���� ���� ��!�!�#��4�	�!�$�d�i�i�n�n�&6��<�<����2�2�4�8�<r'c
��t|�}|jr-|jdd�|jdt|��|j||�|j}|jj
|_d}	||_t|�r�|jry|jdturdt|dt�rQ|dj}|r=|j|�s,t|�}|j|�|j!�|d=|j#�	|d}|j%|�|dz
}|jr|jd|t|�z
�t|�r��|`|j|j_|j?�|jr|jd	d�y
y
#t'd�r�|j(r�t+j,�d}	t/|	j0�}
|j(}|
dxxd|j2|j4|j6|j8|j:fzz
cc<t=|
�|	_�xYw#|`wxYw)a�Build the document from a list of flowables.
           If the filename argument is provided then that filename is used
           rather than the one provided upon initialization.
           If the canvasmaker argument is provided then it will be used
           instead of the default.  For example a slideshow might use
           an alternate canvas which places 6 slides on a page (by
           doing translations, scalings and redefining the page break
           operations).
        �STARTEDr�SIZE_ESTr�rJ�
_traceInfoz1
(srcFile %s, line %d char %d to line %d char %d)�PROGRESS�FINISHEDN) rKrTr�r��_doc�info�
_savedInfo�_doctemplaterjrr��PageBreakIfNotEmptyr�r�rrtrqrlrkr3r��sys�exc_infor@rE�srcFile�startLineNo�startLinePos�	endLineNo�
endLinePosrir�)rGr�rHr��
flowableCountr��handledr�r��excrE�trs            r(r�zBaseDocTemplate.builds"���I��
�������Y�q�)����Z��Y��8�����+�.��y�y���)�)�.�.�����!	"� $�D���i�.��=�=�T�]�]�2�%6�)�%C�
�S\�]^�S_�`s�Ht�#�A�,�3�3�C��4�<�<��#4�,�S�1���	�	�$���-�-�/�!�!���"�"�$��%�a�L�E��(�(��3��q�L�G� �#�#��$�$�Z�
��I��0N�O�;�i�.�>�!�����	�	������������Z��*���3��u�l�3��8H�8H�!�l�l�n�Q�/��#�C�H�H�~��"�-�-���Q��#W��J�J��N�N��O�O��L�L��M�M�[�$���$)��;������!�s&�B'I4�)G�5I4�B*I1�1I4�4I8c�V�d}|jD]}|j�r�d}|S|S)z:Called by multi-build - are all cross-references resolved?rJr)rRrX)rG�allHappyr4s   r(�
_allSatisfiedzBaseDocTemplate._allSatisfiedXs9�����(�(�	�A��=�=�?������		��r'c��|jD]@}t|d|�}	||k(r|j|_|j	||�||k(s�?|`�By#||k(r|`wwxYw)zForward to any listeners�_canvN)rRr2r�rr\)rGrZr[�lrs     r(r\zBaseDocTemplate.notifyask���(�(�	 �A��A�g�d�+�E�
 ��$�;�"�i�i�A�G�����u�%��$�;���	 ���$�;����s�(A�
Ac�v�trtd||jfz�|j|j|<y)zhook to register a page numberz)pageRef called with label '%s' on page %dN)r�printrsrQ)rGr�s  r(�pageRefzBaseDocTemplate.pageRefms5���E�E��4�9�9�I��� $�	�	����u�r'c��g|_|D].}|j�s�|jj|��0d|_d}g}|j|_	|dz
}|j
r|jd|�tr.tjjdt|�zdz�|jD]}|j��|dd}|j|fi|��|jD]}|j��|j�}	|	r"d|_|jj!�n6||kDrt#d|z��|r|j%d�}
|
d|
dd�|r���|`trt'd�|S)	zgMakes multiple passes until all indexing flowables
        are happy.

        Returns number of passesrrJ�PASSzbuilding pass z...Nz*Index entries not resolved after %d passes�saved)rRrUrr�r�rTrr��stdout�writerxr_r�rbr	r�r��
IndexError�popr)rG�story�	maxPasses�	buildKwds�thing�passesr��fl�	tempStory�happy�es           r(�
multiBuildzBaseDocTemplate.multiBuildss���#%����	6�E����!��'�'�.�.�u�5�	6�
������� #�
�
�����a�K�F����� � ���0���
�
�(�(�)9�#�f�+�)E��)M�N��-�-�
!����� �
!��a��I��D�J�J�y�.�I�.��-�-�
 ���
�
��
 ��&�&�(�E�� ����	�	��� ���	�!� �!M�PY�!Y�Z�Z���G�G�A�J����!��a���e���7�>
�!��E�'�N��
r'c��y)z6This is called after initialisation of the base class.Nr&rPs r(r]zBaseDocTemplate.afterInit�rcr'c��y)zEThis is called before any processing is
        done on the document.Nr&rPs r(rtzBaseDocTemplate.beforeDocument�r`r'c��y)z�This is called at the beginning of page
        processing, and immediately before the
        beforeDrawPage method of the current page
        template.Nr&rPs r(r|zBaseDocTemplate.beforePage�r�r'c��y)z�This is called after page processing, and
        immediately after the afterDrawPage method
        of the current page template.Nr&rPs r(r�zBaseDocTemplate.afterPage�r]r'c��y)z�called to filter flowables at the start of the main handle_flowable method.
        Upon return if flowables[0] has been set to None it is discarded and the main
        method returns.
        Nr&)rGr�s  r(r�zBaseDocTemplate.filterFlowables�r�r'c��y)z)called after a flowable has been renderedNr&)rG�flowables  r(r�zBaseDocTemplate.afterFlowable�rcr')rsr�r��foreverc���t|t�st|�}|j�}|j�}|j	|j��d|j��d�|�y)Nz=(r1)r�r rx�strip�docExec)rG�var�expr�lifetimes    r(�	docAssignzBaseDocTemplate.docAssign�sI���$�x�(�s�4�y�$�
�Z�Z�\���I�I�K������	�	��D�J�J�L�9�(�Cr'c���|j�}|j}t|j��}	||jvrtd|�d|j����t
||�|j|j�D�cgc]	}||vs�|��c}|�y#|D�cgc]	}||vs�|��ncc}w}}|D]}||=�td|�d|�d��Y�nxYwcc}w)Nz
bad lifetime z not in z	
docExec z
 lifetime=z	 failed!
)	r*rJr@rM�_allowedLifetimesrO�execr�_addVars)rG�stmtr.�NS�K0r^�K1s       r(r+zBaseDocTemplate.docExec�s���
�Z�Z�\���?�?������	�?��	V��t�5�5�5� �h�t�G]�G]�!^�_�_���r�N�	
�
�
�"�'�'�)�;�Q�q��{�q�;�H�E��	V��/��1�B�;�!�/��/�B�/��
���q�E�
��d�8�T�U��;s)�5B �		C�C� C�&	B5�0B5�4$Cc���|j}|D]W}|j�D]}||vs�|j|��|j|t	g��j|��Yy)z*add namespace variables to lifetimes listsN)rK�values�remove�
setdefault�setr)rG�varsr.�LTr,rLs      r(r3zBaseDocTemplate._addVars�s`���?�?���	5�C��Y�Y�[�
"���!�8��H�H�S�M�
"�
�M�M�(�3�r�7�+�/�/��4�		5r'c��|j}|j}|D] }|j|g�D]}	||=�||=�"y#t$rY�wxYw)z9remove namespace variables for with lifetime in lifetimesN)rKrJr;�KeyError)rG�	lifetimesr>r5r.r^s      r(r�zBaseDocTemplate._removeVars�sf���?�?���?�?��!�	�H��]�]�8�B�/�
����1��
�
�8��
	�� ����s�?�	A�
Ac�x�	t|j�i|j�S#td|z�YyxYw)Nz
docEval %s failed!
)�evalr*rJr)rGr-s  r(�docEvalzBaseDocTemplate.docEval�s5��	?���
�
��R����8�8��	?��6��=�>�s�$'�9rO)rNr�)NN)rG)@r#r$r%rdrr�KeepTogetherrLrNrprhr\rfrhrlrPrur~rqr�r�r�r}r�rmr�r�r�r�r�r�r�rk�_handle_documentBegin�_handle_pageBegin�_handle_pageEnd�_handle_frameBegin�_handle_frameEnd�_handle_flowable�_handle_nextPageTemplate�_handle_currentFrame�_handle_nextFramer�Canvasr�r�r�r�r	r\rr r]rtr|r�r�r�r1r/r+r3r�rDr&r'r(rr�s$��6�n-�J��-�#�B�-�"�1�-�!��-�"�$�	-�
 ��-�#�4�
-�%�Q�-��D�-��T�-��d�-��d�-��t�-��r�-� ��-�&�d�-� &�a�!-�"�q�#-�$�Q�%-�&�t�'-�( ��)-�*(��+-�,&�t�--�.�D�/-�0&�t�1-�2&�t�3-�4%�d�5-�6�t�7-�8�d�9-�:�t�;-�<��=-�>(��?-�@"�4�A-�B"�4�C-�D%)�!%�$(�-1�!%� $� $�!%�!%�$(�"�Y-�I�\����,�\:�� �0�
)�	�H�$	P�C�!(�F'�
5�)�0#O�JO�>S�&G�%�
�8"�,#�G+�T1��(��$�O�*��&��&��6��.��(��#'�V�]�]�.�`$(�V�]�]�$�

9�)-�&�-�-�@+�D�
 �*� "�4�t
�
�

�
�
�
�9��D�
F�5�
�?r'rc�<�eZdZdZdZd�Zeeejfd�Z	y)ra�A special case document template that will handle many simple documents.
       See documentation for BaseDocTemplate.  No pageTemplates are required
       for this special case.   A page templates are inferred from the
       margin information and the onFirstPage, onLaterPages arguments to the build method.

       A document which has all pages with the same look except for the first
       page may can be built using this special approach.
    )rc�F�|j�|jd�y)zSoverride base method to add a change of page template after the firstpage.
        �LaterN)rGrLrPs r(r~z"SimpleDocTemplate.handle_pageBegin
s��	
��� ��%�%�g�.r'c	��|j�t|j|j|j|j
d��}|j
td|||j��td|||j��g�|tur*t|d�r|j|jd_
|tur*t|d�r|j|jd	_
tj!|||�
�y)a[build the document using the flowables.  Annotate the first page using the onFirstPage
               function and later pages using the onLaterPages function.  The onXXX pages should follow
               the signature

                  def myOnFirstPage(canvas, document):
                      # do annotations and modify the document
                      ...

               The functions can do things like draw logos, page numbers,
               footers, etcetera. They can use external variables to vary
               the look (for example providing page numbering or section names).
        �normal)r��First)r�r�r�r�rR�onFirstPager�onLaterPagesrJ)r�N)r\rr r#r*r,rPrr�r;r3rVrr�rWrr�)rGr�rVrWr��frameTs      r(r�zSimpleDocTemplate.builds���	
�
�
���t����(9�(9�4�:�:�t�{�{�W_�`�����|�w�f�[�bf�bo�bo�p�$��v�l�\`�\i�\i�j�l�	m��*�$���m�)D�37�3C�3C�D���q�!�0��:�%�'�$�~�*F�37�3D�3D�D���q�!�0����d�9�+��Fr'N)
r#r$r%rdrNr~r;rrOr�r&r'r(rr�s*���*��/�*4�*�Z`�Zg�Zg�Gr'rc�$�td||fz�y)aMExample prototype for progress monitoring.

    This aims to provide info about what is going on
    during a big job.  It should enable, for example, a reasonably
    smooth progress bar to be drawn.  We design the argument
    signature to be predictable and conducive to programming in
    other (type safe) languages.  If set, this will be called
    repeatedly with pairs of values.  The first is a string
    indicating the type of call; the second is a numeric value.

    typ 'STARTING', value = 0
    typ 'SIZE_EST', value = numeric estimate of job size
    typ 'PASS', value = number of this rendering pass
    typ 'PROGRESS', value = number between 0 and SIZE_EST
    typ 'PAGE', value = page number of page
    type 'FINISHED', value = 0

    The sequence is
        STARTING - always called once
        SIZE_EST - always called once
        PROGRESS - called often
        PAGE - called often when page is emitted
        FINISHED - called when really, really finished

    some juggling is needed to accurately estimate numbers of
    pages in pageDrawing mode.

    NOTE: the SIZE_EST is a guess.  It is possible that the
    PROGRESS value may slightly exceed it, or may even step
    back a little on rare occasions.  The only way to be
    really accurate would be to do two passes, and I don't
    want to take that performance hit.
    zPROGRESS MONITOR:  %-10s   %dN)r)�typr�s  r(�
progressCBr['s��D
�
)�S�%�L�
8�9r'�__main__)�
_baseFontName�_baseFontNameBc��ddlm}|jd}|j�|j|�|j
d�|jddd|dz
�|jtd�|jd|dz
d	�|jtd
�|jdtzdtzd
�|j�y)Nr��redrJ��B�H��lzTABLE OF CONTENTS DEMO����?z
First Page)
�reportlab.lib.colorsrar��	saveState�setStrokeColor�setLineWidth�line�setFontr^�
drawStringr]r�restoreState�rr:ra�PAGE_HEIGHTs    r(�myFirstPagertMs���,��&�&�q�)�����������c�"�����A������B�r�"�[��^�,�����~�b�)�����#�{�3��0H�I�����}�R�(�����!�d�(�D�4�K��>�����r'c�v�ddlm}|jd}|j�|j|�|j
d�|jddd|dz
�|jtd�|jdtzd	tzd
|jz�|j�y)Nrr`rJrbrcrdrgrhrizPage %d)
rjrar�rkrlrmrnror]rprrsrqrrs    r(�myLaterPagesrvZs���,��&�&�q�)�����������c�"�����A������B�r�"�[��^�,�����}�R�(�����!�d�(�D�4�K��S�X�X�1E�F�����r'c��g}ddlm}ddlm}|d�}d|_d|_ddlm}ddl}td�D]i}d	d
|j�zz}tdtz|tzd|z�}|j|�t|�|�}	|j|	��k|d�j|tt �
�y)Nr)�ParagraphStyle)rrT��)�
randomText�g�?�z
Box Number %dzdoctemplate.pdf)rVrW)�reportlab.lib.stylesrx�reportlab.platypus.doctemplater�firstLineIndent�spaceBefore�reportlab.lib.randomtextr{�random�range�XBoxrrrr�rtrv)
�objects_to_drawrxrrTr{r�r�r,r��paras
          r(�runr�es�����7�D� ��)��!#������7���r��	)�A��A�f�m�m�o�-�.�F��q�4�x��$���!�0C�D�C��"�"�3�'��Z�\�6�2�D��"�"�4�(�	)�	�+�,�2�2�?�#��	3�	?r')E�__all__�__version__rd�reportlab.platypus.flowablesr�reportlab.lib.unitsr�reportlab.platypus.paragraphr�reportlab.platypus.framesr�reportlab.rl_configrr�reportlab.lib.sequencerr��reportlab.pdfgenr�reportlab.lib.utilsrrrrr r<�	NameError�setsr!r��logging�	getLoggerry�	Exceptionr	r8r;r@r=rgrrrr
rrr�rrr�rrr
rrr�rxr�rrrrr[r#r~r]r^rtrvr�r&r'r(�<module>r�s���
��&
��	��0+�8�$�2�+�8��#�^�^� ����	��	�	�/�	0��	�)�	��(	��d��&
�x�
�4%M�X�%M�N
��
�
	^�~�	^�>��>�
A�+�A�
��
�'�"�'� ��
$�
��[�)�	�
�v�(�v�.�"�.�"S�+�S�>�~�>�?
�?
�B%�	:��	:�=8�=8�~a�V
?�V
?�p&G��&G�P":�H�z��B��	�?�,�E�a��](� ��� �s�E0�0E?�>E?

Zerion Mini Shell 1.0