Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 #¸ bT\ã@s�ddlmZddlmZddlmZmZmZGdd„deƒZ Gdd„de ƒZ Gdd „d e ƒZ Gd d „d e ƒZ Gd d „d e ƒZ Gdd„de ƒZdS)é)ÚFlowable)Úinch)Úascii_lowercaseÚascii_uppercaseÚdigitsc@s¨eZdZdZdZdZdZdd„Zd&dd „Zd d „Z d d „Z dd„Z dd„Z dd„Z dd„Zdd„ZeeƒZdd„ZeeƒZdd„Zdd„Zdd„Zd'd!d"„Zd#d$„Zd%S)(ÚBarcodezvAbstract Base for barcodes. Includes implementations of some methods suitable for the more primitive barcode typesZCourieré rcCs|jS)N)Úencoded)Úself©r úB/tmp/tmp4i9tl1d3/lib64/python/reportlab/graphics/barcode/common.pyÚ _humanText-szBarcode._humanTextÚcKs*t|ƒ|_|jf|Žt|dƒs&d|_dS)NÚgap)ÚstrÚvalueÚ _setKeywordsÚhasattrr)r rÚkwdr r r Ú__init__0s   zBarcode.__init__cCs$|jƒ|jƒ|jƒ|jƒdS)N)ÚvalidateÚencodeÚ decomposeÚ computeSize)r r r r Ú _calculate8szBarcode._calculatecKs&x |jƒD]\}}t|||ƒq WdS)N)ÚitemsÚsetattr)r rÚkÚvr r r r>szBarcode._setKeywordscCsd|_|j|_dS)Né)ÚvalidrÚ validated)r r r r rBszBarcode.validatecCs |j|_dS)N)r!r )r r r r rFszBarcode.encodecCs |j|_dS)N)r Ú decomposed)r r r r rIszBarcode.decomposecGsÌ|j}||j}|jdkr ||_d}x<|jD]2}|dkrB||}q,|dkrT||}q,||j}q,W|jdkr¤|d|_tdt|jƒ|_|jr¤|j|jd||_|jrº||j |j 7}|j|_ ||_ dS)NgZsbZSBg333333Ã?gÐ?g@) ÚbarWidthÚratiorr"Ú barHeightÚmaxrÚbearersÚquietÚlquietÚrquietÚ_heightÚ_width)r Úargsr#ÚwxÚwÚcr r r rLs(       zBarcode.computeSizecCs|jƒ|jS)N)rr,)r r r r Úwidthjsz Barcode.widthcCs|jƒ|jS)N)rr+)r r r r ÚheightoszBarcode.heightcCs,|jƒ|j}||j}|jr$|jp&d}|j|}|d}|j|d}xˆ|jD]~}|dkrh||j}qP|dkrz||}qP|dkrŒ||}qP|dkr®|j ||||ƒ||}qP|dkrP|j ||||ƒ||}qPW|j�r |j |jd|j |j|j |ƒ|j |j|j||j |j|j |ƒ|j ƒdS) Nrgà?gø?ÚiÚsÚSÚbÚB) rr#r$r(r)r'r%r"rÚrectr,r*ÚdrawHumanReadable)r r#r.Úleftr6ZbbÚtbr0r r r Údrawts4         z Barcode.drawc Cs®|jrªddlm}m}t|jƒƒ}|j}|j}||||ƒ}|j}|j r^||j |j 8}|j }nd}||krz||t |ƒ9}d||ƒ|d} |j ||d| |||ƒdS)Nr)Ú getAscentÚ stringWidthg…ëQ¸ñ?g@�@g@)Ú humanReadableZreportlab.pdfbase.pdfmetricsr=r>rr ÚfontSizeÚfontNamer,r(r)r*ÚfloatÚannotate) r r=r>r4r@rAr/r1ÚxÚyr r r r9”s  zBarcode.drawHumanReadablecCs|jj||||ddd�dS)Nrr)ZstrokeÚfill)Úcanvr8)r rDrEr/Úhr r r r8¦sz Barcode.rectÚmiddlec CsZ|j}|jƒ|j|j|ƒ|dkr*d}n|dkr8d}nd}t||ƒ|||ƒ|jƒdS)NrIZdrawCentredStringÚendZdrawRightStringZ drawString)rGZ saveStateZsetFontrAÚgetattrZ restoreState) r rDrEÚtextrAr@ÚanchorrGÚfuncr r r rC©szBarcode.annotatecCs$||kr td|jj|||fƒ‚|S)Nz/%s attribute %s is invalid %r not in allowed %r)Ú ValueErrorÚ __class__Ú__name__)r ÚnamerZallowedr r r Ú _checkVal³szBarcode._checkValN)r)rI)rQÚ __module__Ú __qualname__Ú__doc__rAr@r?r rrrrrrrr1Úpropertyr2r<r9r8rCrSr r r r r%s*   rc@s eZdZdZdd„Zdd„ZdS)ÚMultiWidthBarcodez9Base for variable-bar-width codes like Code93 and Code128cGs¼|j}tdƒdtdƒd}}d}xH|jD]>}t|ƒ}|tkrR||||}q,|tkr,||||}q,W|jdkr”|d|_tdt|jƒ|_|jrª||j |j 7}|j|_ ||_ dS)NÚarÚAgg333333Ã?gÐ?) r#Úordr"rrr%r&rr(r)r*r+r,)r r-r#ÚoaÚoAr/r0Úocr r r r¼s    zMultiWidthBarcode.computeSizecCs¤|jƒtdƒdtdƒd}}|j}|jr4|jp6d}x^|jD]T}t|ƒ}|tkrf||||}q@|tkr@|||}|j|d||j ƒ||7}q@W|j ƒdS)NrYrrZr) rr[r#r(r)r"rrr8r%r9)r r\r]r#r:r0r^r/r r r r<Ós   zMultiWidthBarcode.drawN)rQrTrUrVrr<r r r r rX¹srXc@sŒeZdZdZdddddddd d d d d dddddddddddœZdZedZdZdZ dZ dZ dZ dZ dZd'dd „Zd!d"„Zd#d$„Zd%d&„ZdS)(ÚI2of5ay Interleaved 2 of 5 is a numeric-only barcode. It encodes an even number of digits; if an odd number is given, a 0 is prepended. Options that may be passed to constructor: value (int, or numeric string required.): The value to encode. barWidth (float, default .0075): X-Dimension, or width of the smallest element Minumum is .0075 inch (7.5 mils). ratio (float, default 2.2): The ratio of wide elements to narrow elements. Must be between 2.0 and 3.0 (or 2.2 and 3.0 if the barWidth is greater than 20 mils (.02 inch)) gap (float or None, default None): width of intercharacter gap. None means "use barWidth". barHeight (float, see default below): Height of the symbol. Default is the height of the two bearer bars (if they exist) plus the greater of .25 inch or .15 times the symbol's length. checksum (bool, default 1): Whether to compute and include the check digit bearers (float, in units of barWidth. default 3.0): Height of bearer bars (horizontal bars along the top and bottom of the barcode). Default is 3 x-dimensions. Set to zero for no bearer bars. (Bearer bars help detect misscans, so it is suggested to leave them on). quiet (bool, default 1): Whether to include quiet zones in the symbol. lquiet (float, see default below): Quiet zone size to left of code, if quiet is true. Default is the greater of .25 inch, or .15 times the symbol's length. rquiet (float, defaults as above): Quiet zone size to right left of code, if quiet is true. stop (bool, default 1): Whether to include start/stop symbols. Sources of Information on Interleaved 2 of 5: http://www.semiconductor.agilent.com/barcode/sg/Misc/i_25.html http://www.adams1.com/pub/russadam/i25code.html Official Spec, "ANSI/AIM BC2-1995, USS" is available for US$45 from http://www.aimglobal.org/aimstore/ ZbsbsZBsbZbbBBbZssSSsZBbbbBZSsssSZbBbbBZsSssSZBBbbbZSSsssZbbBbBZssSsSZBbBbbZSsSssZbBBbbZsSSssZbbbBBZsssSSZBbbBbZSssSsZbBbBbZsSsSs)ÚstartÚstopZB0ZS0ZB1ZS1ZB2ZS2ZB3ZS3ZB4ZS4ZB5ZS5ZB6ZS6ZB7ZS7ZB8ZS8ZB9ZS9Ng¸…ëQ¸~?gš™™™™™@rg@rcKs”t|ƒtdƒkrt|ƒ}x |jƒD]\}}t|||ƒq"W|jrx|jdkr„ttd|jdƒ|_ttd|jdƒ|_ n d|_|_ t j ||ƒdS)NrgÐ?g$@g) Útyperrrr(r)Úminrr#r*rr)r rr-rrr r r r8s  zI2of5.__init__cCs@d}d|_x*|jjƒD]}|tkr*d|_q||}qW||_|S)Nrrr)r rÚstripÚ string_digitsr!)r Úvvalr0r r r rIs zI2of5.validatecs¨|j‰|j}tˆƒ}|ddkr$|s6|ddkrF| rFdˆ‰|d7}|rždt‡fdd„td|dƒDƒƒt‡fdd„td|dƒDƒƒ}ˆtd|dƒ7‰ˆ|_dS) NérrÚ0écsg|]}tˆ|ƒ‘qSr )Úint)Ú.0r3)r4r r ú _sz I2of5.encode..é )r!ÚchecksumÚlenÚsumÚrangerr )r Úcsr0r )r4r rTs"@z I2of5.encodecCs¶|jr|jdgpg}|j}xrtdt|jƒdƒD]\}|jd|j|}|jd|j|d}x*tdt|ƒƒD]}|||||ƒqpWq0W|jr¤||jdƒdj|ƒ|_|jS) Nr`rrgr7r5rrar)raÚpatternsÚappendrqror Újoinr")r ÚdvalrYr3r6r4r r r rds zI2of5.decompose)r)rQrTrUrVrsr%rr#r$rnr'r(r)r*rarrrrr r r r r_ãs49   r_c @sxeZdZdZdddddddd d d d d dœ ZdZdZedZdZ dZ dZ dZ dZ dZddd„Zdd„Zdd„Zdd„ZdS)ÚMSIaý MSI is a numeric-only barcode. Options that may be passed to constructor: value (int, or numeric string required.): The value to encode. barWidth (float, default .0075): X-Dimension, or width of the smallest element ratio (float, default 2.2): The ratio of wide elements to narrow elements. gap (float or None, default None): width of intercharacter gap. None means "use barWidth". barHeight (float, see default below): Height of the symbol. Default is the height of the two bearer bars (if they exist) plus the greater of .25 inch or .15 times the symbol's length. checksum (bool, default 1): Wether to compute and include the check digit bearers (float, in units of barWidth. default 0): Height of bearer bars (horizontal bars along the top and bottom of the barcode). Default is 0 (no bearers). lquiet (float, see default below): Quiet zone size to left of code, if quiet is true. Default is the greater of .25 inch, or 10 barWidths. rquiet (float, defaults as above): Quiet zone size to right left of code, if quiet is true. stop (bool, default 1): Whether to include start/stop symbols. Sources of Information on MSI Bar Code: http://www.semiconductor.agilent.com/barcode/sg/Misc/msi_code.html http://www.adams1.com/pub/russadam/plessy.html ZBsZbSbZbSbSbSbSZbSbSbSBsZbSbSBsbSZbSbSBsBsZbSBsbSbSZbSBsbSBsZbSBsBsbSZbSBsBsBsZBsbSbSbSZBsbSbSBs) r`rarhÚ1Ú2Ú3Ú4Ú5Ú6Ú7Ú8Ú9rNg¸…ëQ¸~?gš™™™™™@grcKs”t|ƒtdƒkrt|ƒ}x |jƒD]\}}t|||ƒq"W|jrx|jdkr„ttd|jdƒ|_ttd|jdƒ|_ n d|_|_ t j ||ƒdS)NrgÐ?g$@g) rbrrrr(r)r&rr#r*rr)r rr-rrr r r rµs  z MSI.__init__cCs@d}d|_x*|jjƒD]}|tkr*d|_q||}qW||_|S)Nrrr)r rrdrer!)r rfr0r r r rÆs z MSI.validatecCs°|j}|jr¦d}x$tdt|ƒdƒD]}|||}q"Wtt|ƒdƒ}d}x|D]}|t|ƒ}qPWx(tdt|ƒdƒD]}|t||ƒ}qvWd|d}|t|ƒ}||_dS)Nrrrgrrm)r!rnrqrorrjr )r r4r0r3ÚdÚtr r r rÑs   z MSI.encodecsVˆjrˆjdgpg}|‡fdd„ˆjDƒ7}ˆjrD|jˆjdƒdj|ƒˆ_ˆjS)Nr`csg|]}ˆj|‘qSr )rs)rkr0)r r r rlæsz!MSI.decompose..rar)rarsr rtrur")r rvr )r r räs  z MSI.decompose)r)rQrTrUrVrsrar%rr#r$rnr'r(r)r*rrrrr r r r rwss(,   rwc@s¾eZdZdZdddddddd d d d d dddddddddœZdddddddddd d!d"d#d$d%d&d'd(d)d*dœZed+ZdZd,Z e d-Z d.Z dZ d/ZdZd,Zd,Zd9d1d2„Zd3d4„Zd5d6„Zd7d8„Zd,S):ÚCodabara* Codabar is a numeric plus some puntuation ("-$:/.+") barcode with four start/stop characters (A, B, C, and D). Options that may be passed to constructor: value (string required.): The value to encode. barWidth (float, default .0065): X-Dimension, or width of the smallest element minimum is 6.5 mils (.0065 inch) ratio (float, default 2.0): The ratio of wide elements to narrow elements. gap (float or None, default None): width of intercharacter gap. None means "use barWidth". barHeight (float, see default below): Height of the symbol. Default is the height of the two bearer bars (if they exist) plus the greater of .25 inch or .15 times the symbol's length. checksum (bool, default 0): Whether to compute and include the check digit bearers (float, in units of barWidth. default 0): Height of bearer bars (horizontal bars along the top and bottom of the barcode). Default is 0 (no bearers). quiet (bool, default 1): Whether to include quiet zones in the symbol. stop (bool, default 1): Whether to include start/stop symbols. lquiet (float, see default below): Quiet zone size to left of code, if quiet is true. Default is the greater of .25 inch, or 10 barWidth rquiet (float, defaults as above): Quiet zone size to right left of code, if quiet is true. Sources of Information on Codabar http://www.semiconductor.agilent.com/barcode/sg/Misc/codabar.html http://www.barcodeman.com/codabar.html Official Spec, "ANSI/AIM BC3-1995, USS" is available for US$45 from http://www.aimglobal.org/aimstore/ ZbsbsbSBZbsbsBSbZbsbSbsBZBSbsbsbZbsBsbSbZBsbsbSbZbSbsbsBZbSbsBsbZbSBsbsbZBsbSbsbZbsbSBsbZbsBSbsbZBsbsBsBZBsBsbsBZBsBsBsbZbsBsBsBZbsBSbSbZbSbSbsBZbsbSbSBZbsbSBSb)rhrxryrzr{r|r}r~rr€ú-ú$ú:ú/Ú.ú+rZr7ÚCÚDrrrgriéééééé rmé ré ééééééz-$:/.+Ng9´Èv¾Ÿz?g@grcKs”t|ƒtdƒkrt|ƒ}x |jƒD]\}}t|||ƒq"W|jrx|jdkr„ttd|jdƒ|_ttd|jdƒ|_ n d|_|_ t j ||ƒdS)NrgÐ?g$@g) rbrrrr(r)rcrr#r*rr)r rr-rrr r r r>s  zCodabar.__init__cCsªd}d|_|jjƒ}xXtdt|ƒƒD]F}||}||jkrb|dkrR|t|ƒdksZ|dkrbd|_q$||}q$W|jr |ddkrˆd|}|ddkr ||d}||_|S)NrrrZABCDrZéÿÿÿÿ) r rrdrqroÚcharsÚValidrar!)r rfr4r3r0r r r rNs"       zCodabar.validatecs>ˆj}ˆjr4t‡fdd„|Dƒƒ}|ˆj|d7}|ˆ_dS)Ncsg|]}ˆj|‘qSr )Úvalues)rkr0)r r r rlgsz"Codabar.encode..r–)r!rnrpr›r )r r4rr )r r rcs zCodabar.encodecs.dj‡fdd„ˆjDƒƒ}|dd…ˆ_ˆjS)Nrcsg|]}ˆj|d‘qS)r3)rs)rkr0)r r r rlmsz%Codabar.decompose..rrš)rur r")r rvr )r r rlszCodabar.decompose)r)rQrTrUrVrsr�rer›rar%rr#r$rnr'r(r)r*rrrrr r r r rƒës44      rƒc @s¨eZdZdZdZddddddd d d d d ddœ Zddddddddddddœ ZdZdZe dZ dZ d-Z dZ dZdZdZd.d!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„ZdS)/ÚCode11aJ Code 11 is an almost-numeric barcode. It encodes the digits 0-9 plus dash ("-"). 11 characters total, hence the name. value (int or string required.): The value to encode. barWidth (float, default .0075): X-Dimension, or width of the smallest element ratio (float, default 2.2): The ratio of wide elements to narrow elements. gap (float or None, default None): width of intercharacter gap. None means "use barWidth". barHeight (float, see default below): Height of the symbol. Default is the height of the two bearer bars (if they exist) plus the greater of .25 inch or .15 times the symbol's length. checksum (0 none, 1 1-digit, 2 2-digit, -1 auto, default -1): How many checksum digits to include. -1 ("auto") means 1 if the number of digits is 10 or less, else 2. bearers (float, in units of barWidth. default 0): Height of bearer bars (horizontal bars along the top and bottom of the barcode). Default is 0 (no bearers). quiet (bool, default 1): Wether to include quiet zones in the symbol. lquiet (float, see default below): Quiet zone size to left of code, if quiet is true. Default is the greater of .25 inch, or 10 barWidth rquiet (float, defaults as above): Quiet zone size to right left of code, if quiet is true. Sources of Information on Code 11: http://www.cwi.nl/people/dik/english/codes/barcodes.html z 0123456789-ZbsbsBZBsbsBZbSbsBZBSbsbZbsBsBZBsBsbZbSBsbZbsbSBZBsbSbZBsbsbZbsBsbZbsBSb) rhrxryrzr{r|r}r~rr€r„r5rrrgrirŒr�rŽr�r�r‘rm) rhrxryrzr{r|r}r~rr€r„Ng¸…ëQ¸~?gš™™™™™@grcKs”t|ƒtdƒkrt|ƒ}x |jƒD]\}}t|||ƒq"W|jrx|jdkr„ttd|jdƒ|_ttd|jdƒ|_ n d|_|_ t j ||ƒdS)NrgÐ?g$@g) rbrrrr(r)rcrr#r*rr)r rr-rrr r r r¶s  zCode11.__init__cCsXd}d|_|jjƒ}x8tdt|ƒƒD]&}||}||jkrBd|_q$||}q$W||_|S)Nrrr)r rrdrqror›rœr!)r rfr4r3r0r r r rÆs   zCode11.validatecCsld}}d}|j}xF|t|ƒkrX|||||d 7}|d7}|d7}||krd}qW||j|dS)Nrrr’)r�ror›)r r4Úmr3r0rÚVr r r Ú_addCSDÔszCode11._addCSDcCsr|j}|j}|dkr.dtt|ƒdkƒ|_}|dkrB|j|dƒ}|dkrV|j|dƒ}|jrhd|dpj||_dS)Nrrrmr’r5)r!rnrjror¡rar )r r4Ztcsr r r rás  z Code11.encodecs*dj‡fdd„ˆjDƒƒdd…ˆ_ˆjS)Nrcsg|]}ˆj|d‘qS)r3)rs)rkr0)r r r rlîsz$Code11.decompose..rrš)rur r")r r )r r rís$zCode11.decomposecCs|jr|jdd…p|jS)Nrrš)rar )r r r r r ñszCode11._humanTextrš)r)rQrTrUrVr›rsr�rar%rr#r$rnr'r(r)r*rrr¡rrr r r r r ržqs0+      ržN)Zreportlab.platypus.flowablesrZreportlab.lib.unitsrÚstringrrrrerrXr_rwrƒržr r r r Ú!s  *x