Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 ©«jì*ã@snddlmZmZmZddlmZmZmZmZm Z m Z ddl m Z m Z ddlmZddlmZGdd„dƒZd S) é)ÚOptionalÚTupleÚUnioné)Ú BooleanObjectÚ FloatObjectÚ NameObjectÚ NullObjectÚ NumberObjectÚTextStringObject)Ú ArrayObjectÚDictionaryObject)ÚRectangleObject)Ú hex_to_rgbc @sPeZdZdZddlmZmZedee e e e e e ffe e eedœdd„ƒZede ee e e e e e ffe e e e e e e ed œ dd„ƒZede e e fe e e fee e e e e e ffe e edœdd„ƒZed ee e e e e e ffee edœdd„ƒZeddddeƒfee e e e e e ffeeee eeee edfedœdd„ƒZdS)!ÚAnnotationBuildera> The AnnotationBuilder creates dictionaries representing PDF annotations. Those dictionaries can be modified before they are added to a PdfWriter instance via `writer.add_annotation`. See `adding PDF annotations <../user/adding-pdf-annotations.html>`_ for it's usage combined with PdfWriter. é)ÚFitTypeÚ ZoomArgTypeFr)ÚrectÚtextÚopenÚflagsÚreturncCsTttdƒtdƒtdƒtdƒtdƒt|ƒtdƒt|ƒtdƒt|ƒtdƒt|ƒiƒ}|S) zÿ Add text annotation. :param Tuple[int, int, int, int] rect: or array of four integers specifying the clickable rectangular area ``[xLL, yLL, xUR, yUR]`` :param bool open: :param int flags: z/Typez/Annotz/Subtypez/Textz/Rectz /Contentsz/Openz/Flags)r rrr rr )rrrrZtext_obj©rú=/tmp/pip-build-vnmlutbd/PyPDF2/PyPDF2/generic/_annotations.pyrs     zAnnotationBuilder.textÚ HelveticaÚ14ptÚ000000Úffffff) rrÚfontÚboldÚitalicÚ font_sizeÚ font_colorÚ border_colorÚbackground_colorrc Csäd} |dkr| d} |dkr$| d} | |d|} | d|} d} x t|ƒD]} | t| ƒd} qNW| d} tƒ} | jtd ƒtd ƒtd ƒtd ƒtd ƒt|ƒtdƒt|ƒtdƒt| ƒtdƒt| ƒtdƒtdd„t|ƒDƒƒiƒ| S)a¡ Add text in a rectangle to a page. :param str text: Text to be added :param RectangleObject rect: or array of four integers specifying the clickable rectangular area ``[xLL, yLL, xUR, yUR]`` :param str font: Name of the Font, e.g. 'Helvetica' :param bool bold: Print the text in bold :param bool italic: Print the text in italic :param str font_size: How big the text will be, e.g. '14pt' :param str font_color: Hex-string for the color :param str border_color: Hex-string for the border color :param str background_color: Hex-string for the background of the annotation zfont: Tzbold zitalic ú z;text-align:left;color:#ÚZrgz/Typez/Annotz/Subtypez /FreeTextz/Rectz /Contentsz/DSz/DAz/CcSsg|] }t|ƒ‘qSr)r)Ú.0Únrrrú nsz/AnnotationBuilder.free_text..)rÚstrr Úupdaterrr r ) rrrr r!r"r#r$r%Zfont_strZ bg_color_strÚstÚ free_textrrrr.:s,       zAnnotationBuilder.free_textr')Úp1Úp2rrÚ title_barrcCs²ttdƒtdƒtdƒtdƒtdƒt|ƒtdƒt|ƒtdƒtt|dƒt|d ƒt|dƒt|d ƒgƒtd ƒttd ƒtd ƒgƒtd ƒttd ƒtd ƒtd ƒgƒtdƒt|ƒiƒ}|S)a Draw a line on the PDF. :param Tuple[float, float] p1: First point :param Tuple[float, float] p2: Second point :param RectangleObject rect: or array of four integers specifying the clickable rectangular area ``[xLL, yLL, xUR, yUR]`` :param str text: Text to be displayed as the line annotation :param str title_bar: Text to be displayed in the title bar of the annotation; by convention this is the name of the author z/Typez/Annotz/Subtypez/Linez/Rectz/Tz/Lrrz/LENz/ICgà?z /Contents)r rrr r r)r/r0rrr1Zline_objrrrÚlinets&         zAnnotationBuilder.lineN)rÚinteriour_colorrcCsRttdƒtdƒtdƒtdƒtdƒt|ƒiƒ}|rNtdd„t|ƒDƒƒ|tdƒ<|S) zÑ Draw a rectangle on the PDF. :param RectangleObject rect: or array of four integers specifying the clickable rectangular area ``[xLL, yLL, xUR, yUR]`` z/Typez/Annotz/Subtypez/Squarez/RectcSsg|] }t|ƒ‘qSr)r)r(r)rrrr*¾sz/AnnotationBuilder.rectangle..z/IC)r rrr r)rr3Z square_objrrrÚ rectangle¨s   zAnnotationBuilder.rectanglez/Fit.)rÚborderÚurlÚtarget_page_indexÚfitÚfit_argsrc CsXddlm}|dk }|dk }| r0| r0tdƒ‚|rL|rLtd|›d|›�ƒ‚|dk r˜dd„|dd …Dƒ} t|ƒd kr¦td d„|d Dƒƒ} | j| ƒntd ƒgd } ttd ƒtdƒtdƒtdƒtdƒt |ƒtdƒt| ƒiƒ} |�rttdƒtdƒtd ƒtdƒtdƒt |ƒiƒ| tdƒ<|�rTdd„|Dƒ} tt|ƒt|ƒt| ƒdœƒ} | | tdƒ<| S)aò Add a link to the document. The link can either be an external link or an internal link. An external link requires the URL parameter. An internal link requires the target_page_index, fit, and fit args. :param RectangleObject rect: or array of four integers specifying the clickable rectangular area ``[xLL, yLL, xUR, yUR]`` :param border: if provided, an array describing border-drawing properties. See the PDF spec for details. No border will be drawn if this argument is omitted. - horizontal corner radius, - vertical corner radius, and - border width - Optionally: Dash :param str url: Link to a website (if you want to make an external link) :param int target_page_index: index of the page to which the link should go (if you want to make an internal link) :param str fit: Page fit or 'zoom' option (see below). Additional arguments may need to be supplied. Passing ``None`` will be read as a null value for that coordinate. :param Tuple[int, ...] fit_args: Parameters for the fit argument. .. list-table:: Valid ``fit`` arguments (see Table 8.2 of the PDF 1.7 reference for details) :widths: 50 200 * - /Fit - No additional arguments * - /XYZ - [left] [top] [zoomFactor] * - /FitH - [top] * - /FitV - [left] * - /FitR - [left] [bottom] [right] [top] * - /FitB - No additional arguments * - /FitBH - [top] * - /FitBV - [left] r)ÚBorderArrayTypeNzHEither 'url' or 'target_page_index' have to be provided. Both were None.z=Either 'url' or 'target_page_index' have to be provided. url=z, target_page_index=cSsg|] }t|ƒ‘qSr)r)r(r)rrrr* sz*AnnotationBuilder.link..éécSsg|] }t|ƒ‘qSr)r)r(r)rrrr* srz/Typez/Annotz/Subtypez/Linkz/Rectz/Borderz/Sz/URIz/Actionz/AcSs"g|]}|dkrtƒnt|ƒ‘qS)N)r r )r(Úarrrr*#s)r7r8r9z/Dest) Útypesr:Ú ValueErrorÚlenr Úappendr r rrr )rr5r6r7r8r9r:Z is_externalZ is_internalZ border_arrZ dash_patternZlink_objZ fit_arg_readyZ dest_deferredrrrÚlinkÃsB8          zAnnotationBuilder.link)Fr)rFFrrrr)r'r')N)Ú__name__Ú __module__Ú __qualname__Ú__doc__r>rrÚ staticmethodrrrÚfloatr+ÚboolÚintr rr.r2rr4Útupler rBrrrrrs: (/0-:rN)ÚtypingrrrÚ_baserrrr r r Z_data_structuresr r Z _rectanglerÚ_utilsrrrrrrÚs