Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 ©«jCã @sŽUddlZddlZddlZddlmZddlmZmZmZm Z m Z m Z m Z m Z mZmZmZddlmZmZddlmZmZmZmZmZmZmZddlmZddlmZ dd lm!Z"dd lm#Z$dd l%m&Z&dd l'm(Z(dd l)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5d.a6e76d/a8e78ga9e e79d0ee:e7dfee:e7dfee:e e7dfee7e7e e7fdœdd„Z;ee:e e:e3dœdd„Zfddœdd„Z?ee:ee3e>fddœdd„Z@ee:ddœdd„ZAee:ddœdd„ZBe:e e:eCd œd!d"„ZDe:e e:eCd œd#d$„ZEGd%d&„d&ƒZFGd'd(„d(e,ƒZGGd)d*„d*ƒZHd1e,e e e:e e e:ee e:e e:fd+œd,d-„ZIdS)2éN)ÚDecimal) ÚAnyÚCallableÚDictÚIterableÚIteratorÚListÚOptionalÚSetÚTupleÚUnionÚcasté)Úbuild_char_mapÚunknown_char_map)ÚCompressedTransformationMatrixÚFileÚTransformationMatrixTypeÚdeprecate_no_replacementÚdeprecate_with_replacementÚlogger_warningÚmatrix_multiply)ÚAnnotationDictionaryAttributes)ÚImageAttributes)ÚPageAttributes)Ú Ressources)ÚPageSizeNotDefinedError)Ú_xobj_to_image) Ú ArrayObjectÚ ContentStreamÚDictionaryObjectÚEncodedStreamObjectÚ FloatObjectÚIndirectObjectÚ NameObjectÚ NullObjectÚ NumberObjectÚRectangleObjectÚTextStringObjectÚencode_pdfdocencoding)Ú_minÚ_maxÚspecialsÚreturncCsvt|tƒr|ant|tƒr"t|ƒat|tƒr2|ant|tƒrDt|ƒat|tƒr^dd„|Dƒant|tƒrl|atttfS)aê changes the Right-To-Left and special characters customed parameters: _min -> CUSTOM_RTL_MIN : None does not change the value ; int or str(converted to ascii code) ; -1 by default _max -> CUSTOM_RTL_MAX : None does not change the value ; int or str(converted to ascii code) ; -1 by default those values define a range of custom characters that will be written right to left ; [-1;-1] set no additional range to be converter specials -> CUSTOM_RTL_SPECIAL_CHARS: None does not change the current value; str to be converted to list or list of ascii codes ; [] by default list of codes that will inserted applying the current insertion order ; this consist normally in a list of punctuation characters cSsg|] }t|ƒ‘qS©)Úord)Ú.0Úxr.r.ú./tmp/pip-build-vnmlutbd/PyPDF2/PyPDF2/_page.pyú nsz"set_custom_rtl..)Ú isinstanceÚintÚCUSTOM_RTL_MINÚstrr/ÚCUSTOM_RTL_MAXÚCUSTOM_RTL_SPECIAL_CHARSÚlist)r*r+r,r.r.r2Úset_custom_rtlTs      r;)ÚselfÚnameÚdefaultsr-cCsp|j|ƒ}t|tƒr|S|dkrBx |D]}|j|ƒ}|dk r&Pq&Wt|tƒrX|jj|ƒ}t|ƒ}t|||ƒ|S)N)Úgetr4r'r#ÚpdfÚ get_objectÚ_set_rectangle)r<r=r>ÚretvalÚdr.r.r2Ú_get_rectanglets       rEcCstdƒt|||ƒS)NÚ getRectangle)rrE)r<r=r>r.r.r2rF„srF)r<r=Úvaluer-cCst|ƒ}|||<dS)N)r$)r<r=rGr.r.r2rB‹srBcCstdƒt|||ƒdS)NÚ setRectangle)rrB)r<r=rGr.r.r2rH�srH)r<r=r-cCs ||=dS)Nr.)r<r=r.r.r2Ú_delete_rectangle—srIcCstdƒ||=dS)NÚdeleteRectangle)r)r<r=r.r.r2rJ›srJ)r=Úfallbackr-cs&t‡‡fdd„‡fdd„‡fdd„ƒS)Ncs t|ˆˆƒS)N)rE)r<)rKr=r.r2Ú¢sz,_create_rectangle_accessor..cs t|ˆ|ƒS)N)rB)r<rG)r=r.r2rL£scs t|ˆƒS)N)rI)r<)r=r.r2rL¤s)Úproperty)r=rKr.)rKr=r2Ú_create_rectangle_accessor s  rNcCstdƒt||ƒS)NÚcreateRectangleAccessor)rrN)r=rKr.r.r2rO¨srOc@sÖeZdZdZdedœdd„Zeedœdd „ƒZe eed œd d „ƒZ de e dd œdd„Z de e e e ddœdd„Ze ddœdd„Zedœdd„Zeeeefee e fee feee e fee fdœdd„ZdS) ÚTransformationuí Specify a 2D transformation. The transformation between two coordinate systems is represented by a 3-by-3 transformation matrix written as follows:: a b 0 c d 0 e f 1 Because a transformation matrix has only six elements that can be changed, it is usually specified in PDF as the six-element array [ a b c d e f ]. Coordinate transformations are expressed as matrix multiplications:: a b 0 [ x′ y′ 1 ] = [ x y 1 ] × c d 0 e f 1 Usage ----- >>> from PyPDF2 import Transformation >>> op = Transformation().scale(sx=2, sy=3).translate(tx=10, ty=20) >>> page.add_transformation(op) rr)ÚctmcCs ||_dS)N)rQ)r<rQr.r.r2Ú__init__ÎszTransformation.__init__)r-cCs@|jd|jddf|jd|jddf|jd|jddffS)Nrréééé)rQ)r<r.r.r2ÚmatrixÑszTransformation.matrix)rWr-cCs@|dd|dd|dd|dd|dd|ddfS)NrrrSr.)rWr.r.r2ÚcompressÙs      zTransformation.compress)ÚtxÚtyr-cCs<|j}t|d|d|d|d|d||d|fd�S)NrrrSrTrUrV)rQ)rQrP)r<rYrZÚmr.r.r2Ú translateäszTransformation.translateN)ÚsxÚsyr-cCsx|dkr|dkrtdƒ‚|dkr$|}|dkr0|}|dk s„Z.dee&dd?œd@dA„Z/d§dee&e0fe*ddBœdCdD„Z1d¨de e*ddEœdFdG„Z2d©de e*ddHœdIdJ„Z3dªde e e*ddKœdLdM„Z4d«de e e e*ddNœdOdP„Z5d¬de e e*ddQœdRdS„Z6d­de e e e*ddTœdUdV„Z7d®de e e e e*ddWœdXdY„Z8d¯ee0e&fe*ddZœd[d\„Z9e&dd]œd^d_„Z:e e dd`œdadb„Z;e ddcœddde„Ze e ddhœdkdl„Z?ddœdmdn„Z@ddœdodp„ZAd°e!e!e!drœdsdt„ZBe!dœdudv„ZCd±d{eDjEdddfeeeed|fe ee!ee-eeeegdfee-eeeegdfee-eeeeegdfe!d}œ d~d„ZFddd²d{dddd€œee!e!eeeed|ffe ee-eeeegdfee-eeeegdfee-eeeeegdfe!d�œ d‚dƒ„ZGd´eHeed|fe ee-eeeegdfee-eeeegdfee-eeeeegdfe!d…œd†d‡„ZIdµe!e!e!drœdˆd‰„ZJeeKe!eKe!fdœdŠd‹„ZLeMeDjNfƒZOeePdœdŒd�„ƒZQeQj ePdd œdŽd�„ƒZQeMd�eDjNfƒZReePdœd�d‘„ƒZSeSj ePdd œd’d‘„ƒZSeMd“d�eDjNfƒZTeePdœd”d•„ƒZUeUj ePdd œd–d•„ƒZUeMd—d�eDjNfƒZVeePdœd˜d™„ƒZWeWj ePdd œdšd™„ƒZWeMd›d�eDjNfƒZXeePdœdœd�„ƒZYeYj ePdd œdžd�„ƒZYeeeZdœdŸd „ƒZ[e[j eeZdd œd¡d „ƒZ[‡Z\S)¶Ú PageObjecta! PageObject represents a single page within a PDF file. Typically this object will be created by accessing the :meth:`get_page()` method of the :class:`PdfReader` class, but it is also possible to create an empty page with the :meth:`create_blank_page()` static method. :param pdf: PDF file the page belongs to. :param indirect_reference: Stores the original indirect reference to this object in its source PDF N)r@Úindirect_referenceÚ indirect_refr-cCsNddlm}tj|ƒ||_|dk rDtjdtƒ|dk r@tdƒ‚|}||_ dS)Nr)Ú PdfReaderz/Use indirect_reference instead of indirect_ref.) Z_readerrxr rRr@ÚwarningsÚwarnÚDeprecationWarningr_rv)r<r@rvrwrxr.r.r2rR#s  zPageObject.__init__)r-cCstjdtƒ|jS)Nz/Use indirect_reference instead of indirect_ref.)ryrzr{rv)r<r.r.r2rw6szPageObject.indirect_ref)rGr-cCs ||_dS)N)rv)r<rGr.r.r2rw=scstƒjƒ}|dt|ƒ7}|S)Ns%d)ÚsuperÚhash_value_dataÚid)r<Údata)Ú __class__r.r2r}As zPageObject.hash_value_datacCs|jtjdƒS)a A read-only positive number giving the size of user space units. It is in multiples of 1/72 inch. Hence a value of 1 means a user space unit is 1/72 inch, and a value of 3 means that a user space unit is 3/72 inch. r)r?ÚPGZ USER_UNIT)r<r.r.r2Ú user_unitFs zPageObject.user_unit)r@ÚwidthÚheightr-cCs¸t|ƒ}|jttjƒtdƒƒ|jttjƒtƒƒ|jttjƒtƒƒ|dksV|dkr–|dk r’t |j ƒdkr’|j t |j ƒd}|j j }|j j }nt‚|jttjƒtdd||fƒƒ|S)a# Return a new blank page. If ``width`` or ``height`` is ``None``, try to get the page size from the last page of *pdf*. :param pdf: PDF file the page belongs to :param float width: The width of the new page expressed in default user space units. :param float height: The height of the new page expressed in default user space units. :return: the new blank page :raises PageSizeNotDefinedError: if ``pdf`` is ``None`` or contains no page z/PageNrr)ruÚ __setitem__r$r�ZTYPEZPARENTr%Ú RESOURCESr ÚlenZpagesÚmediaboxrƒr„rÚMEDIABOXr')r@rƒr„ÚpageZlastpager.r.r2Úcreate_blank_pageQs zPageObject.create_blank_pagecCstddƒtj|||ƒS)z\ .. deprecated:: 1.28.0 Use :meth:`create_blank_page` instead. ÚcreateBlankPager‹)rrur‹)r@rƒr„r.r.r2rŒys zPageObject.createBlankPagecCsŽg}tj|tjkr|S|tjtjjƒ}x\|D]T}||tjdkr2t||ƒ\}}|dk r2|dd…›|›�}|jt ||d�ƒq2W|S)zî Get a list of all images of the page. This requires pillow. You can install it via 'pip install PyPDF2[image]'. For the moment, this does NOT include inline images. They will be added in future. z/ImageNr)r=r) ÚRESÚXOBJECTr�r†rAÚIAZSUBTYPErÚappendr)r<Zimages_extractedZx_objectÚobjÚ extensionZ byte_streamÚfilenamer.r.r2Úimages‡s  zPageObject.imagescCst|jtjdƒƒS)zª The VISUAL rotation of the page. This number has to be a multiple of 90 degrees: 0,90,180,270 This property does not affect "/Contents" r)r5r?r�ÚROTATE)r<r.r.r2rcžszPageObject.rotation)Úrr-cCs*tt|ƒddddƒ|ttjƒ<dS)Né-éZih)r&r5r$r�r•)r<r–r.r.r2rc¨sc Cs.|j }d|_t|jƒ}tƒjt|j|jdƒ t|j|j dƒ ƒj |ƒ}|j |j ƒ}|j |j ƒ}|jt|d|dƒ t|d|dƒ ƒ}|j|dƒxˆd D]€}||kr¦t||ƒ}|j |j ƒ}|j |j ƒ}tt|d|dƒt|d|dƒt|d|dƒt|d|dƒfƒ|t|ƒ<q¦Wd S) z£ Apply the rotation of the page to the content and the media/crop/... boxes. It's recommended to apply this function before page merging. rrSrFú /MediaBoxú/CropBoxú /BleedBoxú/TrimBoxú/ArtBoxN)r™ršr›rœr�)rcr'rˆrPr\rlÚleftrƒÚbottomr„rhrnÚ lower_leftÚ upper_rightÚminÚadd_transformationÚmaxr$)r<r–ÚmbZtrsfrmZpt2ÚbZrrr.r.r2Útransfer_rotation_to_content¬s( ,  ,     z'PageObject.transfer_rotation_to_content)Úangler-cCsR|ddkrtdƒ‚|jtjdƒ}t|tƒr0|n|jƒ}t||ƒ|ttjƒ<|S)z¨ Rotate a page clockwise by increments of 90 degrees. :param int angle: Angle to rotate the page. Must be an increment of 90 deg. r˜rz'Rotation angle must be a multiple of 90) r_r?r�r•r4r5rAr&r$)r<r¨Z rotate_objZ current_angler.r.r2rhÎs  zPageObject.rotatecCstddƒ|j|ƒS)NÚrotate_clockwiserh)rrh)r<r¨r.r.r2r©Þs zPageObject.rotate_clockwisecCstddƒ|j|ƒS)z[ .. deprecated:: 1.28.0 Use :meth:`rotate_clockwise` instead. ÚrotateClockwiserh)rrh)r<r¨r.r.r2rªâs zPageObject.rotateClockwisecCstddƒ|j| ƒS)zt .. deprecated:: 1.28.0 Use :meth:`rotate_clockwise` with a negative argument instead. ÚrotateCounterClockwiserh)rrh)r<r¨r.r.r2r«ës z!PageObject.rotateCounterClockwise)Úres1Úres2Úresourcer-cCs´tƒ}|j|j|tƒƒjƒƒtt|j|tƒƒjƒƒ}i}xpt|jƒƒD]`}||kr’|j|ƒ|j|ƒkr’t|t t j ƒƒƒ}|||<||||<qH||krH|j|ƒ||<qHW||fS)N) r Úupdater?rAr r:ÚkeysZraw_getr$r7ÚuuidÚuuid4)r¬r­r®Znew_resZpage2resZ rename_resÚkeyZnewnamer.r.r2Ú_merge_resourcesôszPageObject._merge_resources)ÚstreamÚrenamer@r-cCs¼|s|St||ƒ}x¤|jD]š\}}t|tƒrfx†tt|ƒƒD]&}||}t|tƒr:|j||ƒ||<q:Wqt|tƒr¢xB|D]&}||}t|tƒrv|j||ƒ||<qvWqt dt |ƒ›�ƒ‚qW|S)Nztype of operands is ) rÚ operationsr4r:Úranger‡r$r?ÚdictÚKeyErrorÚtype)rµr¶r@ÚoperandsÚ _operatorÚirar.r.r2Ú_content_stream_renames       z!PageObject._content_stream_rename)Úcontentsr@r-cCs0t||ƒ}|jjdgdfƒ|jjgdfƒ|S)NrÚqÚQ)rr·Úinsertr�)rÀr@rµr.r.r2Ú _push_pop_gss zPageObject._push_pop_gs)rÀr@rQr-c CsT|\}}}}}}t||ƒ}|jjdt|ƒt|ƒt|ƒt|ƒt|ƒt|ƒgdgƒ|S)Nrz cm)rr·rÃr") rÀr@rQÚar¦ÚcrDÚeÚfr.r.r2Ú_add_transformation_matrix's z%PageObject._add_transformation_matrixcCs tj|kr|tjjƒSdSdS)zÆ Access the page contents. :return: the ``/Contents`` object, or ``None`` if it doesn't exist. ``/Contents`` is optional, as described in PDF Reference 7.7.3.3 N)r�ÚCONTENTSrA)r<r.r.r2Ú get_contents?s zPageObject.get_contentscCstddƒ|jƒS)zW .. deprecated:: 1.28.0 Use :meth:`get_contents` instead. Ú getContentsrË)rrË)r<r.r.r2rÌKs zPageObject.getContentsF)Úpage2Úexpandr-cCs|j||d�dS)a£ Merge the content streams of two pages into one. Resource references (i.e. fonts) are maintained from both pages. The mediabox/cropbox/etc of this page are not altered. The parameter page's content stream will be added to the end of this page's content stream, meaning that it will be drawn after, or "on top" of this page. :param PageObject page2: The page to be merged into this one. Should be an instance of :class:`PageObject`. :param bool expand: If true, the current page dimensions will be expanded to accommodate the dimensions of the page to be merged. )rÎN)Ú _merge_page)r<rÍrÎr.r.r2Ú merge_pageTszPageObject.merge_page)rÍr-cCstddƒ|j|ƒS)zU .. deprecated:: 1.28.0 Use :meth:`merge_page` instead. Ú mergePagerÐ)rrÐ)r<rÍr.r.r2rÑes zPageObject.mergePage)rÍÚpage2transformationrQrÎr-cCsttƒ}i}ytt|tjjƒƒ}Wntk r<tƒ}YnXytt|tjjƒƒ}Wntk rptƒ}YnXtƒ} xF||fD]:} tj| kr‚| tj} t| tƒr‚x| D]} | j | ƒqªWq‚WxTt j t j t j t jt jt jt jfD]0} tj||| ƒ\}}|râ||t| ƒ<|j|ƒqâWtt|jt jtƒƒjƒƒjt|jt jtƒƒjƒƒƒƒ|tt jƒ<tƒ}|jƒ}|dk �r‚|j tj||jƒƒ|jƒ}|dk �r,t||jƒ}|j}|jj dt!t"|j#|j$|j%|j&gƒdfƒ|jj dgdfƒ|jj dgdfƒ|dk �r||ƒ}tj'|||jƒ}tj||jƒ}|j |ƒ|�r>|j(||ƒt||jƒ|ttj)ƒ<||ttjƒ<| |ttjƒ<dS)NrÚrerÚWrSÚn)*r r r�r†rArºrÚANNOTSr4r�r�Z EXT_G_STATEZFONTrŽZ COLOR_SPACEZPATTERNZSHADINGZ PROPERTIESrur´r$r¯Ú frozensetr?ZPROC_SETÚunionrËrÄr@rÚtrimboxr·rÃÚmapr"ržrŸrƒr„r¿Ú_expand_mediaboxrÊ)r<rÍrÒrQrÎZ new_resourcesr¶Zoriginal_resourcesZpage2resourcesZ new_annotsrŠZannotsÚrefÚresÚnewZ newrenameZnew_content_arrayZoriginal_contentZ page2contentZrectr.r.r2rÏns‚         &       zPageObject._merge_page)rÍrQr-cst|jjjƒ|jjjƒ|jjjƒ|jjjƒf}|jjjƒ|jjjƒ|jjjƒ|jjjƒ|jjjƒ|jjjƒ|jjjƒ|jjjƒf‰ˆdk rÜtdd„ˆDƒƒ‰t‡‡fdd„tdddƒDƒƒ}t‡‡fdd„tdddƒDƒƒ}nˆddd…}ˆddd…}t|ƒt|ƒf}t |ƒt |ƒf}t|d|dƒt|d|dƒf}t |d|dƒt |d |dƒf}||j_ ||j_ dS) Ncss|]}t|ƒVqdS)N)rl)r0r1r.r.r2ú æsz.PageObject._expand_mediabox..c3s:|]2}ˆdˆ|ˆdˆ|dˆdVqdS)rrSrrUNr.)r0r¾)Úcorners2rQr.r2rßèsrérSc3s:|]2}ˆdˆ|ˆdˆ|dˆdVqdS)rrTrVNr.)r0r¾)ràrQr.r2rßìsrrT) rˆržÚ as_numericrŸÚrightÚtopÚtupler¸r¢r¤r r¡)r<rÍrQZcorners1Únew_xÚnew_yÚ lowerleftÚ upperrightr.)ràrQr2rÛÒs:            $zPageObject._expand_mediabox)rÍrQrÎr-csBtddƒtˆtƒrˆj‰ttˆƒ‰|jˆ‡‡fdd„ˆ|ƒdS)ah mergeTransformedPage is similar to merge_page, but a transformation matrix is applied to the merged stream. :param PageObject page2: The page to be merged into this one. Should be an instance of :class:`PageObject`. :param tuple ctm: a 6-element tuple containing the operands of the transformation matrix :param bool expand: Whether the page should be expanded to fit the dimensions of the page to be merged. .. deprecated:: 1.28.0 Use :meth:`add_transformation` and :meth:`merge_page` instead. z%page.mergeTransformedPage(page2, ctm)z5page2.add_transformation(ctm); page.merge_page(page2)cstj|ˆjˆƒS)N)rurÉr@)Z page2Content)rQrÍr.r2rLsz1PageObject.mergeTransformedPage..N)rr4rPrQr rrÏ)r<rÍrQrÎr.)rQrÍr2ÚmergeTransformedPageýs   zPageObject.mergeTransformedPage)rÍrbrÎr-cCs*tddƒtƒj||ƒ}|j|||ƒdS)a2 mergeScaledPage is similar to merge_page, but the stream to be merged is scaled by applying a transformation matrix. :param PageObject page2: The page to be merged into this one. Should be an instance of :class:`PageObject`. :param float scale: The scaling factor :param bool expand: Whether the page should be expanded to fit the dimensions of the page to be merged. .. deprecated:: 1.28.0 Use :meth:`add_transformation` and :meth:`merge_page` instead. z*page.mergeScaledPage(page2, scale, expand)zWpage2.add_transformation(Transformation().scale(scale)); page.merge_page(page2, expand)N)rrPrbrê)r<rÍrbrÎrar.r.r2ÚmergeScaledPage"s zPageObject.mergeScaledPage)rÍrcrÎr-cCs(tddƒtƒj|ƒ}|j|||ƒdS)aJ mergeRotatedPage is similar to merge_page, but the stream to be merged is rotated by applying a transformation matrix. :param PageObject page2: the page to be merged into this one. Should be an instance of :class:`PageObject`. :param float rotation: The angle of the rotation, in degrees :param bool expand: Whether the page should be expanded to fit the dimensions of the page to be merged. .. deprecated:: 1.28.0 Use :meth:`add_transformation` and :meth:`merge_page` instead. z.page.mergeRotatedPage(page2, rotation, expand)z[page2.add_transformation(Transformation().rotate(rotation)); page.merge_page(page2, expand)N)rrPrhrê)r<rÍrcrÎrar.r.r2ÚmergeRotatedPage:s  zPageObject.mergeRotatedPage)rÍrYrZrÎr-cCs*tddƒtƒj||ƒ}|j|||ƒdS)aq mergeTranslatedPage is similar to merge_page, but the stream to be merged is translated by applying a transformation matrix. :param PageObject page2: the page to be merged into this one. Should be an instance of :class:`PageObject`. :param float tx: The translation on X axis :param float ty: The translation on Y axis :param bool expand: Whether the page should be expanded to fit the dimensions of the page to be merged. .. deprecated:: 1.28.0 Use :meth:`add_transformation` and :meth:`merge_page` instead. z/page.mergeTranslatedPage(page2, tx, ty, expand)z\page2.add_transformation(Transformation().translate(tx, ty)); page.merge_page(page2, expand)N)rrPr\rê)r<rÍrYrZrÎrar.r.r2ÚmergeTranslatedPageRs zPageObject.mergeTranslatedPage)rÍrcrYrZrÎr-cCs8tddƒtƒj| | ƒj|ƒj||ƒ}|j|||ƒS)aÉ mergeRotatedTranslatedPage is similar to merge_page, but the stream to be merged is rotated and translated by applying a transformation matrix. :param PageObject page2: the page to be merged into this one. Should be an instance of :class:`PageObject`. :param float tx: The translation on X axis :param float ty: The translation on Y axis :param float rotation: The angle of the rotation, in degrees :param bool expand: Whether the page should be expanded to fit the dimensions of the page to be merged. .. deprecated:: 1.28.0 Use :meth:`add_transformation` and :meth:`merge_page` instead. z@page.mergeRotatedTranslatedPage(page2, rotation, tx, ty, expand)zmpage2.add_transformation(Transformation().rotate(rotation).translate(tx, ty)); page.merge_page(page2, expand))rrPr\rhrê)r<rÍrcrYrZrÎrar.r.r2ÚmergeRotatedTranslatedPageks  z%PageObject.mergeRotatedTranslatedPage)rÍrcrbrÎr-cCs0tddƒtƒj|ƒj||ƒ}|j|||ƒdS)aŠ mergeRotatedScaledPage is similar to merge_page, but the stream to be merged is rotated and scaled by applying a transformation matrix. :param PageObject page2: the page to be merged into this one. Should be an instance of :class:`PageObject`. :param float rotation: The angle of the rotation, in degrees :param float scale: The scaling factor :param bool expand: Whether the page should be expanded to fit the dimensions of the page to be merged. .. deprecated:: 1.28.0 Use :meth:`add_transformation` and :meth:`merge_page` instead. z;page.mergeRotatedScaledPage(page2, rotation, scale, expand)zhpage2.add_transformation(Transformation().rotate(rotation).scale(scale)); page.merge_page(page2, expand)N)rrPrhrbrê)r<rÍrcrbrÎrar.r.r2ÚmergeRotatedScaledPageŠs z!PageObject.mergeRotatedScaledPage)rÍrbrYrZrÎr-cCs.tddƒtƒj||ƒj||ƒ}|j|||ƒS)a± mergeScaledTranslatedPage is similar to merge_page, but the stream to be merged is translated and scaled by applying a transformation matrix. :param PageObject page2: the page to be merged into this one. Should be an instance of :class:`PageObject`. :param float scale: The scaling factor :param float tx: The translation on X axis :param float ty: The translation on Y axis :param bool expand: Whether the page should be expanded to fit the dimensions of the page to be merged. .. deprecated:: 1.28.0 Use :meth:`add_transformation` and :meth:`merge_page` instead. z`. :param float tx: The translation on X axis :param float ty: The translation on Y axis :param float rotation: The angle of the rotation, in degrees :param float scale: The scaling factor :param bool expand: Whether the page should be expanded to fit the dimensions of the page to be merged. .. deprecated:: 1.28.0 Use :meth:`add_transformation` and :meth:`merge_page` instead. zFpage.mergeRotatedScaledTranslatedPage(page2, rotation, tx, ty, expand)zhpage2.add_transformation(Transformation().rotate(rotation).scale(scale)); page.merge_page(page2, expand)N)rrPrhrbr\rê)r<rÍrcrbrYrZrÎrar.r.r2Ú mergeRotatedScaledTranslatedPageÂs z+PageObject.mergeRotatedScaledTranslatedPage)rQrÎr-csltˆtƒrˆj‰|jƒ}|dk rLtj||jˆƒ}tj||jƒ}||tt j ƒ<|�rh|j j j ƒ|j jj ƒ|j j j ƒ|j jj ƒ|j jj ƒ|j jj ƒ|j jj ƒ|j jj ƒg‰tdd„ˆDƒƒ‰‡‡fdd„tdddƒDƒ}‡‡fd d„tdddƒDƒ}t|ƒt|ƒf}t|ƒt|ƒf}tˆd|dƒtˆd |d ƒf}tˆd|dƒtˆd |d ƒf}||j _||j _dS) aQ Apply a transformation matrix to the page. :param tuple ctm: A 6-element tuple containing the operands of the transformation matrix. Alternatively, a :py:class:`Transformation` object can be passed. See :doc:`/user/cropping-and-transforming`. Ncss|]}t|ƒVqdS)N)rl)r0r1r.r.r2rßsz0PageObject.add_transformation..cs8g|]0}ˆdˆ|ˆdˆ|dˆd‘qS)rrSrrUr.)r0r¾)ÚcornersrQr.r2r3 sz1PageObject.add_transformation..rrárScs8g|]0}ˆdˆ|ˆdˆ|dˆd‘qS)rrTrVr.)r0r¾)ròrQr.r2r3 srrT)r4rPrQrËrurÉr@rÄr$r�rÊrˆržrârŸrärãrår¸r¢r¤r r¡)r<rQrÎÚcontentrærçrèrér.)ròrQr2r£äs8          $zPageObject.add_transformation)rQr-cCstddƒ|j|ƒdS)z] .. deprecated:: 1.28.0 Use :meth:`add_transformation` instead. ÚaddTransformationr£N)rr£)r<rQr.r.r2rôs zPageObject.addTransformation)r]r^r-c CsÚ|j|dd|ddfƒ|jj||ƒ|_|jj||ƒ|_|jj||ƒ|_|jj||ƒ|_|jj||ƒ|_tj|k�r|tj}t |t ƒ�rx’|D]Š}|j ƒ}t j |krŽ|t j }t |t ƒrŽtt|dƒ|ƒ|d<tt|dƒ|ƒ|d<tt|dƒ|ƒ|d<tt|dƒ|ƒ|d<qŽWtj|k�rÖ|tj}t |t ƒ�rL|dd}n|d}tt|dƒ|t|dƒ|t|dƒ|t|dƒ|fƒ} t |t ƒ�rÀ| |ttjƒtdƒtdƒ<n| |ttjƒtdƒ<dS)a` Scale a page by the given factors by applying a transformation matrix to its content and updating the page size. This updates the mediabox, the cropbox, and the contents of the page. :param float sx: The scaling factor on horizontal axis. :param float sy: The scaling factor on vertical axis. rrrSrTz/BBoxN)r£ÚcropboxrbÚartboxÚbleedboxrÙrˆr�rÖr4rrAÚADAZRectr"rlZVPr'r$r&) r<r]r^Ú annotationsÚ annotationZannotation_objZ rectangleZviewportZbboxZ scaled_bboxr.r.r2rb's>             zPageObject.scale)Úfactorr-cCs|j||ƒdS)zÓ Scale a page by the given factor by applying a transformation matrix to its content and updating the page size. :param float factor: The scaling factor (for both X and Y axis). N)rb)r<rûr.r.r2Úscale_by[szPageObject.scale_bycCstddƒ|j||ƒdS)zS .. deprecated:: 1.28.0 Use :meth:`scale_by` instead. ÚscaleByrüN)rrb)r<rûr.r.r2rýds zPageObject.scaleBy)rƒr„r-cCs0|t|jjƒ}|t|jjƒ}|j||ƒdS)zê Scale a page to the specified dimensions by applying a transformation matrix to its content and updating the page size. :param float width: The new width. :param float height: The new height. N)rlrˆrƒr„rb)r<rƒr„r]r^r.r.r2Úscale_tomszPageObject.scale_tocCstddƒ|j||ƒdS)zS .. deprecated:: 1.28.0 Use :meth:`scale_to` instead. ÚscaleTorþN)rrþ)r<rƒr„r.r.r2rÿys zPageObject.scaleTocCs<|jƒ}|dk r8t|tƒs&t||jƒ}|jƒ|ttjƒ<dS)a Compress the size of this page by joining all content streams and applying a FlateDecode filter. However, it is possible that this function will perform no action if content stream compression becomes "automatic". N)rËr4rr@Z flate_encoder$r�rÊ)r<rór.r.r2Úcompress_content_streams‚s   z#PageObject.compress_content_streamscCstddƒ|jƒdS)zc .. deprecated:: 1.28.0 Use :meth:`compress_content_streams` instead. ÚcompressContentStreamsrN)rr)r<r.r.r2r�s z!PageObject.compressContentStreamsÚ)ÚTj_sepÚTJ_sepr-c CsÆd}|tjjƒ}t|tƒs(t||jƒ}d}�x’|jD�]†\}}|dkrJq6|d krddt|d ƒ}q6|d kr˜|d }t|tƒr–||7}||7}|d 7}q6|d krª|d 7}q6|dkrÚ|d 7}|d }t|tƒrØ||d 7}q6|dk�r |d}t|tƒ�r¾|d 7}||7}q6|dkr6x¢|d D]–} t| tƒ�r>||7}|| 7}nrt| t t fƒ�rt | ƒ| dk�rˆt |ƒd k�s~|ddk�r°|d7}n(t |ƒdk�r|ddk�r|dd…}�qW|d 7}q6W|S)aÊ Locate all text drawing commands, in the order they are provided in the content stream, and extract the text. This works well for some PDF files, but poorly for others, depending on the generator used. This will be refined in the future. Do not rely on the order of text coming out of this function, as it will change if this function is made more sophisticated. :return: a string object. rgð?óTfóTfsóTcóThóTlóTmodesTwrsTjÚ sT*ó'ó"rSsTJéúrú N)rrrrr r éÿÿÿÿrr) r�rÊrAr4rr@r·rlr(r&r"r5r‡) r<rrÚtextróÚ space_scaler¼ÚoperatorZ_textr¾r.r.r2Ú_extract_text_old™sR               zPageObject._extract_text_oldcCsfd}xlt|djƒ|jdƒjD]P\}}|dkrBdd„|dDƒ}ng}||jdƒd dj|ƒ|jƒd 7}qW|d 7}yÈxÂ|tjd D]°}||d 7}||tjd |jƒd 7}y*|tjd |d jƒ}||d 7}Wnt k røYnXy*||tjd |dj ƒjƒd 7}WqŒt k �r:YqŒXqŒWWnt k �r`|d7}YnX|S)Nrz /ContentsÚbytessTJcSsg|]}t|tƒr|‘qSr.)r4r7)r0r1r.r.r2r3ísz1PageObject._debug_for_extract..rzutf-8rr z ============================= z/Fontz /Encodingz /ToUnicodezNo Font ) rrAr@r·ÚdecodeÚjoinrjr�r†Ú ExceptionÚget_datarº)r<ÚoutZoperaÚsÚfoZenc_reprr.r.r2Ú_debug_for_extractçs8,    zPageObject._debug_for_extractrr˜é´éçi@.) r‘r@Ú orientationsÚ space_widthÚ content_keyÚvisitor_operand_beforeÚvisitor_operand_afterÚ visitor_textr-c ,srd‰d‰ d‰ i‰y8|} xttjƒ| kr4| djƒ} qWtt| tjƒ} Wntk r\dSXd| krŽx&tt| dƒD]} t| ||ƒˆ| <qvWdiddf‰y4t|t ƒr²||jƒn|} t| t ƒsÌt | |dƒ} Wnt k râdSXd d d d d d g‰g‰d d d d d d g‰d d d d d d g‰d ‰d ‰d ‰d ‰d ‰t t t t t t d œdd„‰ t t tdœdd„‰ t dœ‡fdd„ ‰tt ddœ‡‡‡‡‡‡‡‡‡‡ ‡ ‡ ‡ ‡ ‡‡‡‡‡fdd„ } �x�| jD�]„\}}|dk �rÖ|||ˆˆƒ|dk�rø| dgƒ| d|ƒ�n(|dk�rB| d|dgƒ| d|d gƒ| dgƒ| d|d!d…ƒ�nÞ|d"k�rl| d#|d  gƒ| d$|ƒ�n´|d%k�røx||dD]p}t|t tfƒ�r | d|gƒt|tt ttfƒ�r€tt |ƒƒˆk�r€tˆƒdk�r€ˆd.d&k�r€| dd&gƒ�q€W�n(|d'k�rˆ ˆ7‰ ˆdk �r(ˆˆˆˆˆd(ˆƒy8ˆ d/d)k�r^ˆ d)7‰ ˆdk �r^ˆd)ˆˆˆd(ˆƒWntk �rvYnXz”yd| d*}||dd+d,k�rÜ|j||dˆ |||ˆƒ‰ˆ ˆ7‰ ˆdk �r܈ˆˆˆˆd(ˆƒWn*tk �rtd-|d›�tƒYnXWdd‰Xn | ||ƒ|dk �r´|||ˆˆƒ�q´Wˆ ˆ7‰ ˆdk�rnˆdk �rnˆˆˆˆˆd(ˆƒˆ S)0zü See extract_text for most arguments. :param Optional[str] content_key: indicate the default key where to extract data None = the object; this allow to reuse the function on XObject default = "/Content" rFz/Parentz/FontÚcharmapZNotInitializedNrgð?gg@@g(@)r[rÕr-c SsÈ|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|dgS)NrrrSrTrUrVr.)r[rÕr.r.r2ÚmultYs &z&PageObject._extract_text..mult)r[r-cSs8|ddkrdS|ddkr dS|ddkr0dSdSdS) NrTg�íµ ÷ư>rrrr˜ig�íµ ÷ư¾r.)r[r.r.r2Úorientcs   z(PageObject._extract_text..orient)r-csˆdS)Ng@�@r.r.)Ú _space_widthr.r2Úcurrent_spacewidthmsz4PageObject._extract_text..current_spacewidth)rr¼r-cs d}|dkrHddddddg‰ˆ ˆ7‰ ˆdk r@ˆˆˆˆˆdˆƒd‰dS|dkr|ˆ ˆ7‰ ˆdk rtˆˆˆˆˆdˆƒd‰�nR|dkr ˆjˆˆˆˆˆˆˆfƒ�n.|d krìyˆjƒ\‰‰‰‰‰‰‰Wn$tk ræddddddg‰YnX�nâ|d k�rjˆ ˆ7‰ ˆdk �rˆˆˆˆˆdˆƒd‰ˆ t|d ƒt|d ƒt|d ƒt|dƒt|dƒt|dƒgˆƒ‰�nd|dk�rˆt|d ƒd‰�nF|dk�r¦dt|d ƒ‰�n(|dk�rÀt|d ƒ‰�n|dk�ršˆdk�rúˆ ˆ7‰ ˆdk �rúˆˆˆˆˆdˆƒd‰y4ˆ|d }|d ‰|d |d|d |df‰Wn:tk �rltd ‰td tdd|d df‰YnXyt|d ƒ‰Wntk �r”YnX�n4|dk�r d}t|d ƒ}t|d ƒ}ˆd|ˆd |ˆd 7<ˆd|ˆd |ˆd7<�nÂ|dk�r^d}t|d ƒt|d ƒt|d ƒt|dƒt|dƒt|dƒg‰�np|dk�r€d}ˆdˆ8<�nN|dk�rÊd}ˆ ˆˆƒ}ˆ |ƒ}|ˆ k�rÎt|d tƒ�rʈ|d 7‰�qÎd}t|d tƒ�rêt|d ƒn|d } tˆd tƒ�rNy| j ˆd dƒ}Wn4tk �rJ| j ˆd dk�r>dnddƒ}YnXndj ‡fdd„| Dƒƒ}�xddj ‡fd d„|DƒƒD�]@} t | ƒ} | d!k�sàd"| k�r®| d#k�sàd$| k�rÂ| d%k�sàd&| k�rÖ| d'k�sà| t k�røˆ �rî| ˆnˆ| ‰nÊd(| k�r | d)k�sHd*| k�r | d+k�sHd,| k�r4| d-k�sHt | k�r†| tk�r†ˆ �s|d‰ ˆ ˆ7‰ ˆdk �rxˆˆˆˆˆdˆƒd‰| ˆ‰n<ˆ �rºd‰ ˆ ˆ7‰ ˆdk �r¶ˆˆˆˆˆdˆƒd‰ˆ| ‰�q‚WndS|�rþˆ ˆˆƒ}ˆ |ƒ}|dˆd} |dˆd} tjt|d |dƒt|d |d ƒƒ}ˆ|}|‰|ˆ k�rNdS�y–|d k�rø| d6|k�r°ˆ ˆd7d/k�rôˆ ˆd/7‰ ˆdk �rªˆˆd/ˆˆˆdˆƒd‰nDt| ƒ|d0k�rät| ƒˆƒ|d1k�räˆ ˆd8d2k�räˆd27‰�nì|d3k�rž| d.|k�rVˆ ˆd9d/k�ršˆ ˆd/7‰ ˆdk �rPˆˆd/ˆˆˆdˆƒd‰nDt| ƒ|d0k�rät| ƒˆƒ|d1k�räˆ ˆd:d2k�räˆd27‰�nF|d4k�rB| d.|k�rüˆ ˆd;d/k�r@ˆ ˆd/7‰ ˆdk �röˆˆd/ˆˆˆdˆƒd‰nDt| ƒ|d0k�rät| ƒˆƒ|d1k�räˆ ˆd<d2k�räˆd27‰n¢|d5k�rä| d=|k�r ˆ ˆd>d/k�räˆ ˆd/7‰ ˆdk �ršˆˆd/ˆˆˆdˆƒd‰nDt| ƒ|d0k�rät| ƒˆƒ|d1k�räˆ ˆd?d2k�räˆd27‰Wntk �rüYnXdS)@NFsBTgð?grTrsETóqóQscmrrrSrUrVsTzgY@sTwsTLsTfz???sTdTsTmsT*sTjÚ surrogatepassr'z utf-16-becs2g|]*}|ˆdkr ˆd|n t|fƒjƒ‘qS)r)rr)r0r1)Úcmapr.r2r3 szGPageObject._extract_text..process_operation..cs(g|] }|ˆdkr ˆd|n|‘qS)rr.)r0r1)r/r.r2r3sé/é:é@i io i  iÿ!i�iÿiûiÿýipþiÿþgš™™™™™é?r g333333Ó?érrr˜igš™™™™™é¿rrrrrrgš™™™™™é¿rr)r�Úpoprrlrºrr4r7r)rrr/r9r6r8rdÚsqrtÚabs)rr¼Zcheck_crlf_spaceZ charMapTuplerYrZr[Z orientationÚtÚttr1ZxxZdelta_xZdelta_yÚkrÈ)ÚTLr*Ú char_scaleÚ cm_matrixÚcm_stackr/Úcmapsr+Ú font_sizer(r)r!ÚoutputÚrtl_dirrrÚ tm_matrixÚtm_prevr&r.r2Úprocess_operationqs¨                        $(                  .                 z3PageObject._extract_text..process_operationr sT*sTjr sTwrsTcrrSsTDsTLsTdsTJrsDorTr z/XObjectz/Subtypez/Imagez" impossible to decode XFormObject rr)r$r�r†rAr r rrr4r7rrºrrlr5rr·r&r"r6r‡Ú IndexErrorÚextract_xform_textrrp)r<r‘r@r!r"r#r$r%r&ZobjrZresources_dictrÈrórDr¼rraZxobjr.)r:r*r;r<r=r/r>r+r?r(r)r!r@rArrrBrCr&r2Ú _extract_text sÎ   :&                zPageObject._extract_text)rrr!r"r$r%r&) Úargsrrr!r"r$r%r&r-c GsŒt|ƒdk�r>t|dtƒrÐ|d}t|ƒdkrZt|dtƒrH|d}ntd|d›�ƒ‚t|ƒdkr”t|dttfƒr‚|d}ntd|d›�ƒ‚t|ƒdkrÎt|dttfƒr¼|d}ntd|d›�ƒ‚nnt|dttfƒ�r,|d}t|ƒdk�r>t|dttfƒ�r|d}ntd|d›�ƒ‚ntd|d›�ƒ‚|dk �sR|dk �r^tjdt ƒt|tƒ�rp|f}|j ||j ||t j |||ƒS) a{ Locate all text drawing commands, in the order they are provided in the content stream, and extract the text. This works well for some PDF files, but poorly for others, depending on the generator used. This will be refined in the future. Do not rely on the order of text coming out of this function, as it will change if this function is made more sophisticated. Arabic, Hebrew,... are extracted in the good order. If required an custom RTL range of characters can be defined; see function set_custom_rtl Additionally you can provide visitor-methods to get informed on all operands and all text-objects. For example in some PDF files this can be useful to parse tables. :param Tj_sep: Deprecated. Kept for compatibility until PyPDF2==4.0.0 :param TJ_sep: Deprecated. Kept for compatibility until PyPDF2==4.0.0 :param Tuple[int, ...] orientations: list of orientations text_extraction will look for default = (0, 90, 180, 270) note: currently only 0(Up),90(turned Left), 180(upside Down), 270 (turned Right) :param float space_width: force default space width if not extracted from font (default: 200) :param Optional[Function] visitor_operand_before: function to be called before processing an operand. It has four arguments: operand, operand-arguments, current transformation matrix and text matrix. :param Optional[Function] visitor_operand_after: function to be called after processing an operand. It has four arguments: operand, operand-arguments, current transformation matrix and text matrix. :param Optional[Function] visitor_text: function to be called when extracting some text at some position. It has five arguments: text, current transformation matrix, text matrix, font-dictionary and font-size. The font-dictionary may be None in case of unknown fonts. If not None it may e.g. contain key "/BaseFont" with value "/Arial,Bold". :return: The extracted text rrrSzInvalid positional parameter rTrUNzKparameters Tj_Sep, TJ_sep depreciated, and will be removed in PyPDF2 3.0.0.)r‡r4r7Ú TypeErrorrår5rlryrzr{rGr@r�rÊ) r<rrr!r"r$r%r&rHr.r.r2Ú extract_textÙsJ0        zPageObject.extract_textéh)Úxformr!r"r$r%r&r-c Cs|j||j||d|||ƒS)z¼ Extract text from an XObject. :param float space_width: force default space width (if not extracted from font (default 200) :return: The extracted text N)rGr@)r<rLr!r"r$r%r&r.r.r2rF8szPageObject.extract_xform_textcCstddƒ|jƒS)zW .. deprecated:: 1.28.0 Use :meth:`extract_text` instead. Ú extractTextrJ)rrJ)r<rrr.r.r2rMSs zPageObject.extractTextcCs>|jƒ}t|tƒst‚ttt|tjƒƒ\}}||}||fS)zŠ Get the names of embedded fonts and unembedded fonts. :return: (Set of embedded fonts, set of unembedded fonts) )rAr4r r`Ú_get_fonts_walkr r�r†)r<r‘ZfontsZembeddedZ unembeddedr.r.r2Ú _get_fonts^s zPageObject._get_fontscCstddƒ|jS)zV .. deprecated:: 1.28.0 Use :py:attr:`mediabox` instead. ÚmediaBoxrˆ)rrˆ)r<r.r.r2rPqs zPageObject.mediaBoxcCstddƒ||_dS)zV .. deprecated:: 1.28.0 Use :py:attr:`mediabox` instead. rPrˆN)rrˆ)r<rGr.r.r2rP{s z/CropBoxcCstddƒ|jS)zU .. deprecated:: 1.28.0 Use :py:attr:`cropbox` instead. ÚcropBoxrõ)rrõ)r<r.r.r2rQŽs zPageObject.cropBoxcCstddƒ||_dS)NrQrõ)rrõ)r<rGr.r.r2rQ˜s z /BleedBoxcCstddƒ|jS)zV .. deprecated:: 1.28.0 Use :py:attr:`bleedbox` instead. ÚbleedBoxr÷)rr÷)r<r.r.r2rR¤s zPageObject.bleedBoxcCstddƒ||_dS)NrRr÷)rr÷)r<rGr.r.r2rR®s z/TrimBoxcCstddƒ|jS)zU .. deprecated:: 1.28.0 Use :py:attr:`trimbox` instead. ÚtrimBoxrÙ)rrÙ)r<r.r.r2rS¹s zPageObject.trimBoxcCstddƒ||_dS)NrSrÙ)rrÙ)r<rGr.r.r2rSÃs z/ArtBoxcCstddƒ|jS)zT .. deprecated:: 1.28.0 Use :py:attr:`artbox` instead. ÚartBoxrö)rrö)r<r.r.r2rTÏs zPageObject.artBoxcCstddƒ||_dS)NrTrö)rrö)r<rGr.r.r2rTÙs cCsd|kr dStt|dƒSdS)Nz/Annots)r r)r<r.r.r2rùÞszPageObject.annotationscCs$|dkr|tdƒ=n ||tdƒ<dS)zù Set the annotations array of the page. Typically you don't want to set this value, but append to it. If you append to it, don't forget to add the object first to the writer and only add the indirect object. Nz/Annots)r$)r<rGr.r.r2rùås  )NNN)NNN)NNN)F)NNF)F)F)F)F)F)F)F)F)F)rr)rr˜rr)rr˜rr©rr˜rrK)rUr NNN)rr)]rprqrrrsr rr#rRrMrwÚsetterrr}rlr‚rtr rr‹rŒrrr”r5rcr§rhr©rªr«r r rr7r´rr¿rÄrrÉrËrÌÚboolrÐrÑrrÏrÛrPrêrërìrírîrïrðrñr£rôrbrürýrþrÿrrrrr�rÊrGrJr!rFrMr rOrNr‰rˆr'rPrõrQr÷rRrÙrSrörTrrùÚ __classcell__r.r.)r€r2rus   #   "  (    _-!    5 4     L*^HdXT         ruc@s`eZdZegefeegefddœdd„Zedœdd„Zeedœd d „Ze edœd d „Z dS) Ú _VirtualListN)Úlength_functionÚ get_functionr-cCs||_||_d|_dS)Nrr)rZr[Úcurrent)r<rZr[r.r.r2rRõsz_VirtualList.__init__)r-cCs|jƒS)N)rZ)r<r.r.r2Ú__len__þsz_VirtualList.__len__)Úindexr-cs†t|tƒr:t|jtˆƒƒމtˆƒ}|ˆj‡‡fdd„ƒSt|tƒsLtdƒ‚tˆƒ}|dkrd||}|dkst||kr|t dƒ‚ˆj |ƒS)Ncs ˆˆ|S)Nr.)Úidx)Úindicesr<r.r2rLsz*_VirtualList.__getitem__..z!sequence indices must be integersrzsequence index out of range) r4Úslicer¸r`r‡r»r]r5rIrEr[)r<r^ÚclsZlen_selfr.)r`r<r2Ú __getitem__s  z_VirtualList.__getitem__ccs$xtt|ƒƒD]}||VqWdS)N)r¸r‡)r<r¾r.r.r2Ú__iter__sz_VirtualList.__iter__) rprqrrrr5rurRr]rcrrdr.r.r.r2rYôs   rY)r‘ÚfntÚembr-cs°|dkrtƒ}|dkrtƒ}tˆdƒs2tƒtƒfSd }dˆkrR|jttˆdƒƒdˆkr€‡fdd „|Dƒr€|jttˆdƒƒx&ˆjƒD]}tttˆ|ƒ||ƒqŠW||fS) a_ If there is a key called 'BaseFont', that is a font that is used in the document. If there is a key called 'FontName' and another key in the same dictionary object that is called 'FontFilex' (where x is null, 2, or 3), then that fontname is embedded. We create and add to two sets, fnt = fonts used and emb = fonts embedded. Nr°ú /FontFileú /FontFile2ú /FontFile3z /BaseFontz /FontNamecsg|]}|ˆkr|‘qSr.r.)r0r1)r‘r.r2r3,sz#_get_fonts_walk..)rgrhri)ÚsetÚhasattrÚaddr r7r°rNr )r‘rerfZfontkeysr³r.)r‘r2rNs   rNrr)NNN)NN)Jrdr±ryÚdecimalrÚtypingrrrrrrr r r r r Z_cmaprrÚ_utilsrrrrrrrÚ constantsrrørr�rr�rr�ÚerrorsrÚfiltersrZgenericrrr r!r"r#r$r%r&r'r(r)r6r5r8r9r7r;rErFrlrBrHrIrJrMrNrOrPrurYrNr.r.r.r2Úsf 4$      8 *  em#