)Ej9dZddlmZddlmZmZmZmZmZm Z m Z ddl m Z m Z mZerddlmZGdde ZGd d e ZGd d e ZGd dZdS)u Quoting the PDF spec: > PDF’s logical _structure facilities_ provide a mechanism for incorporating > structural information about a document’s content into a PDF file. > The logical structure of a document is described by a hierarchy of objects called > the _structure hierarchy_ or _structure tree_. > At the root of the hierarchy is a dictionary object called the _structure tree root_, > located by means of the **StructTreeRoot** entry in the document catalog. The contents of this module are internal to fpdf2, and not part of the public API. They may change at any time without prior warning or any deprecation period, in non-backward-compatible ways. Usage documentation at: ) defaultdict) TYPE_CHECKING DefaultDictDictIteratorListOptionalUnion)PDFArray PDFObject PDFString)StandardSecurityHandlercneZdZdZdZd fd Z d deeee fdeddeffd Z xZ S) NumberTreeuA number tree is similar to a name tree, except that its keys are integers instead of strings and are sorted in ascending numerical order. A name tree serves a similar purpose to a dictionary—associating keys and values—but by different means. The values associated with the keys may be objects of any type. Stream objects are required to be specified by indirect object references. It is recommended, though not required, that dictionary, array, and string objects be specified by indirect object references, and other PDF objects (nulls, numbers, booleans, and names) be specified as direct objects )_idnumsreturnNczttt|_dSN)super__init__rlistrself __class__s EC:\PYTHON\MyICR_Suite\python\Lib\site-packages\fpdf/structure_tree.pyrzNumberTree.__init__+s1 7B 8 8  obj_dict_security_handlerrcddfd|jD}tdd|diS)N c3hK|],\}}|dd|DdV-dS)z [c3$K|] }|jV dSr)ref).0 struct_elems r z1NumberTree.serialize...8s$/`/`K /`/`/`/`/`/`r]N)join)r&struct_parent_id struct_elemsnewlines rr(z'NumberTree.serialize..7si$ $ . , c c7< D D D D D D D D D D Drrc$eZdZdZdfd ZxZS)StructTreeRoot)rtype parent_treekrNctd|_t|_t |_dS)Nz/StructTreeRoot)rrr>rr?r r@rs rrzStructTreeRoot.__init__As; % %<<rr2)r3r4r5r7rr:r;s@rr=r=>sB3Irr=ceZdZdZ d dededeeeedfde ede ede ed dffd Z d e efd Z xZ S) StructElem) rr>spr@taltpg _page_numberN struct_typeparentkids page_numbertitlerGrctd|_||_||_t ||_|dnt||_|dnt||_ d|_ ||_ dS)Nz /StructElem) rrr>rDrEr r@rrFrGrHrI)rrJrKrLrMrNrGrs rrzStructElem.__init__Ws~ ! $Ie,<,<;44IcNN'rc|jSr)rIrs rrMzStructElem.page_numberms   rNNN) r3r4r5r7r8r r rintr rrMr:r;s@rrCrCJs I"&*#!((((DItL112 ( c] ( } (c]( ((((((,!Xc]!!!!!!!!rrCceZdZd dZ ddededeedeedeedeeeff d Z dedefd Z de fd Z de efd ZdS)StructureTreeBuilderrNct|_td|jg|_|jj|ji|_dS)Nz /Document)rJrKrL)r=struct_tree_rootrCdoc_struct_elemr@appendspid_per_page_numberrQs rrzStructureTreeBuilder.__init__rs^ . 0 0)#D,A    &&t';<<<46!!!rrMrJmcidrNalt_textcN|j|}|t|j}||j|<t||j|gn|g|||}|jj||jjj ||||fS)N)rJrKrLrMrNrG) rZgetlenrCrXr@rYrWr?r)rrMrJr[rNr\struct_parents_idr's radd_marked_contentz'StructureTreeBuilder.add_marked_contentzs!599+FF  $ #D$= > > 5FD %k 2 #'|$#     %%k222 )./@AHHUUU---rcNtfd|jjDS)Nc3ZK|]%}|k|j!dV&dS)r N)rMr@)r&r'rMs rr(z:StructureTreeBuilder.next_mcid_for_page..sP  &&((K77 8 7777  r)sumrXr@)rrMs `rnext_mcid_for_pagez'StructureTreeBuilder.next_mcid_for_pagesA    #35      rc|jj Sr)rXr@rQs remptyzStructureTreeBuilder.emptys')))rc#nK|jV|jV|jjV|jjEd{VdS)z@Iterate all PDF objects in the tree, starting with the tree rootN)rWrXr?r@rQs r__iter__zStructureTreeBuilder.__iter__sZ####""""#////'))))))))))rr2rR)r3r4r5rrSr8r tuplerCrareboolrgrr rirrrUrUqs7777##"& ....sm . } . 3- . z3 ....0 c c    *t*****(9-******rrUN)r6 collectionsrtypingrrrrrr r syntaxr r r encryptionrrr=rCrUrlrrrqsK"$#####TTTTTTTTTTTTTTTTTT22222222224333333 D D D D D D D DF     Y   $!$!$!$!$!$!$!$!N1*1*1*1*1*1*1*1*1*1*r