From 9cde404237f8442ec290892a907d1fce70e864fa Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 23 Apr 2016 21:43:55 +0000 Subject: pst-barcode (23apr16) git-svn-id: svn://tug.org/texlive/trunk@40703 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/dvips/pst-barcode/pst-barcode.pro | 2831 ++++++++++++++++---- 1 file changed, 2301 insertions(+), 530 deletions(-) (limited to 'Master/texmf-dist/dvips') diff --git a/Master/texmf-dist/dvips/pst-barcode/pst-barcode.pro b/Master/texmf-dist/dvips/pst-barcode/pst-barcode.pro index efdca8a3bb0..b61c30e5e5c 100644 --- a/Master/texmf-dist/dvips/pst-barcode/pst-barcode.pro +++ b/Master/texmf-dist/dvips/pst-barcode/pst-barcode.pro @@ -1,9 +1,8 @@ %!PS - -% Barcode Writer in Pure PostScript - Version 2015-05-09 +% Barcode Writer in Pure PostScript - Version 2016-04-21 % http://bwipp.terryburton.co.uk % -% Copyright (c) 2004-2014 Terry Burton +% Copyright (c) 2004-2016 Terry Burton % % Permission is hereby granted, free of charge, to any % person obtaining a copy of this software and associated @@ -28,11 +27,11 @@ % CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN % CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS % IN THE SOFTWARE. -% + % --BEGIN TEMPLATE-- -% + % --BEGIN RESOURCE preamble-- -%%BeginResource: Category uk.co.terryburton.bwipp 0.0 2015050900 31191 34576 +%%BeginResource: Category uk.co.terryburton.bwipp 0.0 2016042100 31191 34576 %%BeginData: 6 ASCII Lines currentglobal true setglobal @@ -43,10 +42,10 @@ setglobal %%EndData %%EndResource % --END RESOURCE preamble-- -% + % --BEGIN RESOURCE raiseerror-- % --REQUIRES preamble-- -%%BeginResource: uk.co.terryburton.bwipp raiseerror 0.0 2015050900 44890 44440 +%%BeginResource: uk.co.terryburton.bwipp raiseerror 0.0 2016042100 44890 44440 %%BeginData: 13 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -67,18 +66,18 @@ end % --BEGIN RENDERER renlinear-- % --REQUIRES preamble raiseerror-- -%%BeginResource: uk.co.terryburton.bwipp renlinear 0.0 2015050900 76908 76502 +%%BeginResource: uk.co.terryburton.bwipp renlinear 0.0 2016042100 76908 76502 %%BeginData: 237 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict dup /raiseerror dup /uk.co.terryburton.bwipp findresource put begin /renlinear { -% + 20 dict begin % Confine variables to local scope -% + /args exch def % We are given some arguments -% + % Default options /sbs [] def /bhs [] def @@ -114,11 +113,11 @@ begin /guardrightypos 0 def /guardwidth 6 def /guardheight 7 def -% + % Apply the renderer options and the user options args {def} forall opt {def} forall -% + /barcolor barcolor cvlit def /textcolor textcolor cvlit def /textxalign textxalign cvlit def @@ -146,7 +145,7 @@ begin /guardrightypos guardrightypos cvr def /guardwidth guardwidth cvr def /guardheight guardheight cvr def -% + % Create bar elements and put them into the bars array /bars sbs length 1 add 2 idiv array def /x 0.00 def /maxh 0 def @@ -312,7 +311,7 @@ end % --BEGIN RENDERER renmatrix-- % --REQUIRES preamble raiseerror-- -%%BeginResource: uk.co.terryburton.bwipp renmatrix 0.0 2015050900 54074 54076 +%%BeginResource: uk.co.terryburton.bwipp renmatrix 0.0 2016042100 54074 54076 %%BeginData: 66 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -386,7 +385,7 @@ end % --BEGIN RENDERER renmaximatrix-- % --REQUIRES preamble raiseerror-- -%%BeginResource: uk.co.terryburton.bwipp renmaximatrix 0.0 2015050900 55426 55272 +%%BeginResource: uk.co.terryburton.bwipp renmaximatrix 0.0 2016042100 55426 55272 %%BeginData: 79 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -477,7 +476,7 @@ end % --EXAM: 90200 % --EXOP: includetext guardwhitespace % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp ean5 0.0 2015050900 62897 62576 +%%BeginResource: uk.co.terryburton.bwipp ean5 0.0 2016042100 62897 62576 %%BeginData: 135 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -624,7 +623,7 @@ end % --EXAM: 05 % --EXOP: includetext guardwhitespace % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp ean2 0.0 2015050900 61678 61382 +%%BeginResource: uk.co.terryburton.bwipp ean2 0.0 2016042100 61678 61382 %%BeginData: 120 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -756,7 +755,7 @@ end % --EXAM: 2112345678900 % --EXOP: includetext guardwhitespace % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp ean13 0.0 2015050900 84460 87603 +%%BeginResource: uk.co.terryburton.bwipp ean13 0.0 2016042100 84460 87603 %%BeginData: 215 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -983,7 +982,7 @@ end % --EXAM: 02345673 % --EXOP: includetext guardwhitespace % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp ean8 0.0 2015050900 81954 85278 +%%BeginResource: uk.co.terryburton.bwipp ean8 0.0 2016042100 81954 85278 %%BeginData: 196 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -1191,7 +1190,7 @@ end % --EXAM: 416000336108 % --EXOP: includetext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp upca 0.0 2015050900 89013 91922 +%%BeginResource: uk.co.terryburton.bwipp upca 0.0 2016042100 89013 91922 %%BeginData: 248 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -1451,7 +1450,7 @@ end % --EXAM: 00123457 % --EXOP: includetext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp upce 0.0 2015050900 92938 99490 +%%BeginResource: uk.co.terryburton.bwipp upce 0.0 2016042100 92938 99490 %%BeginData: 287 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -1750,7 +1749,7 @@ end % --EXAM: 978-1-56581-231-4 52250 % --EXOP: includetext guardwhitespace % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp isbn 0.0 2015050900 97266 100181 +%%BeginResource: uk.co.terryburton.bwipp isbn 0.0 2016042100 97266 100181 %%BeginData: 252 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -2014,7 +2013,7 @@ end % --EXAM: 979-0-2605-3211-3 % --EXOP: includetext guardwhitespace % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp ismn 0.0 2015050900 94206 93526 +%%BeginResource: uk.co.terryburton.bwipp ismn 0.0 2016042100 94206 93526 %%BeginData: 231 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -2257,7 +2256,7 @@ end % --EXAM: 0311-175X 00 17 % --EXOP: includetext guardwhitespace % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp issn 0.0 2015050900 85135 81376 +%%BeginResource: uk.co.terryburton.bwipp issn 0.0 2016042100 85135 81376 %%BeginData: 177 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -2443,11 +2442,11 @@ end % --BEGIN ENCODER code128-- % --REQUIRES preamble raiseerror renlinear-- % --DESC: Code 128 -% --EXAM: Count01234567^FNC2! -% --EXOP: includetext parsefnc +% --EXAM: Count01234567! +% --EXOP: includetext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp code128 0.0 2015050900 112448 118940 -%%BeginData: 421 ASCII Lines +%%BeginResource: uk.co.terryburton.bwipp code128 0.0 2016042100 118230 128296 +%%BeginData: 455 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict dup /raiseerror dup /uk.co.terryburton.bwipp findresource put @@ -2602,7 +2601,7 @@ begin (FNC1) fn1 (FNC2) fn2 (FNC3) fn3 - (FNC4) fn4 +% (FNC4) fn4 Not user accessible as encoded automatically (LNKA) lka (LNKC) lkc >> def @@ -2631,6 +2630,40 @@ begin /msglen msg length def /text text 0 j getinterval def + % Standard and extended ASCII runlength at position + /numSA [ msglen {0} repeat 0 ] def + /numEA [ msglen {0} repeat 0 ] def + msglen 1 sub -1 0 { + /i exch def + msg i get 0 ge { + msg i get 128 ge { + numEA i numEA i 1 add get 1 add put + } { + numSA i numSA i 1 add get 1 add put + } ifelse + } if + } for + + % FNC4 codeword insertion for extended ASCII + /ea false def /msgtmp [] def + 0 1 msglen 1 sub { + /i exch def + /c msg i get def + ea c 128 lt xor not c 0 ge and { % Other mode required + ea {numSA} {numEA} ifelse i get dup % Runlength of other mode + i add msglen eq {3} {5} ifelse % Does run terminate symbol + lt { % Shift + /msgtmp [ msgtmp aload pop fn4 ] def + } { % Latch + /msgtmp [ msgtmp aload pop fn4 fn4 ] def + /ea ea not def + } ifelse + } if + /msgtmp [ msgtmp aload pop c 0 ge {c 127 and} {c} ifelse ] def + } for + /msg msgtmp def + /msglen msg length def + % Determine digit runlength and characters from given position /numsscr { /n 0 def /s 0 def @@ -2879,7 +2912,7 @@ end % --EXAM: (01)95012345678903(3103)000123 % --EXOP: includetext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp gs1-128 0.0 2015050900 77611 77161 +%%BeginResource: uk.co.terryburton.bwipp gs1-128 0.0 2016042100 77699 77161 %%BeginData: 157 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -3048,7 +3081,7 @@ end % --EXAM: (01) 0 46 01234 56789 3 % --EXOP: includetext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp ean14 0.0 2015050900 69977 69481 +%%BeginResource: uk.co.terryburton.bwipp ean14 0.0 2016042100 69977 69481 %%BeginData: 105 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -3165,7 +3198,7 @@ end % --EXAM: (00) 0 0614141 123456789 0 % --EXOP: includetext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp sscc18 0.0 2015050900 69989 69488 +%%BeginResource: uk.co.terryburton.bwipp sscc18 0.0 2016042100 69989 69488 %%BeginData: 105 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -3282,7 +3315,7 @@ end % --EXAM: THIS IS CODE 39 % --EXOP: includetext includecheck includecheckintext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp code39 0.0 2015050900 67013 66837 +%%BeginResource: uk.co.terryburton.bwipp code39 0.0 2016042100 67013 66837 %%BeginData: 141 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -3435,7 +3468,7 @@ end % --EXAM: Code39 Ext! % --EXOP: includetext includecheck includecheckintext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp code39ext 0.0 2015050900 65652 65486 +%%BeginResource: uk.co.terryburton.bwipp code39ext 0.0 2016042100 65588 65334 %%BeginData: 110 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -3487,7 +3520,7 @@ begin } if % Validate the input - barcode 4 barcode length 4 sub getinterval { + barcode { 128 ge { /bwipp.code39extBadCharacter (Code 39 Extended must contain only ASCII characters) //raiseerror exec } if @@ -3557,7 +3590,7 @@ end % --EXAM: 01234567 % --EXOP: includetext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp code32 0.0 2015050900 63549 63380 +%%BeginResource: uk.co.terryburton.bwipp code32 0.0 2016042100 63549 63380 %%BeginData: 99 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -3668,7 +3701,7 @@ end % --EXAM: 123456 % --EXOP: includetext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp pzn 0.0 2015050900 63596 63384 +%%BeginResource: uk.co.terryburton.bwipp pzn 0.0 2016042100 63596 63384 %%BeginData: 100 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -3780,7 +3813,7 @@ end % --EXAM: THIS IS CODE 93 % --EXOP: includetext includecheck % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp code93 0.0 2015050900 65852 65716 +%%BeginResource: uk.co.terryburton.bwipp code93 0.0 2016042100 65852 65716 %%BeginData: 148 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -3940,7 +3973,7 @@ end % --EXAM: Code93 Ext! % --EXOP: includetext includecheck % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp code93ext 0.0 2015050900 65941 65711 +%%BeginResource: uk.co.terryburton.bwipp code93ext 0.0 2016042100 65941 65711 %%BeginData: 114 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -4066,7 +4099,7 @@ end % --EXAM: 2401234567 % --EXOP: height=0.5 includecheck includetext includecheckintext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp interleaved2of5 0.0 2015050900 65832 65492 +%%BeginResource: uk.co.terryburton.bwipp interleaved2of5 0.0 2016042100 65832 65492 %%BeginData: 150 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -4228,7 +4261,7 @@ end % --EXAM: 0 46 01234 56789 3 % --EXOP: includetext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp itf14 0.0 2015050900 65819 65737 +%%BeginResource: uk.co.terryburton.bwipp itf14 0.0 2016042100 65819 65737 %%BeginData: 109 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -4349,7 +4382,7 @@ end % --EXAM: 563102430313 % --EXOP: includetext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp identcode 0.0 2015050900 62754 62576 +%%BeginResource: uk.co.terryburton.bwipp identcode 0.0 2016042100 62754 62576 %%BeginData: 91 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -4452,7 +4485,7 @@ end % --EXAM: 21348075016401 % --EXOP: includetext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp leitcode 0.0 2015050900 62746 62572 +%%BeginResource: uk.co.terryburton.bwipp leitcode 0.0 2016042100 62746 62572 %%BeginData: 91 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -4555,7 +4588,7 @@ end % --EXAM: (01)24012345678905 % --EXOP: % --RNDR: renlinear renmatrix -%%BeginResource: uk.co.terryburton.bwipp databaromni 0.0 2015050900 112081 118257 +%%BeginResource: uk.co.terryburton.bwipp databaromni 0.0 2016042100 112081 118257 %%BeginData: 418 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -4985,7 +5018,7 @@ end % --EXAM: (01)24012345678905 % --EXOP: % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp databarstacked 0.0 2015050900 67872 71029 +%%BeginResource: uk.co.terryburton.bwipp databarstacked 0.0 2016042100 67872 71029 %%BeginData: 73 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -5070,7 +5103,7 @@ end % --EXAM: (01)24012345678905 % --EXOP: % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp databarstackedomni 0.0 2015050900 67972 71109 +%%BeginResource: uk.co.terryburton.bwipp databarstackedomni 0.0 2016042100 67972 71109 %%BeginData: 73 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -5155,7 +5188,7 @@ end % --EXAM: (01)24012345678905 % --EXOP: % --RNDR: renlinear renmatrix -%%BeginResource: uk.co.terryburton.bwipp databartruncated 0.0 2015050900 67898 71045 +%%BeginResource: uk.co.terryburton.bwipp databartruncated 0.0 2016042100 67898 71045 %%BeginData: 73 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -5240,7 +5273,7 @@ end % --EXAM: (01)15012345678907 % --EXOP: % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp databarlimited 0.0 2015050900 83260 86093 +%%BeginResource: uk.co.terryburton.bwipp databarlimited 0.0 2016042100 83260 86093 %%BeginData: 276 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -5528,7 +5561,7 @@ end % --EXAM: (01)95012345678903(3103)000123 % --EXOP: % --RNDR: renlinear renmatrix -%%BeginResource: uk.co.terryburton.bwipp databarexpanded 0.0 2015050900 197224 210202 +%%BeginResource: uk.co.terryburton.bwipp databarexpanded 0.0 2016042100 197224 210202 %%BeginData: 871 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -6411,7 +6444,7 @@ end % --EXAM: (01)95012345678903(3103)000123 % --EXOP: segments=4 % --RNDR: renlinear renmatrix -%%BeginResource: uk.co.terryburton.bwipp databarexpandedstacked 0.0 2015050900 63589 66857 +%%BeginResource: uk.co.terryburton.bwipp databarexpandedstacked 0.0 2016042100 63589 66857 %%BeginData: 43 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -6466,7 +6499,7 @@ end % --EXAM: 117480 % --EXOP: showborder % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp pharmacode 0.0 2015050900 60269 60124 +%%BeginResource: uk.co.terryburton.bwipp pharmacode 0.0 2016042100 60269 60124 %%BeginData: 91 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -6569,7 +6602,7 @@ end % --EXAM: 117480 % --EXOP: includetext showborder % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp pharmacode2 0.0 2015050900 60956 60646 +%%BeginResource: uk.co.terryburton.bwipp pharmacode2 0.0 2016042100 60956 60646 %%BeginData: 96 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -6677,7 +6710,7 @@ end % --EXAM: 01234567 % --EXOP: includetext includecheck includecheckintext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp code2of5 0.0 2015050900 67430 67109 +%%BeginResource: uk.co.terryburton.bwipp code2of5 0.0 2016042100 67430 67109 %%BeginData: 150 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -6839,7 +6872,7 @@ end % --EXAM: 01234567 % --EXOP: includetext includecheck includecheckintext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp industrial2of5 0.0 2015050900 57882 57606 +%%BeginResource: uk.co.terryburton.bwipp industrial2of5 0.0 2016042100 57882 57606 %%BeginData: 55 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -6906,7 +6939,7 @@ end % --EXAM: 01234567 % --EXOP: includetext includecheck includecheckintext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp iata2of5 0.0 2015050900 57852 57582 +%%BeginResource: uk.co.terryburton.bwipp iata2of5 0.0 2016042100 57852 57582 %%BeginData: 55 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -6973,7 +7006,7 @@ end % --EXAM: 01234567 % --EXOP: includetext includecheck includecheckintext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp matrix2of5 0.0 2015050900 57862 57590 +%%BeginResource: uk.co.terryburton.bwipp matrix2of5 0.0 2016042100 57862 57590 %%BeginData: 55 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -7040,7 +7073,7 @@ end % --EXAM: 01234567 % --EXOP: includetext includecheck includecheckintext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp coop2of5 0.0 2015050900 57852 57582 +%%BeginResource: uk.co.terryburton.bwipp coop2of5 0.0 2016042100 57852 57582 %%BeginData: 55 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -7107,7 +7140,7 @@ end % --EXAM: 01234567 % --EXOP: includetext includecheck includecheckintext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp datalogic2of5 0.0 2015050900 57877 57602 +%%BeginResource: uk.co.terryburton.bwipp datalogic2of5 0.0 2016042100 57877 57602 %%BeginData: 55 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -7174,7 +7207,7 @@ end % --EXAM: 0123456789 % --EXOP: includetext includecheck includecheckintext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp code11 0.0 2015050900 69086 68582 +%%BeginResource: uk.co.terryburton.bwipp code11 0.0 2016042100 69086 68582 %%BeginData: 158 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -7344,7 +7377,7 @@ end % --EXAM: BC412 % --EXOP: semi includetext includecheckintext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp bc412 0.0 2015050900 64995 64541 +%%BeginResource: uk.co.terryburton.bwipp bc412 0.0 2016042100 64995 64541 %%BeginData: 148 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -7504,7 +7537,7 @@ end % --EXAM: A0123456789B % --EXOP: includetext includecheck includecheckintext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp rationalizedCodabar 0.0 2015050900 69398 68906 +%%BeginResource: uk.co.terryburton.bwipp rationalizedCodabar 0.0 2016042100 69398 68906 %%BeginData: 156 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -7672,7 +7705,7 @@ end % --EXAM: 0123456709498765432101234567891 % --EXOP: barcolor=FF0000 % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp onecode 0.0 2015050900 101896 104906 +%%BeginResource: uk.co.terryburton.bwipp onecode 0.0 2016042100 101896 104906 %%BeginData: 335 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -8019,7 +8052,7 @@ end % --EXAM: 01234 % --EXOP: includetext includecheckintext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp postnet 0.0 2015050900 65689 65439 +%%BeginResource: uk.co.terryburton.bwipp postnet 0.0 2016042100 65689 65439 %%BeginData: 140 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -8171,7 +8204,7 @@ end % --EXAM: 01234567890 % --EXOP: includetext includecheckintext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp planet 0.0 2015050900 65565 65215 +%%BeginResource: uk.co.terryburton.bwipp planet 0.0 2016042100 65565 65215 %%BeginData: 141 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -8324,7 +8357,7 @@ end % --EXAM: LE28HS9Z % --EXOP: includetext barcolor=FF0000 % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp royalmail 0.0 2015050900 66136 65853 +%%BeginResource: uk.co.terryburton.bwipp royalmail 0.0 2016042100 66136 65853 %%BeginData: 145 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -8481,7 +8514,7 @@ end % --EXAM: 5956439111ABA 9 % --EXOP: includetext custinfoenc=character % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp auspost 0.0 2015050900 75628 75331 +%%BeginResource: uk.co.terryburton.bwipp auspost 0.0 2016042100 75628 75331 %%BeginData: 202 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -8695,7 +8728,7 @@ end % --EXAM: 1231FZ13XHS % --EXOP: includetext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp kix 0.0 2015050900 61942 61672 +%%BeginResource: uk.co.terryburton.bwipp kix 0.0 2016042100 61942 61672 %%BeginData: 111 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -8818,7 +8851,7 @@ end % --EXAM: 6540123789-A-K-Z % --EXOP: includetext includecheckintext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp japanpost 0.0 2015050900 66345 66129 +%%BeginResource: uk.co.terryburton.bwipp japanpost 0.0 2016042100 66345 66129 %%BeginData: 162 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -8992,7 +9025,7 @@ end % --EXAM: 0123456789 % --EXOP: includetext includecheck includecheckintext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp msi 0.0 2015050900 71052 70834 +%%BeginResource: uk.co.terryburton.bwipp msi 0.0 2016042100 71052 70834 %%BeginData: 139 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -9143,7 +9176,7 @@ end % --EXAM: 01234ABCD % --EXOP: includetext includecheckintext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp plessey 0.0 2015050900 67754 67457 +%%BeginResource: uk.co.terryburton.bwipp plessey 0.0 2016042100 67754 67457 %%BeginData: 146 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -9301,7 +9334,7 @@ end % --EXAM: ABCDEF % --EXOP: includetext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp telepen 0.0 2015050900 68624 68368 +%%BeginResource: uk.co.terryburton.bwipp telepen 0.0 2016042100 68624 68368 %%BeginData: 173 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -9486,7 +9519,7 @@ end % --EXAM: 01234567 % --EXOP: includetext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp telepennumeric 0.0 2015050900 57870 57594 +%%BeginResource: uk.co.terryburton.bwipp telepennumeric 0.0 2016042100 57870 57594 %%BeginData: 55 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -9553,8 +9586,8 @@ end % --EXAM: ABC123 % --EXOP: version=b inkspread=-0.5 parsefnc includetext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp posicode 0.0 2015050900 101857 104871 -%%BeginData: 389 ASCII Lines +%%BeginResource: uk.co.terryburton.bwipp posicode 0.0 2016042100 106927 109835 +%%BeginData: 423 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict dup /raiseerror dup /uk.co.terryburton.bwipp findresource put @@ -9710,7 +9743,7 @@ begin (FNC1) fn1 (FNC2) fn2 (FNC3) fn3 - (FNC4) fn4 +% (FNC4) fn4 Not user accessible as encoded automatically >> def % Convert input into bytes accounting for FNC characters @@ -9737,13 +9770,47 @@ begin /msglen msg length def /text text 0 j getinterval def + % Standard and extended ASCII runlength at position + /numSA [ msglen {0} repeat 0 ] def + /numEA [ msglen {0} repeat 0 ] def + msglen 1 sub -1 0 { + /i exch def + msg i get 0 ge { + msg i get 128 ge { + numEA i numEA i 1 add get 1 add put + } { + numSA i numSA i 1 add get 1 add put + } ifelse + } if + } for + + % FNC4 codeword insertion for extended ASCII + /ea false def /msgtmp [] def + 0 1 msglen 1 sub { + /i exch def + /c msg i get def + ea c 128 lt xor not c 0 ge and { % Other mode required + ea {numSA} {numEA} ifelse i get dup % Runlength of other mode + i add msglen eq {3} {5} ifelse % Does run terminate symbol + lt { % Shift + /msgtmp [ msgtmp aload pop fn4 ] def + } { % Latch + /msgtmp [ msgtmp aload pop fn4 fn4 ] def + /ea ea not def + } ifelse + } if + /msgtmp [ msgtmp aload pop c 0 ge {c 127 and} {c} ifelse ] def + } for + /msg msgtmp def + /msglen msg length def + % Convert the input message to codewords /enc { exch get cws exch j exch put /j j 1 add def } bind def - /cws barcode length 2 mul array def + /cws msglen 2 mul array def /i 0 def /j 0 def /cset (set0) def { i msglen eq {exit} if @@ -9954,8 +10021,8 @@ end % --EXAM: CODABLOCK F 34567890123456789010040digit % --EXOP: columns=8 % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp codablockf 0.0 2015050900 125044 131468 -%%BeginData: 512 ASCII Lines +%%BeginResource: uk.co.terryburton.bwipp codablockf 0.0 2016042100 126266 132420 +%%BeginData: 521 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict dup /raiseerror dup /uk.co.terryburton.bwipp findresource put @@ -10081,9 +10148,9 @@ begin /fncvals << (FNC1) fn1 - (FNC2) fn2 +% (FNC2) fn2 Not permitted for Codablock F (FNC3) fn3 - (FNC4) fn4 +% (FNC4) fn4 Not user accessible as encoded automatically >> def /msg barlen array def /i 0 def /j 0 def { @@ -10104,6 +10171,15 @@ begin /msg msg 0 j getinterval def /msglen msg length def + % FNC4 codeword insertion for extended ASCII + /msgtmp [] def + msg { + /char exch def + /msgtmp [ msgtmp aload pop char 128 lt {char} {fn4 char 127 and} ifelse ] def + } forall + /msg msgtmp def + /msglen msg length def + % Determine digit runlength and characters from given position /numsscr { /n 0 def /s 0 def @@ -10478,8 +10554,8 @@ end % --EXAM: Abcd-1234567890-wxyZ % --EXOP: % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp code16k 0.0 2015050900 142769 155916 -%%BeginData: 710 ASCII Lines +%%BeginResource: uk.co.terryburton.bwipp code16k 0.0 2016042100 147911 164544 +%%BeginData: 744 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict dup /raiseerror dup /uk.co.terryburton.bwipp findresource put @@ -10630,7 +10706,7 @@ begin (FNC1) fn1 (FNC2) fn2 (FNC3) fn3 - (FNC4) fn4 +% (FNC4) fn4 Not user accessible as encoded automatically >> def /msg barlen array def /i 0 def /j 0 def { @@ -10650,7 +10726,41 @@ begin } loop /msg msg 0 j getinterval def /msglen msg length def - + + % Standard and extended ASCII runlength at position + /numSA [ msglen {0} repeat 0 ] def + /numEA [ msglen {0} repeat 0 ] def + msglen 1 sub -1 0 { + /i exch def + msg i get 0 ge { + msg i get 128 ge { + numEA i numEA i 1 add get 1 add put + } { + numSA i numSA i 1 add get 1 add put + } ifelse + } if + } for + + % FNC4 codeword insertion for extended ASCII + /ea false def /msgtmp [] def + 0 1 msglen 1 sub { + /i exch def + /c msg i get def + ea c 128 lt xor not c 0 ge and { % Other mode required + ea {numSA} {numEA} ifelse i get dup % Runlength of other mode + i add msglen eq {3} {5} ifelse % Does run terminate symbol + lt { % Shift + /msgtmp [ msgtmp aload pop fn4 ] def + } { % Latch + /msgtmp [ msgtmp aload pop fn4 fn4 ] def + /ea ea not def + } ifelse + } if + /msgtmp [ msgtmp aload pop c 0 ge {c 127 and} {c} ifelse ] def + } for + /msg msgtmp def + /msglen msg length def + % Determine digit runlength and characters from given position /numsscr { /n 0 def /s 0 def @@ -11200,7 +11310,7 @@ end % --EXAM: MULTIPLE ROWS IN CODE 49 % --EXOP: % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp code49 0.0 2015050900 218104 234960 +%%BeginResource: uk.co.terryburton.bwipp code49 0.0 2016042100 218104 234960 %%BeginData: 1076 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -12288,7 +12398,7 @@ end % --EXAM: 3493 % --EXOP: height=0.5 includetext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp channelcode 0.0 2015050900 68302 68105 +%%BeginResource: uk.co.terryburton.bwipp channelcode 0.0 2016042100 68302 68105 %%BeginData: 149 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -12449,7 +12559,7 @@ end % --EXAM: 11099 % --EXOP: inkspread=-0.25 showborder borderleft=0 borderright=0 % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp flattermarken 0.0 2015050900 59248 59148 +%%BeginResource: uk.co.terryburton.bwipp flattermarken 0.0 2016042100 59248 59148 %%BeginData: 93 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -12554,7 +12664,7 @@ end % --EXAM: 331132131313411122131311333213114131131221323 % --EXOP: height=0.5 % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp raw 0.0 2015050900 55514 55371 +%%BeginResource: uk.co.terryburton.bwipp raw 0.0 2016042100 55514 55371 %%BeginData: 52 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -12618,7 +12728,7 @@ end % --EXAM: FATDAFTDAD % --EXOP: % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp daft 0.0 2015050900 58288 58222 +%%BeginResource: uk.co.terryburton.bwipp daft 0.0 2016042100 58288 58222 %%BeginData: 76 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -12706,7 +12816,7 @@ end % --EXAM: fima % --EXOP: backgroundcolor=DD000011 % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp symbol 0.0 2015050900 58044 57965 +%%BeginResource: uk.co.terryburton.bwipp symbol 0.0 2016042100 58044 57965 %%BeginData: 72 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -12790,7 +12900,7 @@ end % --EXAM: This is PDF417 % --EXOP: columns=2 % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp pdf417 0.0 2015050900 188276 197810 +%%BeginResource: uk.co.terryburton.bwipp pdf417 0.0 2016042100 188276 197810 %%BeginData: 873 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -13675,7 +13785,7 @@ end % --EXAM: This is compact PDF417 % --EXOP: columns=2 % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp pdf417compact 0.0 2015050900 60668 60355 +%%BeginResource: uk.co.terryburton.bwipp pdf417compact 0.0 2016042100 60668 60355 %%BeginData: 43 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -13730,8 +13840,8 @@ end % --EXAM: MicroPDF417 % --EXOP: % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp micropdf417 0.0 2015050900 200331 213151 -%%BeginData: 952 ASCII Lines +%%BeginResource: uk.co.terryburton.bwipp micropdf417 0.0 2016042100 201094 213914 +%%BeginData: 959 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict dup /raiseerror dup /uk.co.terryburton.bwipp findresource put @@ -13745,6 +13855,7 @@ begin /barcode exch def /dontdraw false def + /version (unset) def /columns 0 def /rows 0 def /rowmult 2 def @@ -13765,6 +13876,12 @@ begin } if options {def} forall + version (unset) ne { + version (x) search + pop /columns exch def + pop /rows exch def + } if + /columns columns cvi def /rows rows cvi def /rowmult rowmult cvr def @@ -14694,8 +14811,8 @@ end % --EXAM: This is Data Matrix! % --EXOP: % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp datamatrix 0.0 2015050900 189975 216544 -%%BeginData: 844 ASCII Lines +%%BeginResource: uk.co.terryburton.bwipp datamatrix 0.0 2016042100 199528 218903 +%%BeginData: 871 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict dup /raiseerror dup /uk.co.terryburton.bwipp findresource put @@ -14711,8 +14828,11 @@ begin /dontdraw false def /columns 0 def /rows 0 def + /format (square) def % square or rectangle + /version (unset) def /parse false def /parsefnc false def + /dmre false def % Parse the input options options type /stringtype eq { @@ -14725,6 +14845,12 @@ begin } if options {def} forall + version (unset) ne { + version (x) search + pop /rows exch def + pop /columns exch def + } if + /columns columns cvi def /rows rows cvi def @@ -14809,10 +14935,22 @@ begin % Optional rectangular symbols [ 8 18 1 1 7 1 ] [ 8 32 1 2 11 1 ] + dmre { [ 8 48 1 2 15 1 ] } if + dmre { [ 8 64 1 4 18 1 ] } if [ 12 26 1 1 14 1 ] [ 12 36 1 2 18 1 ] + dmre { [ 12 64 1 4 27 1 ] } if [ 16 36 1 2 24 1 ] [ 16 48 1 2 28 1 ] + dmre { [ 16 64 1 4 36 1 ] } if + dmre { [ 24 32 1 2 28 1 ] } if + dmre { [ 24 36 1 2 33 1 ] } if + dmre { [ 24 48 1 2 41 1 ] } if + dmre { [ 24 64 1 4 46 1 ] } if + dmre { [ 26 32 1 2 32 1 ] } if + dmre { [ 26 40 1 2 38 1 ] } if + dmre { [ 26 48 1 2 42 1 ] } if + dmre { [ 26 64 1 4 50 1 ] } if ] def % Create array of codewords remaining to make a full symbol @@ -14833,7 +14971,8 @@ begin /okay true def urows 0 ne urows rows ne and {/okay false def} if ucols 0 ne ucols cols ne and {/okay false def} if - urows 0 eq ucols 0 eq or rows cols ne and {/okay false def} if + format (square) eq rows cols ne and {/okay false def} if + format (rectangle) eq rows cols eq and {/okay false def} if okay {/fullcws [ fullcws aload pop ncws ] def} if } forall /numremcws [ 1558 {10000} repeat ] def @@ -15007,11 +15146,11 @@ begin C exit } if /char msg i k add get def - /ac ac isD {1 2 div add} {isEA {ceiling 2 add} {1 add } ifelse} ifelse def - /cc cc isC {2 3 div add} {isEA { 8 3 div add } { 4 3 div add} ifelse} ifelse def - /tc tc isT {2 3 div add} {isEA { 8 3 div add } { 4 3 div add} ifelse} ifelse def - /xc xc isX {2 3 div add} {isEA {13 3 div add } {10 3 div add} ifelse} ifelse def - /ec ec isE {3 4 div add} {isEA {17 4 div add } {13 4 div add} ifelse} ifelse def + /ac ac isD {1 2 div add} {isEA {ceiling 2 add} {ceiling 1 add} ifelse} ifelse def + /cc cc isC {2 3 div add} {isEA { 8 3 div add } { 4 3 div add } ifelse} ifelse def + /tc tc isT {2 3 div add} {isEA { 8 3 div add } { 4 3 div add } ifelse} ifelse def + /xc xc isX {2 3 div add} {isEA {13 3 div add } {10 3 div add } ifelse} ifelse def + /ec ec isE {3 4 div add} {isEA {17 4 div add } {13 4 div add } ifelse} ifelse def /bc bc isFN {4 add} {1 add} ifelse def k 4 ge { true [ cc tc xc ec bc] {ac 1 add exch le and} forall {A exit} if @@ -15314,6 +15453,8 @@ begin cws length ncws ne {/okay false def} if urows 0 ne urows rows ne and {/okay false def} if ucols 0 ne ucols cols ne and {/okay false def} if + format (square) eq rows cols ne and {/okay false def} if + format (rectangle) eq rows cols eq and {/okay false def} if okay {exit} if /i i 1 add def } loop @@ -15411,6 +15552,9 @@ begin mcols add exch 4 mcols 4 add 8 mod sub add exch } if + 1 index mrows ge { + exch mrows sub exch + } if exch mcols mul add mmat exch 5 -1 roll put } forall @@ -15544,14 +15688,69 @@ end %%EndResource % --END ENCODER datamatrix-- +% --BEGIN ENCODER datamatrixrectangular-- +% --REQUIRES preamble raiseerror renmatrix datamatrix-- +% --DESC: Data Matrix Rectangular +% --EXAM: 1234 +% --EXOP: +% --RNDR: renmatrix +%%BeginResource: uk.co.terryburton.bwipp datamatrixrectangular 0.0 2016042100 60716 60395 +%%BeginData: 43 ASCII Lines +/setpacking where {pop currentpacking true setpacking} if +1 dict +dup /raiseerror dup /uk.co.terryburton.bwipp findresource put +dup /renmatrix dup /uk.co.terryburton.bwipp findresource put +dup /datamatrix dup /uk.co.terryburton.bwipp findresource put +begin +/datamatrixrectangular { + + 20 dict begin % Confine variables to local scope + + /options exch def % We are given an option string + /barcode exch def % We are given a barcode string + + /dontdraw false def + + % Parse the input options + options type /stringtype eq { + 1 dict begin + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + currentdict end /options exch def + } if + options {def} forall + + % Get the result of encoding with datamatrix with format=rectangle + options (dontdraw) true put + options (format) (rectangle) put + + /args barcode options //datamatrix exec def + + args (opt) options put + args + + dontdraw not //renmatrix if + + end + +} bind def +/datamatrixrectangular dup load /uk.co.terryburton.bwipp defineresource pop +end +/setpacking where {pop setpacking} if +%%EndData +%%EndResource +% --END ENCODER datamatrixrectangular-- + % --BEGIN ENCODER qrcode-- % --REQUIRES preamble raiseerror renmatrix-- % --DESC: QR Code % --EXAM: http://goo.gl/0bis % --EXOP: eclevel=M % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp qrcode 0.0 2015050900 265291 275512 -%%BeginData: 1004 ASCII Lines +%%BeginResource: uk.co.terryburton.bwipp qrcode 0.0 2016042100 267379 277512 +%%BeginData: 1019 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict dup /raiseerror dup /uk.co.terryburton.bwipp findresource put @@ -15570,6 +15769,7 @@ begin /eclevel (unset) def % L, M, Q or H /parse false def /parsefnc false def + /mask -1 def % Parse the input options options type /stringtype eq { @@ -15582,6 +15782,8 @@ begin } if options {def} forall + /mask mask cvi def + % Parse ordinals of the form ^NNN to ASCII parse { /msg barcode length string def @@ -16090,6 +16292,9 @@ begin cws c cw put } for + % Short final data byte in M1 and M3 symbols has high-order value + lc4b {cws cws length 1 sub 2 copy get 4 bitshift put} if + % Calculate the log and anti-log tables /rsalog [ 1 255 { dup 2 mul dup 256 ge {285 xor} if } repeat ] def /rslog 256 array def @@ -16179,6 +16384,7 @@ begin % Fixups for the short final data byte in M1 and M3 symbols lc4b { + cws dcws 1 sub 2 copy get -4 bitshift put dcws 1 sub 1 ncws 2 sub { /i exch def cws i cws i get 15 and 4 bitshift put @@ -16327,6 +16533,10 @@ begin {2 copy mul 3 mod 3 1 roll add 2 mod add 2 mod} bind ] def } ifelse + mask -1 ne { % User specifies a mask + /maskfuncs [maskfuncs mask 1 sub get] def + /bestmaskval mask 1 sub def + } if /masks maskfuncs length array def 0 1 masks length 1 sub { /m exch def @@ -16479,16 +16689,20 @@ begin /i exch def masksym i pixs i get masks m get i get xor put } for - format (full) eq { - masksym evalfull /score exch def + masks length 1 ne { + format (full) eq { + masksym evalfull /score exch def + } { + masksym evalmicro /score exch def + } ifelse + score bestscore lt { + /bestsym masksym def + /bestmaskval m def + /bestscore score def + } if } { - masksym evalmicro /score exch def - } ifelse - score bestscore lt { /bestsym masksym def - /bestmaskval m def - /bestscore score def - } if + } ifelse } for /pixs bestsym def @@ -16566,7 +16780,7 @@ end % --EXAM: 1234 % --EXOP: % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp microqrcode 0.0 2015050900 60576 60353 +%%BeginResource: uk.co.terryburton.bwipp microqrcode 0.0 2016042100 60576 60353 %%BeginData: 43 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -16621,7 +16835,7 @@ end % --EXAM: [)>^03001^02996152382802^029840^029001^0291Z00004951^029UPSN^02906X610^029159^0291234567^0291/1^029^029Y^029634 ALPHA DR^029PITTSBURGH^029PA^029^004 % --EXOP: mode=2 parse % --RNDR: renmaximatrix -%%BeginResource: uk.co.terryburton.bwipp maxicode 0.0 2015050900 116961 123452 +%%BeginResource: uk.co.terryburton.bwipp maxicode 0.0 2016042100 116961 123452 %%BeginData: 564 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -17197,7 +17411,7 @@ end % --EXAM: This is Aztec Code % --EXOP: format=full % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp azteccode 0.0 2015050900 163082 186690 +%%BeginResource: uk.co.terryburton.bwipp azteccode 0.0 2016042100 163082 186690 %%BeginData: 679 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -17888,7 +18102,7 @@ end % --EXAM: 1234 % --EXOP: % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp azteccodecompact 0.0 2015050900 60604 60376 +%%BeginResource: uk.co.terryburton.bwipp azteccodecompact 0.0 2016042100 60604 60376 %%BeginData: 43 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -17943,7 +18157,7 @@ end % --EXAM: 1 % --EXOP: % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp aztecrune 0.0 2015050900 60573 60352 +%%BeginResource: uk.co.terryburton.bwipp aztecrune 0.0 2016042100 60573 60352 %%BeginData: 43 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -17996,10 +18210,10 @@ end % --REQUIRES preamble raiseerror renmatrix-- % --DESC: Code One % --EXAM: Code One -% --EXOP: version=B +% --EXOP: % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp codeone 0.0 2015050900 119329 129149 -%%BeginData: 512 ASCII Lines +%%BeginResource: uk.co.terryburton.bwipp codeone 0.0 2016042100 190508 210074 +%%BeginData: 851 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict dup /raiseerror dup /uk.co.terryburton.bwipp findresource put @@ -18014,9 +18228,8 @@ begin /dontdraw false def /version (unset) def - /encoding (ascii) def - /raw false def /parse false def + /parsefnc false def % Parse the input options options type /stringtype eq { @@ -18052,182 +18265,28 @@ begin /barlen barcode length def - raw {/encoding (raw) def} if - /stype version 0 1 getinterval (S) eq def - stype {/encoding (stype) def} if - - encoding (raw) eq { - /cws barlen array def - /i 0 def /j 0 def - { % loop - i barlen eq {exit} if - /cw barcode i 1 add 3 getinterval cvi def - cws j cw put - /i i 4 add def - /j j 1 add def - } loop - /cws cws 0 j getinterval def - } if - - encoding (ascii) eq { - /cws barlen 2 mul array def - /i 0 def /j 0 def - { % loop - i barlen eq {exit} if - /char barcode i get def - char 48 ge char 57 le and i barlen 1 sub lt and { - barcode i 1 add get dup 48 ge exch 57 le and { % Digit pair - cws j barcode i 2 getinterval cvi 130 add put - /i i 2 add def - /j j 1 add def - } { % Singular digit - cws j char 1 add put - /i i 1 add def - /j j 1 add def - } ifelse - } { char 127 le { % ASCII - cws j char 1 add put - /i i 1 add def - /j j 1 add def - } { % Extended ASCII - cws j 235 put - cws j 1 add char 127 sub put - /i i 1 add def - /j j 2 add def - } ifelse } ifelse - } loop - /cws cws 0 j getinterval def - } if - encoding (stype) eq { + stype { /vals [ - [ (0) (1) (10) (11) (100) - (101) (110) (111) (1000) (1001) - ] - [ (0) (1010) (10100) (11110) (101000) - (110010) (111100) (1000110) (1010000) (1011010) - ] - [ (0) (1100100) (11001000) (100101100) - (110010000) (111110100) (1001011000) - (1010111100) (1100100000) (1110000100) - ] - [ (0) (1111101000) (11111010000) (101110111000) - (111110100000) (1001110001000) (1011101110000) - (1101101011000) (1111101000000) (10001100101000) - ] - [ (0) (10011100010000) (100111000100000) (111010100110000) - (1001110001000000) (1100001101010000) (1110101001100000) - (10001000101110000) (10011100010000000) (10101111110010000) - ] - [ (0) (11000011010100000) (110000110101000000) (1001001001111100000) - (1100001101010000000) (1111010000100100000) (10010010011111000000) - (10101010111001100000) (11000011010100000000) (11011011101110100000) - ] - [ (0) (11110100001001000000) - (111101000010010000000) (1011011100011011000000) - (1111010000100100000000) (10011000100101101000000) - (10110111000110110000000) (11010101100111111000000) - (11110100001001000000000) (100010010101010001000000) - ] - [ (0) (100110001001011010000000) - (1001100010010110100000000) (1110010011100001110000000) - (10011000100101101000000000) (10111110101111000010000000) - (11100100111000011100000000) (100001011000001110110000000) - (100110001001011010000000000) (101010111010100101010000000) - ] - [ (0) (101111101011110000100000000) - (1011111010111100001000000000) (10001111000011010001100000000) - (10111110101111000010000000000) (11101110011010110010100000000) - (100011110000110100011000000000) (101001101110010010011100000000) - (101111101011110000100000000000) (110101101001001110100100000000) - ] - [ (0) (111011100110101100101000000000) - (1110111001101011001010000000000) (10110010110100000101111000000000) - (11101110011010110010100000000000) (100101010000001011111001000000000) - (101100101101000001011110000000000) (110100001001110111000011000000000) - (111011100110101100101000000000000) (1000011000011100010001101000000000) - ] - [ (0) (1001010100000010111110010000000000) - (10010101000000101111100100000000000) - (11011111100001000111010110000000000) - (100101010000001011111001000000000000) - (101110100100001110110111010000000000) - (110111111000010001110101100000000000) - (1000001001100010100110011110000000000) - (1001010100000010111110010000000000000) - (1010011110100011010110000010000000000) - ] - [ (0) (1011101001000011101101110100000000000) - (10111010010000111011011101000000000000) - (100010111011001011001001011100000000000) - (101110100100001110110111010000000000000) - (111010001101010010100101000100000000000) - (1000101110110010110010010111000000000000) - (1010001011111011010000000101100000000000) - (1011101001000011101101110100000000000000) - (1101000110001100001011100010100000000000) - ] - [ (0) (1110100011010100101001010001000000000000) - (11101000110101001010010100010000000000000) - (101011101001111101111011110011000000000000) - (111010001101010010100101000100000000000000) - (1001000110000100111001110010101000000000000) - (1010111010011111011110111100110000000000000) - (1100101110111010000100000110111000000000000) - (1110100011010100101001010001000000000000000) - (10000010111101111001110011011001000000000000) - ] - [ (0) (10010001100001001110011100101010000000000000) - (100100011000010011100111001010100000000000000) - (110110100100011101011010101111110000000000000) - (1001000110000100111001110010101000000000000000) - (1011010111100110001000001111010010000000000000) - (1101101001000111010110101011111100000000000000) - (1111111010101000100101001000100110000000000000) - (10010001100001001110011100101010000000000000000) - (10100011101101011000010000001111010000000000000) - ] - [ (0) (10110101111001100010000011110100100000000000000) - (101101011110011000100000111101001000000000000000) - (1000100001101100100110001011011101100000000000000) - (1011010111100110001000001111010010000000000000000) - (1110001101011111101010010011000110100000000000000) - (10001000011011001001100010110111011000000000000000) - (10011111001010010101110011010101111100000000000000) - (10110101111001100010000011110100100000000000000000) - (11001100101000101110010100010011000100000000000000) - ] - [ (0) (11100011010111111010100100110001101000000000000000) - (111000110101111110101001001100011010000000000000000) - (1010101010000111101111101110010100111000000000000000) - (1110001101011111101010010011000110100000000000000000) - (10001110000110111100100110111111000001000000000000000) - (10101010100001111011111011100101001110000000000000000) - (11000110111100111011010000001011011011000000000000000) - (11100011010111111010100100110001101000000000000000000) - (11111111110010111001111001010111110101000000000000000) - ] - [ (0) (100011100001101111001001101111110000010000000000000000) - (1000111000011011110010011011111100000100000000000000000) - (1101010100101001101011101001111010000110000000000000000) - (10001110000110111100100110111111000001000000000000000000) - (10110001101000101011110000101110110001010000000000000000) - (11010101001010011010111010011110100001100000000000000000) - (11111000101100001010000100001110010001110000000000000000) - (100011100001101111001001101111110000010000000000000000000) - (100111111101111101000010111101101110010010000000000000000) - ] - [ (0) (101100011010001010111100001011101100010100000000000000000) - (1011000110100010101111000010111011000101000000000000000000) - (10000101001110100000110100100011000100111100000000000000000) - (10110001101000101011110000101110110001010000000000000000000) - (11011110000010110110101100111010011101100100000000000000000) - (100001010011101000001101001000110001001111000000000000000000) - (100110110110111001100100101010001110110001100000000000000000) - (101100011010001010111100001011101100010100000000000000000000) - (110001111101011100010011101101001001110110100000000000000000) - ] + (1) + (1010) + (1100100) + (1111101000) + (10011100010000) + (11000011010100000) + (11110100001001000000) + (100110001001011010000000) + (101111101011110000100000000) + (111011100110101100101000000000) + (1001010100000010111110010000000000) + (1011101001000011101101110100000000000) + (1110100011010100101001010001000000000000) + (10010001100001001110011100101010000000000000) + (10110101111001100010000011110100100000000000000) + (11100011010111111010100100110001101000000000000000) + (100011100001101111001001101111110000010000000000000000) + (101100011010001010111100001011101100010100000000000000000) ] def /normalize { @@ -18265,8 +18324,8 @@ begin /v [ 1 ] def 0 1 barlen 1 sub { /i exch def - vals i get barcode barlen i sub 1 sub get 48 sub get - [ exch {48 sub} forall ] v bigadd /v exch def + [ vals i get {48 sub barcode barlen i sub 1 sub get 48 sub mul} forall ] + v bigadd /v exch def } for /v v 2 normalize def @@ -18280,82 +18339,576 @@ begin cws exch i exch put } for - } if - - % Basic metrics for the each symbol - % ver row col dcol dcws rscw rsbl ro ri rl - /metrics [ - [ (A) 16 18 16 10 10 1 4 99 6 ] - [ (B) 22 22 20 19 16 1 4 99 8 ] - [ (C) 28 32 28 44 26 1 4 22 11 ] - [ (D) 40 42 36 91 44 1 4 16 16 ] - [ (E) 52 54 48 182 70 1 4 22 22 ] - [ (F) 70 76 68 370 140 2 4 22 31 ] - [ (G) 104 98 88 732 280 4 6 21 47 ] - [ (H) 148 134 120 1480 560 8 6 20 69 ] - [ (S-10) 8 11 10 4 4 1 99 99 99 ] - [ (S-20) 8 21 20 8 8 1 99 99 99 ] - [ (S-30) 8 31 30 12 12 1 99 99 99 ] - [ (T-16) 16 17 16 10 10 1 99 99 99 ] - [ (T-32) 16 33 32 24 16 1 99 99 99 ] - [ (T-48) 16 49 48 38 22 1 99 99 99 ] - ] def - - % Select metrics of an appropriate symbol - /i 0 def - { % loop - /m metrics i get def - /vers m 0 get def % Version of symbol - /rows m 1 get def % Rows in symbol - /cols m 2 get def % Columns in symbol - /dcol m 3 get def % Data columns in symbol - /dcws m 4 get def % Data codewords in symbol - /rscw m 5 get def % Error correction codewords - /rsbl m 6 get def % Error correction blocks - /riso m 7 get def % Riser offset - /risi m 8 get def % Riser interval - /risl m 9 get def % Riser length - /dcpb dcws rsbl idiv def % Data codewords per block - /ecpb rscw rsbl idiv def % Error codewords per block - /okay true def - version (unset) ne version vers ne and {/okay false def} if % The version must match that supplied - cws length dcws gt {/okay false def} if - okay {exit} if - /i i 1 add def - } loop - - % Extend cws to ncws codewords by addition of pad characters - stype not { - /cws [ cws aload pop dcws cws length sub {129} repeat ] def - } { - /cws [ dcws cws length sub {0} repeat cws aload pop ] def - } ifelse + } { % Standard and type-T - % De-interleave the codewords into blocks - /cwbs rsbl array def % Array of data codeword blocks - /ecbs rsbl array def % Array of error correction blocks - 0 1 rsbl 1 sub { - /i exch def - /cwb dcpb array def - 0 1 dcpb 1 sub { - /j exch def - cwb j cws j rsbl mul i add get put - } for - cwbs i cwb put - } for + % Convert input into bytes accounting for FNC characters + /fnc1 -1 def /fnc3 -2 def + /fncvals << + (FNC1) fnc1 + (FNC3) fnc3 + >> def + /msg barlen array def + /i 0 def /j 0 def { + i barlen eq {exit} if + /char barcode i get def + parsefnc char 94 eq and i barlen 4 sub lt and { + barcode i 1 add get 94 ne { + /char fncvals barcode i 1 add 4 getinterval get def + /i i 4 add def + } { + /i i 1 add def + } ifelse + } if + msg j char put + /i i 1 add def + /j j 1 add def + } loop + /msg msg 0 j getinterval def + /msglen msg length def - % Log and anti-log tables and function to calculate product in the field - /gf stype {32} {256} ifelse def - /gf-1 gf 1 sub def - /pm stype {37} {301} ifelse def - /rsalog [ 1 gf-1 { dup 2 mul dup gf ge {pm xor} if } repeat ] def - /rslog gf array def - 1 1 gf-1 {dup rsalog exch get exch rslog 3 1 roll put} for - /rsprod { - 2 copy 0 ne exch 0 ne and { - rslog exch get exch rslog exch get add gf-1 mod rsalog exch get - } { - pop pop 0 + % Basic metrics for the each symbol + % ver row col dcol dcws rscw rsbl ro ri rl + /metrics [ + [ (A) 16 18 16 10 10 1 4 99 6 ] + [ (B) 22 22 20 19 16 1 4 99 8 ] + [ (C) 28 32 28 44 26 1 4 22 11 ] + [ (D) 40 42 36 91 44 1 4 16 16 ] + [ (E) 52 54 48 182 70 1 4 22 22 ] + [ (F) 70 76 68 370 140 2 4 22 31 ] + [ (G) 104 98 88 732 280 4 6 21 47 ] + [ (H) 148 134 120 1480 560 8 6 20 69 ] + [ (S-10) 8 11 10 4 4 1 99 99 99 ] + [ (S-20) 8 21 20 8 8 1 99 99 99 ] + [ (S-30) 8 31 30 12 12 1 99 99 99 ] + [ (T-16) 16 17 16 10 10 1 99 99 99 ] + [ (T-32) 16 33 32 24 16 1 99 99 99 ] + [ (T-48) 16 49 48 38 22 1 99 99 99 ] + ] def + + % Select metrics of an appropriate symbol + /fullcws [] def + metrics { + /m exch def + /vers m 0 get def % Version of symbol + /dcws m 4 get def % Data codewords in symbol + /okay true def + version (unset) eq { + vers length 1 ne {/okay false def} if + } { + version vers ne {/okay false def} if + } ifelse + okay {/fullcws [ fullcws aload pop dcws ] def} if + } forall + /numremcws [ 1480 {10000} repeat ] def + fullcws {numremcws exch 1 sub 1 put} forall + 1478 -1 0 { + /i exch def + numremcws i get 1 ne { + numremcws i numremcws i 1 add get 1 add put + } if + } for + + % Special characters + /lC -5 def /lB -6 def /lX -7 def /lT -8 def /lD -9 def /unl -10 def + /fnc2 -11 def /fnc4 -12 def /sft1 -13 def /sft2 -14 def /sft3 -15 def /eci -16 def /pad -17 def /fnc1lD -18 def + /unlcw 255 def + + /Avals << + 0 1 128 {dup 1 add} for + pad 129 + 0 1 99 { % Double digits + dup 10 2 string cvrs (00) 2 string copy dup 2 3 index length sub 4 -1 roll putinterval + exch 130 add + } for + 229 [ lC lB fnc1 fnc2 fnc3 fnc4 fnc1lD ] {exch 1 add dup} forall pop + lX 238 + lT 239 + % 240-255 lD + 4 bits + >> def + /Avals << + Avals {[exch]} forall + >> def + + /CNvals << + sft1 0 + sft2 1 + sft3 2 + 32 3 + 48 1 57 {dup 44 sub} for % 0-9 + 65 1 90 {dup 51 sub} for % A-Z + >> def + /C1vals << 0 1 31 {dup} for >> def + /C2vals << + 33 1 47 {dup 33 sub} for + 58 1 64 {dup 43 sub} for + 91 1 95 {dup 69 sub} for + fnc1 27 + fnc2 28 + fnc3 29 + fnc4 30 + pad 31 + >> def + /C3vals << 96 1 127 {dup 96 sub} for >> def + /Cvals << + CNvals {[exch]} forall + C1vals {[exch CNvals sft1 get exch]} forall + C2vals {[exch CNvals sft2 get exch]} forall + C3vals {[exch CNvals sft3 get exch]} forall + >> def + + /TNvals << + sft1 0 + sft2 1 + sft3 2 + 32 3 + 48 1 57 {dup 44 sub} for % 0-9 + 97 1 122 {dup 83 sub} for % a-z + >> def + /T1vals << 0 1 31 {dup} for >> def + /T2vals << + 33 1 47 {dup 33 sub} for + 58 1 64 {dup 43 sub} for + 91 1 95 {dup 69 sub} for + fnc1 27 + fnc2 28 + fnc3 29 + fnc4 30 + pad 31 + >> def + /T3vals << + 96 0 + 65 1 90 {dup 64 sub} for + 123 1 127 {dup 96 sub} for + >> def + /Tvals << + TNvals {[exch]} forall + T1vals {[exch TNvals sft1 get exch]} forall + T2vals {[exch TNvals sft2 get exch]} forall + T3vals {[exch TNvals sft3 get exch]} forall + >> def + + % Extended ASCII mappings + 128 1 255 { + /i exch def + Avals i [ Avals fnc4 get aload pop Avals i 128 sub get aload pop ] put + Cvals i [ Cvals fnc4 get aload pop Cvals i 128 sub get aload pop ] put + Tvals i [ Tvals fnc4 get aload pop Tvals i 128 sub get aload pop ] put + } for + + /Xvals << + 13 0 + 42 1 + 62 2 + 32 3 + 48 1 57 {dup 44 sub} for + 65 1 90 {dup 51 sub} for + >> def + /Xvals << + Xvals {[exch]} forall + >> def + + /Bvals << + 0 1 255 {dup} for + >> def + /Bvals << + Bvals {[exch]} forall + >> def + + /encvals [ Avals Cvals Tvals Xvals -1 Bvals ] def + + /numD [ msglen {0} repeat 0 ] def + /nextXterm [ msglen {0} repeat 9999 ] def + /nextNonX [ msglen {0} repeat 9999 ] def + msglen 1 sub -1 0 { + /i exch def + /barchar msg i get def + barchar 48 ge barchar 57 le and { + numD i numD i 1 add get 1 add put + } if + barchar 13 eq barchar 42 eq or barchar 62 eq or { + nextXterm i 0 put + } { + nextXterm i nextXterm i 1 add get 1 add put + } ifelse + Xvals barchar known not { + nextNonX i 0 put + } { + nextNonX i nextNonX i 1 add get 1 add put + } ifelse + } for + /nextXterm [nextXterm {dup 10000 gt {pop 10000} if} forall] def + /nextNonX [nextNonX {dup 10000 gt {pop 10000} if} forall] def + + /isD {char 48 ge char 57 le and} bind def + /isC {CNvals char known} bind def + /isT {TNvals char known} bind def + /isX {Xvals char known} bind def + /isEA {char 127 gt} bind def + /isFN {char 0 lt} bind def + /XtermFirst {dup nextXterm exch get exch nextNonX exch get lt} bind def + + /A 0 def /C 1 def /T 2 def /X 3 def /D 4 def /B 5 def + + /lookup { + /ac 1 def /cc 2 def /tc 2 def /xc 2 def /bc 3 def + mode A eq {/ac 0 def /cc 1 def /tc 1 def /xc 1 def /bc 2 def} if + mode C eq {/cc 0 def} if + mode T eq {/tc 0 def} if + mode X eq {/xc 0 def} if % Assume mistake in spec + mode B eq {/bc 0 def} if + 1 { % common exit + /k 0 def { % loop + i k add msglen eq { + true [ac cc tc xc ] {bc exch ceiling le and} forall {B exit} if + true [ cc tc xc bc] {ac exch ceiling le and} forall {A exit} if + true [ tc xc ] {cc ceiling exch ceiling le and} forall {C exit} if + true [ xc ] {tc ceiling exch ceiling le and} forall {T exit} if + X exit + } if + /char msg i k add get def + /ac ac isD {1 2 div add} {isEA {ceiling 2 add} {ceiling 1 add} ifelse} ifelse def + /cc cc isC {2 3 div add} {isEA { 8 3 div add } { 4 3 div add } ifelse} ifelse def + /tc tc isT {2 3 div add} {isEA { 8 3 div add } { 4 3 div add } ifelse} ifelse def + /xc xc isX {2 3 div add} {isEA {13 3 div add } {10 3 div add } ifelse} ifelse def + /bc bc isFN {3 add} {1 add} ifelse def + k 3 ge { + true [ac cc tc xc ] {bc 1 add exch ceiling le and} forall {B exit} if + true [ cc tc xc bc] {ac 1 add exch ceiling le and} forall {A exit} if + true [ac cc xc bc] {tc 1 add exch ceiling le and} forall {T exit} if + true [ac tc ] {cc 1 add exch ceiling le and} forall { + cc ceiling xc ceiling lt {C exit} if + cc xc eq {i k add 1 add XtermFirst {X exit} {C exit} ifelse} if + } if + true [ac cc tc bc] {xc 1 add exch lt and} forall {X exit} if + } if + /k k 1 add def + } loop + } repeat + } bind def + + /addtocws { + dup cws exch j exch putinterval + /j exch length j add def + } bind def + + /tobin { + string dup length 1 sub 0 exch 1 exch {1 index exch 48 put} for + dup 3 -1 roll 2 2 index length string cvrs dup length 2 index length exch sub exch putinterval + [ exch {48 sub} forall ] + } bind def + + /encA { + 1 { % Common exit + numD i get 21 ge { + /Dbits [ 1 1 1 1 ] def + /mode D def + exit + } if + numD i get dup 13 ge exch i add msglen eq and { + /Dbits [ 1 1 1 1 ] def + /mode D def + exit + } if + numD i get 2 ge { + 2 string dup 0 msg i get put dup 1 msg i 1 add get put Avals exch get addtocws + /i i 2 add def + exit + } if + msg i get fnc1 eq { + numD i 1 add get 15 ge { + Avals fnc1lD get addtocws + /i i 1 add def + /Dbits [] def + /mode D def + exit + } if + numD i 1 add get dup 7 ge exch i add 1 add msglen eq and { + Avals fnc1lD get addtocws + /i i 1 add def + /Dbits [] def + /mode D def + exit + } if + } if + /newmode lookup def + newmode mode ne { + Avals [-1 lC lT lX lD lB] newmode get get addtocws + /mode newmode def + exit + } if + Avals msg i get get addtocws + /i i 1 add def + exit + } repeat + } bind def + + /CTXvalstocws { + /in exch def + mark + 0 3 in length 1 sub { + in exch 3 getinterval 0 exch {add 40 mul} forall 40 idiv 1 add + dup 256 idiv exch 256 mod + } for + counttomark array astore exch pop + } bind def + + /encCTX { + /p 0 def + /ctxvals 2220 array def + + % Lookup the values for each character + { + i msglen eq {exit} if + encvals mode get msg i get known not {exit} if + p 3 mod 0 eq { + numD i get 12 ge { + [unlcw] addtocws + /mode A def + exit + } if + numD i get dup 8 ge exch i add msglen eq and { + [unlcw] addtocws + /mode A def + exit + } if + lookup mode ne { + ctxvals 0 p getinterval CTXvalstocws addtocws + [unlcw] addtocws + /mode A def + exit + } if + msglen i sub 3 le { % Check end of data conditions + /remcws numremcws j p 3 idiv 2 mul add get def + /remvals [ + msg i msglen i sub getinterval { + dup encvals mode get exch known { + encvals mode get exch get aload pop + } { % Unencodable X12 characters + pop -1 -1 -1 -1 + } ifelse + } forall + ] def + remcws 2 eq remvals length 3 eq and { + % Encode and omit unlatch + [ + ctxvals 0 p getinterval aload pop + remvals aload pop + ] CTXvalstocws addtocws + /mode A def + /i msglen def + exit + } if + remcws 2 eq remvals length 2 eq and mode X ne and { + % Encode with sft1 as third value, omit unlatch + [ + ctxvals 0 p getinterval aload pop + remvals aload pop + encvals mode get sft1 get aload pop + ] CTXvalstocws addtocws + /mode A def + /i msglen def + exit + } if + remcws 2 eq remvals length 1 eq and { + % Unlatch to ASCII + ctxvals 0 p getinterval CTXvalstocws addtocws + [unlcw] addtocws + Avals msg i get get addtocws + /mode A def + /i msglen def + exit + } if + remcws 1 eq remvals length 1 eq and { + % Implied unlatch to ASCII + ctxvals 0 p getinterval CTXvalstocws addtocws + Avals msg i get get addtocws + /mode A def + /i msglen def + exit + } if + } if + } if + encvals mode get msg i get get + dup ctxvals exch p exch putinterval + /p exch length p add def + /i i 1 add def + } loop + + % Backtrack to a boundary and return to ASCII + mode A ne { + { + p 3 mod 0 eq {exit} if + /i i 1 sub def + /p p encvals mode get msg i get get length sub def + } loop + [ + ctxvals 0 p getinterval aload pop + ] CTXvalstocws addtocws + [unlcw] addtocws + /mode A def + % Encode something to avoid latching immediately back + i msglen ne { + numD i get 2 ge { + 2 string dup 0 msg i get put dup 1 msg i 1 add get put Avals exch get addtocws + /i i 2 add def + } { + Avals msg i get get addtocws + /i i 1 add def + } ifelse + } if + } if + + } bind def + + /encD { + + { % loop + + numD i get 3 lt { + + /Drem 8 Dbits length 8 mod sub 8 mod def + /remcws numremcws j Dbits length 8 idiv add get def + + % Final codeword with no data + numremcws j Dbits length 8 idiv add 1 sub get 1 sub 0 eq + i msglen eq and {exit} if + + % Final digit into final codeword as ASCII + i msglen 1 sub eq numD i get 1 eq and + remcws 1 eq and Drem 0 eq and {exit} if + + % Latch to ASCII unless 4 or 6 bits remain in final codeword + i msglen 1 sub eq numD i get 1 eq and + remcws 1 eq and Drem 4 eq Drem 6 eq or and not { + /Dbits [ Dbits aload pop 1 1 1 1 1 1 ] def + /Drem 8 Dbits length 8 mod sub 8 mod def + } if + + % Try to encode a digit in remaining bits + Drem 4 eq Drem 6 eq or { + numD i get 1 ge { + /Dbits [ Dbits aload pop msg i get 48 sub 1 add 4 tobin aload pop ] def + /i i 1 add def + } { + /Dbits [ Dbits aload pop 1 1 1 1 ] def + } ifelse + /Drem Drem 4 sub def + } if + Drem 2 eq { + /Dbits [ Dbits aload pop 0 1 ] def + /Drem 0 def + } if + + exit + + } if + + % Three digit value plus one to ten bits + /Dbits [ + Dbits aload pop + 0 msg i 3 getinterval {48 sub add 10 mul} forall 10 idiv + 1 add 10 tobin aload pop + ] def + /i i 3 add def + + } loop + + mark + 0 8 Dbits length 1 sub { + Dbits exch 8 getinterval 0 exch {add 2 mul} forall 2 idiv + } for + counttomark array astore exch pop addtocws + /mode A def + + } bind def + + /encB { + /p 0 def /bvals 1480 array def { + i msglen eq {exit} if + msg i get 0 lt {exit} if % Function character + lookup mode ne {exit} if + bvals p msg i get put + /p p 1 add def + /i i 1 add def + } loop + /remcws numremcws j p add get 1 sub def + /bvals [ + remcws 0 eq i msglen eq and { % Terminates symbol + 0 + } { + p 250 lt {p} {p 250 idiv 249 add p 250 mod} ifelse + } ifelse + bvals 0 p getinterval aload pop + ] def + bvals addtocws + /mode A def + } bind def + + % Derive the codewords + /cws 1480 array def + /mode A def /i 0 def /j 0 def { + i msglen ge {exit} if + [ /encA /encCTX /encCTX /encCTX /encD /encB ] mode get load exec + } loop + /cws cws 0 j getinterval def + + } ifelse + + % Select metrics of an appropriate symbol + /i 0 def + { % loop + /m metrics i get def + /vers m 0 get def % Version of symbol + /rows m 1 get def % Rows in symbol + /cols m 2 get def % Columns in symbol + /dcol m 3 get def % Data columns in symbol + /dcws m 4 get def % Data codewords in symbol + /rscw m 5 get def % Error correction codewords + /rsbl m 6 get def % Error correction blocks + /riso m 7 get def % Riser offset + /risi m 8 get def % Riser interval + /risl m 9 get def % Riser length + /dcpb dcws rsbl idiv def % Data codewords per block + /ecpb rscw rsbl idiv def % Error codewords per block + /okay true def + version (unset) ne version vers ne and {/okay false def} if % The version must match that supplied + cws length dcws gt {/okay false def} if + okay {exit} if + /i i 1 add def + } loop + + % Extend cws to ncws codewords by addition of pad characters + stype not { + /cws [ cws aload pop dcws cws length sub {129} repeat ] def + } { + /cws [ dcws cws length sub {0} repeat cws aload pop ] def + } ifelse + + % De-interleave the codewords into blocks + /cwbs rsbl array def % Array of data codeword blocks + /ecbs rsbl array def % Array of error correction blocks + 0 1 rsbl 1 sub { + /i exch def + /cwb dcpb array def + 0 1 dcpb 1 sub { + /j exch def + cwb j cws j rsbl mul i add get put + } for + cwbs i cwb put + } for + + % Log and anti-log tables and function to calculate product in the field + /gf stype {32} {256} ifelse def + /gf-1 gf 1 sub def + /pm stype {37} {301} ifelse def + /rsalog [ 1 gf-1 { dup 2 mul dup gf ge {pm xor} if } repeat ] def + /rslog gf array def + 1 1 gf-1 {dup rsalog exch get exch rslog 3 1 roll put} for + /rsprod { + 2 copy 0 ne exch 0 ne and { + rslog exch get exch rslog exch get add gf-1 mod rsalog exch get + } { + pop pop 0 } ifelse } bind def @@ -18387,120 +18940,1018 @@ begin ecbs i rscws dcpb ecpb getinterval put } for - % Extend codewords with the interleaved error correction codes - /cws [ cws aload pop rscw {0} repeat ] def - 0 1 rscw 1 sub { - /i exch def - cws dcws i add ecbs i rsbl mod get i rsbl idiv get put - } for + % Extend codewords with the interleaved error correction codes + /cws [ cws aload pop rscw {0} repeat ] def + 0 1 rscw 1 sub { + /i exch def + cws dcws i add ecbs i rsbl mod get i rsbl idiv get put + } for + + % Module matrix for layout of the codewords + /mmat dcws rscw add stype {5} {8} ifelse mul array def + /r 0 def /c 0 def + 0 stype {2} {1} ifelse cws length 1 sub { + /i exch def + stype not { + (00000000) 8 string copy dup cws i get 2 8 string cvrs + dup length 8 exch sub exch putinterval [ exch {48 sub} forall ] + dup 0 4 getinterval /top exch def + 4 4 getinterval /bot exch def + } { + (00000) 5 string copy dup cws i get 2 5 string cvrs + dup length 5 exch sub exch putinterval [ exch {48 sub} forall ] + /c1 exch def + (00000) 5 string copy dup cws i 1 add get 2 5 string cvrs + dup length 5 exch sub exch putinterval [ exch {48 sub} forall ] + /c2 exch def + /top [ c1 0 3 getinterval aload pop c2 0 2 getinterval aload pop ] def + /bot [ c1 3 2 getinterval aload pop c2 2 3 getinterval aload pop ] def + } ifelse + mmat r dcol mul c add top putinterval + mmat r 1 add dcol mul c add bot putinterval + /c c top length add def + c dcol eq {/c 0 def /r r 2 add def} if + } for + + % Create bitmap and add finder patterns + /mmv {cols mul add} bind def + /pixs [ rows cols mul {-1} repeat ] def + + % Centre pattern + /artifact [ + {cols {0} repeat} bind + {cols {1} repeat} bind + {0 cols 2 sub {1} repeat 0} bind + {0 1 cols 4 sub {0} repeat 1 0} bind + {cols 1 sub 2 idiv {-1} repeat 1 cols 1 sub 2 idiv {-1} repeat} bind + {cols 1 sub 2 idiv {-1} repeat 0 cols 1 sub 2 idiv {-1} repeat} bind + {1 cols 2 sub {0} repeat 1} bind + {1 0 cols 4 sub {1} repeat 0 1} bind + ] def + /cpat << + /A (121343) + /B (12134343) + /C (12121343) + /D (1213434343) + /E (1212134343) + /F (1212121343) + /G (121213434343) + /H (121212134343) + /S (56661278) + /T (5666666666127878) + >> vers 0 1 getinterval get def + pixs 0 rows cpat length sub 2 idiv mmv + [ cpat {artifact exch 49 sub get exec} forall ] putinterval + + % Risers + 0 1 risl 1 sub { + /i exch def + riso risi cols 1 sub { + /j exch def + [ 1 i 12 mod 0 eq {1} {0} ifelse ] dup + pixs j i mmv + 3 -1 roll putinterval + i risl 1 sub ne { + pixs cols j sub 2 sub rows i sub 1 sub mmv + 3 -1 roll putinterval + } {pop} ifelse + } for + } for + + % Black dots + << + /A [ [12 5] ] + /B [ [16 7] ] + /C [ [26 12] ] + /D [] + /E [ [26 23] ] + /F [ [26 32] [70 32] [26 34] [70 34] ] + /G [ [27 48] [69 48] ] + /H [ [26 70] [66 70] [106 70] [26 72] [66 72] [106 72] ] + /S-10 [] + /S-20 [ [10 4] ] + /S-30 [ [15 4] [15 6] ] + /T-16 [ [8 10] ] + /T-32 [ [16 10] [16 12] ] + /T-48 [ [24 10] [24 12] [24 14] ] + >> vers get {pixs exch aload pop mmv 1 put} forall + + % Place the modules onto a pixel map between alignment patterns + /j 0 def + 0 1 pixs length 1 sub { + /i exch def + pixs i get -1 eq { + pixs i mmat j get put + /j j 1 add def + } if + } for + + % Return the arguments + << + /ren //renmatrix + /pixs pixs + /pixx cols + /pixy rows + /height rows 72 div 2 mul + /width cols 72 div 2 mul + /opt options + >> + + dontdraw not //renmatrix if + + end + +} bind def +/codeone dup load /uk.co.terryburton.bwipp defineresource pop +end +/setpacking where {pop setpacking} if +%%EndData +%%EndResource +% --END ENCODER codeone-- + +% --BEGIN ENCODER hanxin-- +% --REQUIRES preamble raiseerror renmatrix-- +% --DESC: Han Xin Code +% --EXAM: This is Han Xin +% --EXOP: +% --RNDR: renmatrix +%%BeginResource: uk.co.terryburton.bwipp hanxin 0.0 2016042100 299332 322644 +%%BeginData: 886 ASCII Lines +/setpacking where {pop currentpacking true setpacking} if +1 dict +dup /raiseerror dup /uk.co.terryburton.bwipp findresource put +dup /renmatrix dup /uk.co.terryburton.bwipp findresource put +begin +/hanxin { + + 20 dict begin + + /options exch def + /barcode exch def + + /dontdraw false def + /version (unset) def % 1-84 + /eclevel (unset) def % L1, L2, L3 or L4 + /parse false def + /parsefnc false def + /mask -1 def + + % Parse the input options + options type /stringtype eq { + 1 dict begin + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + currentdict end /options exch def + } if + options {def} forall + + /mask mask cvi def + + % Parse ordinals of the form ^NNN to ASCII + parse { + /msg barcode length string def + /j 0 def + barcode + { % loop + (^) search { + dup msg exch j exch putinterval + length j add 1 add /j exch def + pop + dup 0 3 getinterval cvi msg exch j 1 sub exch put + dup length 3 sub 3 exch getinterval + } { + dup msg exch j exch putinterval + length j add /j exch def + /barcode msg 0 j getinterval def + exit + } ifelse + } loop + } if + + /barlen barcode length def + + % Convert input into bytes accounting for FNC characters + /fncvals << + % No FNC characters defined + >> def + /msg barlen array def + /i 0 def /j 0 def { + i barlen eq {exit} if + /char barcode i get def + parsefnc char 94 eq and i barlen 4 sub lt and { + barcode i 1 add get 94 ne { + /char fncvals barcode i 1 add 4 getinterval get def + /i i 4 add def + } { + /i i 1 add def + } ifelse + } if + msg j char put + /i i 1 add def + /j j 1 add def + } loop + /msg msg 0 j getinterval def + /msglen msg length def + + % Default error correction level + eclevel (unset) eq {/eclevel (L2) def} if + + /tobin { + string dup length 1 sub 0 exch 1 exch {1 index exch 48 put} for + dup 3 -1 roll 2 2 index length string cvrs + dup length 2 index length exch sub exch putinterval + } bind def + + % Encode the data using byte mode encoding + /bits 4 13 add msglen 8 mul add string def + bits 0 (0011) putinterval + bits 4 msglen 13 tobin putinterval + 0 1 msglen 1 sub { + /i exch def + bits 17 i 8 mul add msg i get 8 tobin putinterval + } for + + % Lookup the most appropriate symbol specification + /metrics [ + % vers size align modules error correction blocks + [ (1) 23 -1 0 205 [ 1 21 4 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 17 8 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 13 12 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 9 16 ] [ 0 -1 -1 ] [ 0 -1 -1 ] ] + [ (2) 25 -1 0 301 [ 1 31 6 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 25 12 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 19 18 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 15 22 ] [ 0 -1 -1 ] [ 0 -1 -1 ] ] + [ (3) 27 -1 0 405 [ 1 42 8 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 34 16 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 26 24 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 20 30 ] [ 0 -1 -1 ] [ 0 -1 -1 ] ] + [ (4) 29 14 1 439 [ 1 46 8 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 38 16 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 30 24 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 22 32 ] [ 0 -1 -1 ] [ 0 -1 -1 ] ] + [ (5) 31 16 1 555 [ 1 57 12 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 49 20 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 37 32 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 14 20 ] [ 1 13 22 ] [ 0 -1 -1 ] ] + [ (6) 33 16 1 675 [ 1 70 14 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 58 26 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 24 20 ] [ 1 22 18 ] [ 0 -1 -1 ] + [ 1 16 24 ] [ 1 18 26 ] [ 0 -1 -1 ] ] + [ (7) 35 17 1 805 [ 1 84 16 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 70 30 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 26 22 ] [ 1 28 24 ] [ 0 -1 -1 ] + [ 2 14 20 ] [ 1 12 20 ] [ 0 -1 -1 ] ] + [ (8) 37 18 1 943 [ 1 99 18 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 40 18 ] [ 1 41 18 ] [ 0 -1 -1 ] + [ 1 31 26 ] [ 1 32 28 ] [ 0 -1 -1 ] + [ 2 16 24 ] [ 1 15 22 ] [ 0 -1 -1 ] ] + [ (9) 39 19 1 1089 [ 1 114 22 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 2 48 20 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 2 24 20 ] [ 1 26 22 ] [ 0 -1 -1 ] + [ 2 18 28 ] [ 1 18 26 ] [ 0 -1 -1 ] ] + [ (10) 41 20 1 1243 [ 1 131 24 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 52 22 ] [ 1 57 24 ] [ 0 -1 -1 ] + [ 2 27 24 ] [ 1 29 24 ] [ 0 -1 -1 ] + [ 2 21 32 ] [ 1 19 30 ] [ 0 -1 -1 ] ] + [ (11) 43 14 2 1289 [ 1 135 26 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 56 24 ] [ 1 57 24 ] [ 0 -1 -1 ] + [ 2 28 24 ] [ 1 31 26 ] [ 0 -1 -1 ] + [ 2 22 32 ] [ 1 21 32 ] [ 0 -1 -1 ] ] + [ (12) 45 15 2 1455 [ 1 153 28 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 1 62 26 ] [ 1 65 28 ] [ 0 -1 -1 ] + [ 2 32 28 ] [ 1 33 28 ] [ 0 -1 -1 ] + [ 3 17 26 ] [ 1 22 30 ] [ 0 -1 -1 ] ] + [ (13) 47 16 2 1629 [ 1 86 16 ] [ 1 85 16 ] [ 0 -1 -1 ] + [ 1 71 30 ] [ 1 72 30 ] [ 0 -1 -1 ] + [ 2 37 32 ] [ 1 35 30 ] [ 0 -1 -1 ] + [ 3 20 30 ] [ 1 21 32 ] [ 0 -1 -1 ] ] + [ (14) 49 16 2 1805 [ 1 94 18 ] [ 1 95 18 ] [ 0 -1 -1 ] + [ 2 51 22 ] [ 1 55 24 ] [ 0 -1 -1 ] + [ 3 30 26 ] [ 1 31 26 ] [ 0 -1 -1 ] + [ 4 18 28 ] [ 1 17 24 ] [ 0 -1 -1 ] ] + [ (15) 51 17 2 1995 [ 1 104 20 ] [ 1 105 20 ] [ 0 -1 -1 ] + [ 2 57 24 ] [ 1 61 26 ] [ 0 -1 -1 ] + [ 3 33 28 ] [ 1 36 30 ] [ 0 -1 -1 ] + [ 4 20 30 ] [ 1 19 30 ] [ 0 -1 -1 ] ] + [ (16) 53 17 2 2187 [ 1 115 22 ] [ 1 114 22 ] [ 0 -1 -1 ] + [ 2 65 28 ] [ 1 61 26 ] [ 0 -1 -1 ] + [ 3 38 32 ] [ 1 33 30 ] [ 0 -1 -1 ] + [ 5 19 28 ] [ 1 14 24 ] [ 0 -1 -1 ] ] + [ (17) 55 18 2 2393 [ 1 126 24 ] [ 1 125 24 ] [ 0 -1 -1 ] + [ 2 70 30 ] [ 1 69 30 ] [ 0 -1 -1 ] + [ 4 33 28 ] [ 1 29 26 ] [ 0 -1 -1 ] + [ 5 20 30 ] [ 1 19 30 ] [ 0 -1 -1 ] ] + [ (18) 57 19 2 2607 [ 1 136 26 ] [ 1 137 26 ] [ 0 -1 -1 ] + [ 3 56 24 ] [ 1 59 26 ] [ 0 -1 -1 ] + [ 5 35 30 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 6 18 28 ] [ 1 21 28 ] [ 0 -1 -1 ] ] + [ (19) 59 20 2 2829 [ 1 148 28 ] [ 1 149 28 ] [ 0 -1 -1 ] + [ 3 61 26 ] [ 1 64 28 ] [ 0 -1 -1 ] + [ 7 24 20 ] [ 1 23 22 ] [ 0 -1 -1 ] + [ 6 20 30 ] [ 1 21 32 ] [ 0 -1 -1 ] ] + [ (20) 61 20 2 3053 [ 3 107 20 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 3 65 28 ] [ 1 72 30 ] [ 0 -1 -1 ] + [ 7 26 22 ] [ 1 23 22 ] [ 0 -1 -1 ] + [ 7 19 28 ] [ 1 20 32 ] [ 0 -1 -1 ] ] + [ (21) 63 21 2 3291 [ 3 115 22 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 4 56 24 ] [ 1 63 28 ] [ 0 -1 -1 ] + [ 7 28 24 ] [ 1 25 22 ] [ 0 -1 -1 ] + [ 8 18 28 ] [ 1 21 22 ] [ 0 -1 -1 ] ] + [ (22) 65 16 3 3383 [ 2 116 22 ] [ 1 122 24 ] [ 0 -1 -1 ] + [ 4 56 24 ] [ 1 72 30 ] [ 0 -1 -1 ] + [ 7 28 24 ] [ 1 32 26 ] [ 0 -1 -1 ] + [ 8 18 28 ] [ 1 24 30 ] [ 0 -1 -1 ] ] + [ (23) 67 17 3 3631 [ 3 127 24 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 5 51 22 ] [ 1 62 26 ] [ 0 -1 -1 ] + [ 7 30 26 ] [ 1 35 26 ] [ 0 -1 -1 ] + [ 8 20 30 ] [ 1 21 32 ] [ 0 -1 -1 ] ] + [ (24) 69 17 3 3887 [ 2 135 26 ] [ 1 137 26 ] [ 0 -1 -1 ] + [ 5 56 24 ] [ 1 59 26 ] [ 0 -1 -1 ] + [ 7 33 28 ] [ 1 30 28 ] [ 0 -1 -1 ] + [ 11 16 24 ] [ 1 19 26 ] [ 0 -1 -1 ] ] + [ (25) 71 18 3 4151 [ 3 105 20 ] [ 1 121 22 ] [ 0 -1 -1 ] + [ 5 61 26 ] [ 1 57 26 ] [ 0 -1 -1 ] + [ 9 28 24 ] [ 1 28 22 ] [ 0 -1 -1 ] + [ 10 19 28 ] [ 1 18 30 ] [ 0 -1 -1 ] ] + [ (26) 73 18 3 4423 [ 2 157 30 ] [ 1 150 28 ] [ 0 -1 -1 ] + [ 5 65 28 ] [ 1 61 26 ] [ 0 -1 -1 ] + [ 8 33 28 ] [ 1 34 30 ] [ 0 -1 -1 ] + [ 10 19 28 ] [ 2 15 26 ] [ 0 -1 -1 ] ] + [ (27) 75 19 3 4703 [ 3 126 24 ] [ 1 115 22 ] [ 0 -1 -1 ] + [ 7 51 22 ] [ 1 54 22 ] [ 0 -1 -1 ] + [ 8 35 30 ] [ 1 37 30 ] [ 0 -1 -1 ] + [ 15 15 22 ] [ 1 10 22 ] [ 0 -1 -1 ] ] + [ (28) 77 19 3 4991 [ 4 105 20 ] [ 1 103 20 ] [ 0 -1 -1 ] + [ 7 56 24 ] [ 1 45 18 ] [ 0 -1 -1 ] + [ 10 31 26 ] [ 1 27 26 ] [ 0 -1 -1 ] + [ 10 17 26 ] [ 3 20 28 ] [ 1 21 28 ] ] + [ (29) 79 20 3 5287 [ 3 139 26 ] [ 1 137 28 ] [ 0 -1 -1 ] + [ 6 66 28 ] [ 1 66 30 ] [ 0 -1 -1 ] + [ 9 36 30 ] [ 1 34 32 ] [ 0 -1 -1 ] + [ 13 19 28 ] [ 1 17 32 ] [ 0 -1 -1 ] ] + [ (30) 81 20 3 5591 [ 6 84 16 ] [ 1 82 16 ] [ 0 -1 -1 ] + [ 6 70 30 ] [ 1 68 30 ] [ 0 -1 -1 ] + [ 7 35 30 ] [ 3 33 28 ] [ 1 32 28 ] + [ 13 20 30 ] [ 1 20 28 ] [ 0 -1 -1 ] ] + [ (31) 83 21 3 5903 [ 5 105 20 ] [ 1 94 18 ] [ 0 -1 -1 ] + [ 6 74 32 ] [ 1 71 30 ] [ 0 -1 -1 ] + [ 11 33 28 ] [ 1 34 32 ] [ 0 -1 -1 ] + [ 13 19 28 ] [ 3 16 26 ] [ 0 -1 -1 ] ] + [ (32) 85 17 4 6033 [ 4 127 24 ] [ 1 126 24 ] [ 0 -1 -1 ] + [ 7 66 28 ] [ 1 66 30 ] [ 0 -1 -1 ] + [ 12 30 24 ] [ 1 24 28 ] [ 1 24 30 ] + [ 15 19 28 ] [ 1 17 32 ] [ 0 -1 -1 ] ] + [ (33) 87 17 4 6353 [ 7 84 16 ] [ 1 78 16 ] [ 0 -1 -1 ] + [ 7 70 30 ] [ 1 66 28 ] [ 0 -1 -1 ] + [ 12 33 28 ] [ 1 32 30 ] [ 0 -1 -1 ] + [ 14 21 32 ] [ 1 24 28 ] [ 0 -1 -1 ] ] + [ (34) 89 18 4 6689 [ 5 117 22 ] [ 1 117 24 ] [ 0 -1 -1 ] + [ 8 66 28 ] [ 1 58 26 ] [ 0 -1 -1 ] + [ 11 38 32 ] [ 1 34 32 ] [ 0 -1 -1 ] + [ 15 20 30 ] [ 2 17 26 ] [ 0 -1 -1 ] ] + [ (35) 91 18 4 7025 [ 4 148 28 ] [ 1 146 28 ] [ 0 -1 -1 ] + [ 8 68 30 ] [ 1 70 24 ] [ 0 -1 -1 ] + [ 10 36 32 ] [ 3 38 28 ] [ 0 -1 -1 ] + [ 16 19 28 ] [ 3 16 26 ] [ 0 -1 -1 ] ] + [ (36) 93 19 4 7377 [ 4 126 24 ] [ 2 135 26 ] [ 0 -1 -1 ] + [ 8 70 28 ] [ 2 43 26 ] [ 0 -1 -1 ] + [ 13 32 28 ] [ 2 41 30 ] [ 0 -1 -1 ] + [ 17 19 28 ] [ 3 15 26 ] [ 0 -1 -1 ] ] + [ (37) 95 19 4 7729 [ 5 136 26 ] [ 1 132 24 ] [ 0 -1 -1 ] + [ 5 67 30 ] [ 4 68 28 ] [ 1 69 28 ] + [ 14 35 30 ] [ 1 32 24 ] [ 0 -1 -1 ] + [ 18 18 26 ] [ 3 16 28 ] [ 1 14 28 ] ] + [ (38) 97 19 4 8089 [ 3 142 26 ] [ 3 141 28 ] [ 0 -1 -1 ] + [ 8 70 30 ] [ 1 73 32 ] [ 1 74 32 ] + [ 12 34 30 ] [ 3 34 26 ] [ 1 35 28 ] + [ 18 21 32 ] [ 1 27 30 ] [ 0 -1 -1 ] ] + [ (39) 99 20 4 8465 [ 5 116 22 ] [ 2 103 20 ] [ 1 102 20 ] + [ 9 74 32 ] [ 1 74 30 ] [ 0 -1 -1 ] + [ 14 34 28 ] [ 2 32 32 ] [ 1 32 30 ] + [ 19 21 32 ] [ 1 25 26 ] [ 0 -1 -1 ] ] + [ (40) 101 20 4 8841 [ 7 116 22 ] [ 1 117 22 ] [ 0 -1 -1 ] + [ 11 65 28 ] [ 1 58 24 ] [ 0 -1 -1 ] + [ 15 38 32 ] [ 1 27 28 ] [ 0 -1 -1 ] + [ 20 20 30 ] [ 1 20 32 ] [ 1 21 32 ] ] + [ (41) 103 17 5 9009 [ 6 136 26 ] [ 1 130 24 ] [ 0 -1 -1 ] + [ 11 66 28 ] [ 1 62 30 ] [ 0 -1 -1 ] + [ 14 34 28 ] [ 3 34 32 ] [ 1 30 30 ] + [ 18 20 30 ] [ 3 20 28 ] [ 2 15 26 ] ] + [ (42) 105 17 5 9401 [ 5 105 20 ] [ 2 115 22 ] [ 2 116 22 ] + [ 10 75 32 ] [ 1 73 32 ] [ 0 -1 -1 ] + [ 16 38 32 ] [ 1 27 28 ] [ 0 -1 -1 ] + [ 22 19 28 ] [ 2 16 30 ] [ 1 19 30 ] ] + [ (43) 107 18 5 9799 [ 6 147 28 ] [ 1 146 28 ] [ 0 -1 -1 ] + [ 11 66 28 ] [ 2 65 30 ] [ 0 -1 -1 ] + [ 18 33 28 ] [ 2 33 30 ] [ 0 -1 -1 ] + [ 22 21 32 ] [ 1 28 30 ] [ 0 -1 -1 ] ] + [ (44) 109 18 5 10207 [ 6 116 22 ] [ 3 125 24 ] [ 0 -1 -1 ] + [ 11 75 32 ] [ 1 68 30 ] [ 0 -1 -1 ] + [ 13 35 28 ] [ 6 34 32 ] [ 1 30 30 ] + [ 23 21 32 ] [ 1 26 30 ] [ 0 -1 -1 ] ] + [ (45) 111 18 5 10623 [ 7 105 20 ] [ 4 95 18 ] [ 0 -1 -1 ] + [ 12 67 28 ] [ 1 63 30 ] [ 1 62 32 ] + [ 21 31 26 ] [ 2 33 32 ] [ 0 -1 -1 ] + [ 23 21 32 ] [ 2 24 30 ] [ 0 -1 -1 ] ] + [ (46) 113 19 5 11045 [ 10 116 22 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 12 74 32 ] [ 1 78 30 ] [ 0 -1 -1 ] + [ 18 37 32 ] [ 1 39 30 ] [ 1 41 28 ] + [ 25 21 32 ] [ 1 27 28 ] [ 0 -1 -1 ] ] + [ (47) 115 19 5 11477 [ 5 126 24 ] [ 4 115 22 ] [ 1 114 22 ] + [ 12 67 28 ] [ 2 66 32 ] [ 1 68 30 ] + [ 21 35 30 ] [ 1 39 30 ] [ 0 -1 -1 ] + [ 26 21 32 ] [ 1 28 28 ] [ 0 -1 -1 ] ] + [ (48) 117 19 5 11917 [ 9 126 24 ] [ 1 117 22 ] [ 0 -1 -1 ] + [ 13 75 32 ] [ 1 68 30 ] [ 0 -1 -1 ] + [ 20 35 30 ] [ 3 35 28 ] [ 0 -1 -1 ] + [ 27 21 32 ] [ 1 28 30 ] [ 0 -1 -1 ] ] + [ (49) 119 17 6 12111 [ 9 126 24 ] [ 1 137 26 ] [ 0 -1 -1 ] + [ 13 71 30 ] [ 2 68 32 ] [ 0 -1 -1 ] + [ 20 37 32 ] [ 1 39 28 ] [ 1 38 28 ] + [ 24 20 32 ] [ 5 25 28 ] [ 0 -1 -1 ] ] + [ (50) 121 17 6 12559 [ 8 147 28 ] [ 1 141 28 ] [ 0 -1 -1 ] + [ 10 73 32 ] [ 4 74 30 ] [ 1 73 30 ] + [ 16 36 32 ] [ 6 39 30 ] [ 1 37 30 ] + [ 27 21 32 ] [ 3 20 26 ] [ 0 -1 -1 ] ] + [ (51) 123 18 6 13025 [ 9 137 26 ] [ 1 135 26 ] [ 0 -1 -1 ] + [ 12 70 30 ] [ 4 75 32 ] [ 0 -1 -1 ] + [ 24 35 30 ] [ 1 40 28 ] [ 0 -1 -1 ] + [ 23 20 32 ] [ 8 24 30 ] [ 0 -1 -1 ] ] + [ (52) 125 18 6 13489 [ 14 95 18 ] [ 1 86 18 ] [ 0 -1 -1 ] + [ 13 73 32 ] [ 3 77 30 ] [ 0 -1 -1 ] + [ 24 35 30 ] [ 2 35 28 ] [ 0 -1 -1 ] + [ 26 21 32 ] [ 5 21 30 ] [ 1 23 30 ] ] + [ (53) 127 18 6 13961 [ 9 147 28 ] [ 1 142 28 ] [ 0 -1 -1 ] + [ 10 73 30 ] [ 6 70 32 ] [ 1 71 32 ] + [ 25 35 30 ] [ 2 34 26 ] [ 0 -1 -1 ] + [ 29 21 32 ] [ 4 22 30 ] [ 0 -1 -1 ] ] + [ (54) 129 18 6 14441 [ 11 126 24 ] [ 1 131 24 ] [ 0 -1 -1 ] + [ 16 74 32 ] [ 1 79 30 ] [ 0 -1 -1 ] + [ 25 38 32 ] [ 1 25 30 ] [ 0 -1 -1 ] + [ 33 21 32 ] [ 1 28 28 ] [ 0 -1 -1 ] ] + [ (55) 131 19 6 14939 [ 14 105 20 ] [ 1 99 18 ] [ 0 -1 -1 ] + [ 19 65 28 ] [ 1 72 28 ] [ 0 -1 -1 ] + [ 24 37 32 ] [ 2 40 30 ] [ 1 41 30 ] + [ 31 21 32 ] [ 4 24 32 ] [ 0 -1 -1 ] ] + [ (56) 133 19 6 15435 [ 10 147 28 ] [ 1 151 28 ] [ 0 -1 -1 ] + [ 15 71 30 ] [ 3 71 32 ] [ 1 73 32 ] + [ 24 37 32 ] [ 3 38 30 ] [ 1 39 30 ] + [ 36 19 30 ] [ 3 29 26 ] [ 0 -1 -1 ] ] + [ (57) 135 19 6 15939 [ 15 105 20 ] [ 1 99 18 ] [ 0 -1 -1 ] + [ 19 70 30 ] [ 1 64 28 ] [ 0 -1 -1 ] + [ 27 38 32 ] [ 2 25 26 ] [ 0 -1 -1 ] + [ 38 20 30 ] [ 2 18 28 ] [ 0 -1 -1 ] ] + [ (58) 137 17 7 16171 [ 14 105 20 ] [ 1 113 22 ] [ 1 114 22 ] + [ 17 67 30 ] [ 3 92 32 ] [ 0 -1 -1 ] + [ 30 35 30 ] [ 1 41 30 ] [ 0 -1 -1 ] + [ 36 21 32 ] [ 1 26 30 ] [ 1 27 30 ] ] + [ (59) 139 17 7 16691 [ 11 146 28 ] [ 1 146 26 ] [ 0 -1 -1 ] + [ 20 70 30 ] [ 1 60 26 ] [ 0 -1 -1 ] + [ 29 38 32 ] [ 1 24 32 ] [ 0 -1 -1 ] + [ 40 20 30 ] [ 2 17 26 ] [ 0 -1 -1 ] ] + [ (60) 141 18 7 17215 [ 3 137 26 ] [ 1 136 26 ] [ 10 126 24 ] + [ 22 65 28 ] [ 1 75 30 ] [ 0 -1 -1 ] + [ 30 37 32 ] [ 1 51 30 ] [ 0 -1 -1 ] + [ 42 20 30 ] [ 1 21 30 ] [ 0 -1 -1 ] ] + [ (61) 143 18 7 17751 [ 12 126 24 ] [ 2 118 22 ] [ 1 116 22 ] + [ 19 74 32 ] [ 1 74 30 ] [ 1 72 28 ] + [ 30 38 32 ] [ 2 29 30 ] [ 0 -1 -1 ] + [ 39 20 32 ] [ 2 37 26 ] [ 1 38 26 ] ] + [ (62) 145 18 7 18295 [ 12 126 24 ] [ 3 136 26 ] [ 0 -1 -1 ] + [ 21 70 30 ] [ 2 65 28 ] [ 0 -1 -1 ] + [ 34 35 30 ] [ 1 44 32 ] [ 0 -1 -1 ] + [ 42 20 30 ] [ 2 19 28 ] [ 2 18 28 ] ] + [ (63) 147 18 7 18847 [ 12 126 24 ] [ 3 117 22 ] [ 1 116 22 ] + [ 25 61 26 ] [ 2 62 28 ] [ 0 -1 -1 ] + [ 34 35 30 ] [ 1 40 32 ] [ 1 41 32 ] + [ 45 20 30 ] [ 1 20 32 ] [ 1 21 32 ] ] + [ (64) 149 19 7 19403 [ 15 105 20 ] [ 2 115 22 ] [ 2 116 22 ] + [ 25 65 28 ] [ 1 72 28 ] [ 0 -1 -1 ] + [ 18 35 30 ] [ 17 37 32 ] [ 1 50 32 ] + [ 42 20 30 ] [ 6 19 28 ] [ 1 15 28 ] ] + [ (65) 151 19 7 19971 [ 19 105 20 ] [ 1 101 20 ] [ 0 -1 -1 ] + [ 33 51 22 ] [ 1 65 22 ] [ 0 -1 -1 ] + [ 40 33 28 ] [ 1 28 28 ] [ 0 -1 -1 ] + [ 49 20 30 ] [ 1 18 28 ] [ 0 -1 -1 ] ] + [ (66) 153 17 8 20229 [ 18 105 20 ] [ 2 117 22 ] [ 0 -1 -1 ] + [ 26 65 28 ] [ 1 80 30 ] [ 0 -1 -1 ] + [ 35 35 30 ] [ 3 35 28 ] [ 1 36 28 ] + [ 52 18 28 ] [ 2 38 30 ] [ 0 -1 -1 ] ] + [ (67) 155 17 8 20805 [ 26 84 16 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 26 70 30 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 45 31 26 ] [ 1 9 26 ] [ 0 -1 -1 ] + [ 52 20 30 ] [ 0 -1 -1 ] [ 0 -1 -1 ] ] + [ (68) 157 17 8 21389 [ 16 126 24 ] [ 1 114 22 ] [ 1 115 22 ] + [ 23 70 30 ] [ 3 65 28 ] [ 1 66 28 ] + [ 40 35 30 ] [ 1 43 30 ] [ 0 -1 -1 ] + [ 46 20 30 ] [ 7 19 28 ] [ 1 16 28 ] ] + [ (69) 159 18 8 21993 [ 19 116 22 ] [ 1 105 22 ] [ 0 -1 -1 ] + [ 20 70 30 ] [ 7 66 28 ] [ 1 63 28 ] + [ 40 35 30 ] [ 1 42 32 ] [ 1 43 32 ] + [ 54 20 30 ] [ 1 19 30 ] [ 0 -1 -1 ] ] + [ (70) 161 18 8 22593 [ 17 126 24 ] [ 2 115 22 ] [ 0 -1 -1 ] + [ 24 70 30 ] [ 4 74 32 ] [ 0 -1 -1 ] + [ 48 31 26 ] [ 2 18 26 ] [ 0 -1 -1 ] + [ 54 19 28 ] [ 6 15 26 ] [ 1 14 26 ] ] + [ (71) 163 18 8 23201 [ 29 84 16 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 29 70 30 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 6 34 30 ] [ 3 36 30 ] [ 38 33 28 ] + [ 58 20 30 ] [ 0 -1 -1 ] [ 0 -1 -1 ] ] + [ (72) 165 18 8 23817 [ 16 147 28 ] [ 1 149 28 ] [ 0 -1 -1 ] + [ 31 66 28 ] [ 1 37 26 ] [ 0 -1 -1 ] + [ 48 33 28 ] [ 1 23 26 ] [ 0 -1 -1 ] + [ 53 20 30 ] [ 6 19 28 ] [ 1 17 28 ] ] + [ (73) 167 19 8 24453 [ 20 115 22 ] [ 2 134 24 ] [ 0 -1 -1 ] + [ 29 66 28 ] [ 2 56 26 ] [ 2 57 26 ] + [ 45 36 30 ] [ 2 15 28 ] [ 0 -1 -1 ] + [ 59 20 30 ] [ 2 21 32 ] [ 0 -1 -1 ] ] + [ (74) 169 19 8 25085 [ 17 147 28 ] [ 1 134 26 ] [ 0 -1 -1 ] + [ 26 70 30 ] [ 5 75 32 ] [ 0 -1 -1 ] + [ 47 35 30 ] [ 1 48 32 ] [ 0 -1 -1 ] + [ 64 18 28 ] [ 2 33 30 ] [ 1 35 30 ] ] + [ (75) 171 17 9 25373 [ 22 115 22 ] [ 1 133 24 ] [ 0 -1 -1 ] + [ 33 65 28 ] [ 1 74 28 ] [ 0 -1 -1 ] + [ 43 36 30 ] [ 5 27 28 ] [ 1 30 28 ] + [ 57 20 30 ] [ 5 21 32 ] [ 1 24 32 ] ] + [ (76) 173 17 9 26021 [ 18 136 26 ] [ 2 142 26 ] [ 0 -1 -1 ] + [ 33 66 28 ] [ 2 49 26 ] [ 0 -1 -1 ] + [ 48 35 30 ] [ 2 38 28 ] [ 0 -1 -1 ] + [ 64 20 30 ] [ 1 20 32 ] [ 0 -1 -1 ] ] + [ (77) 175 17 9 26677 [ 19 126 24 ] [ 2 135 26 ] [ 1 136 26 ] + [ 32 66 28 ] [ 2 55 26 ] [ 2 56 26 ] + [ 49 36 30 ] [ 2 18 32 ] [ 0 -1 -1 ] + [ 65 18 28 ] [ 5 27 30 ] [ 1 29 30 ] ] + [ (78) 177 18 9 27335 [ 20 137 26 ] [ 1 130 26 ] [ 0 -1 -1 ] + [ 30 75 32 ] [ 2 71 32 ] [ 0 -1 -1 ] + [ 46 35 30 ] [ 6 39 32 ] [ 0 -1 -1 ] + [ 3 12 30 ] [ 70 19 28 ] [ 0 -1 -1 ] ] + [ (79) 179 18 9 28007 [ 20 147 28 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 35 70 30 ] [ 0 -1 -1 ] [ 0 -1 -1 ] + [ 49 35 30 ] [ 5 35 28 ] [ 0 -1 -1 ] + [ 70 20 30 ] [ 0 -1 -1 ] [ 0 -1 -1 ] ] + [ (80) 181 18 9 28687 [ 21 136 26 ] [ 1 155 28 ] [ 0 -1 -1 ] + [ 34 70 30 ] [ 1 64 28 ] [ 1 65 28 ] + [ 54 35 30 ] [ 1 45 30 ] [ 0 -1 -1 ] + [ 68 20 30 ] [ 3 18 28 ] [ 1 19 28 ] ] + [ (81) 183 18 9 29375 [ 19 126 24 ] [ 5 115 22 ] [ 1 114 22 ] + [ 33 70 30 ] [ 3 65 28 ] [ 1 64 28 ] + [ 52 35 30 ] [ 3 41 32 ] [ 1 40 32 ] + [ 67 20 30 ] [ 5 21 32 ] [ 1 24 32 ] ] + [ (82) 185 18 9 30071 [ 2 150 28 ] [ 21 136 26 ] [ 0 -1 -1 ] + [ 32 70 30 ] [ 6 65 28 ] [ 0 -1 -1 ] + [ 52 38 32 ] [ 2 27 32 ] [ 0 -1 -1 ] + [ 73 20 30 ] [ 2 22 32 ] [ 0 -1 -1 ] ] + [ (83) 187 17 10 30387 [ 21 126 24 ] [ 4 136 26 ] [ 0 -1 -1 ] + [ 30 74 32 ] [ 6 73 30 ] [ 0 -1 -1 ] + [ 54 35 30 ] [ 4 40 32 ] [ 0 -1 -1 ] + [ 75 20 30 ] [ 1 20 28 ] [ 0 -1 -1 ] ] + [ (84) 189 17 10 31091 [ 30 105 20 ] [ 1 114 22 ] [ 0 -1 -1 ] + [ 3 45 22 ] [ 55 47 20 ] [ 0 -1 -1 ] + [ 2 26 26 ] [ 62 33 28 ] [ 0 -1 -1 ] + [ 79 18 28 ] [ 4 33 30 ] [ 0 -1 -1 ] ] + ] def + + /eclval eclevel 1 get 49 sub def + 0 1 83 { + /i exch def + /m metrics i get def + /vers m 0 get def % Version of symbol + /size m 1 get def % Length of side + /alnk m 2 get def % Regular alignment pattern length + /alnn m 3 get def % Number of alignment patterns + /alnr size alnk alnn mul sub def % Remainder alignment pattern length + /nmod m 4 get def % Number of modules + /ncws nmod 8 idiv def % Total number of codewords + /rbit nmod 8 mod def % Number of remainder bits + /ecbs m 5 eclval 3 mul add 3 getinterval def % Error correction blocks + /ecws 0 ecbs {dup 0 get exch 2 get mul add} forall def % Number of error correction codewords + /dcws ncws ecws sub def % Number of data codewords + /dmod dcws 8 mul def % Number of data modules + /okay true def + version (unset) ne version vers ne and {/okay false def} if % The version must match that supplied + bits length dmod gt {/okay false def} if % Bitstream must fit into data modules + okay {exit} if + } for + + okay not { + /bwipp.hanxinNoValidSymbol (No valid symbol available) //raiseerror exec + } if + + /version vers def + /msgbits bits def + /e1nb ecbs 0 get 0 get def /e2nb ecbs 1 get 0 get def /e3nb ecbs 2 get 0 get def + /e1dcws ecbs 0 get 1 get def /e2dcws ecbs 1 get 1 get def /e3dcws ecbs 2 get 1 get def + /e1ecws ecbs 0 get 2 get def /e2ecws ecbs 1 get 2 get def /e3ecws ecbs 2 get 2 get def + + % Expand the message bits by adding padding as necessary + /pad dmod string def + 0 1 pad length 1 sub {pad exch 48 put} for + pad 0 msgbits putinterval + + % Evaluate the padded message into codewords + /cws dcws array def + 0 1 cws length 1 sub { + /c exch def + /cwb pad c 8 mul 8 getinterval def + /cw 0 def + 0 1 7 { + /i exch def + /cw cw 2 8 i sub 1 sub exp cvi cwb i get 48 sub mul add def + } for + cws c cw put + } for + + /rscodes { + + /rspm exch def + /rsgf exch def + /rsnc exch def + /rscws exch def + + % Calculate the log and anti-log tables + /rsalog [ 1 rsgf 1 sub { dup 2 mul dup rsgf ge {rspm xor} if } repeat ] def + /rslog rsgf array def + 1 1 rsgf 1 sub {dup rsalog exch get exch rslog 3 1 roll put} for + + % Function to calculate the product in the field + /rsprod { + 2 copy 0 ne exch 0 ne and { + rslog exch get exch rslog exch get add rsgf 1 sub mod rsalog exch get + } { + pop pop 0 + } ifelse + } bind def + + % Generate the coefficients + /coeffs [ 1 rsnc {0} repeat ] def + 1 1 rsnc { + /i exch def + coeffs i coeffs i 1 sub get put + i 1 sub -1 1 { + /j exch def + coeffs j coeffs j 1 sub get coeffs j get rsalog i get rsprod xor put + } for + coeffs 0 coeffs 0 get rsalog i get rsprod put + } for + + % Extend the input with the error correction values + /nd rscws length def + /rscws [ rscws {} forall rsnc {0} repeat 0 ] def + 0 1 nd 1 sub { + /k exch rscws exch get rscws nd get xor def + 0 1 rsnc 1 sub { + /j exch def + rscws nd j add rscws nd j add 1 add get k coeffs rsnc j sub 1 sub get rsprod xor put + } for + } for + + % Return all but the last codeword + rscws 0 rscws length 1 sub getinterval + + } bind def + + % Divide codewords into two groups of blocks and calculate the error correction codewords + /dcwsb e1nb e2nb add e3nb add array def + /ecwsb dcwsb length array def + /in 0 def /out 0 def + e1nb { + cws in e1dcws getinterval e1ecws 256 355 rscodes + dup 0 e1dcws getinterval dcwsb exch out exch put + e1dcws e1ecws getinterval ecwsb exch out exch put + /in in e1dcws add def /out out 1 add def + } repeat + e2nb { + cws in e2dcws getinterval e2ecws 256 355 rscodes + dup 0 e2dcws getinterval dcwsb exch out exch put + e2dcws e2ecws getinterval ecwsb exch out exch put + /in in e2dcws add def /out out 1 add def + } repeat + e3nb { + cws in e3dcws getinterval e3ecws 256 355 rscodes + dup 0 e3dcws getinterval dcwsb exch out exch put + e3dcws e3ecws getinterval ecwsb exch out exch put + /in in e3dcws add def /out out 1 add def + } repeat + + % Reassemble the codewords + /cws ncws array def + /cw 0 def + 0 1 dcwsb length 1 sub { + /i exch def + dcwsb i get dup cws exch cw exch putinterval length cw add /cw exch def + ecwsb i get dup cws exch cw exch putinterval length cw add /cw exch def + } for + + % Split codewords into groups of 13 and concatenate + /cws [ + 0 1 ncws 1 sub 12 2 copy gt {exch} if pop { + 13 ncws 1 sub { dup ncws lt {cws exch get} {pop} ifelse } for + } for + ] def + + % Extend codewords by one if there are remainder bits + rbit 0 gt { + /pad cws length 1 add array def + pad 0 cws putinterval + pad pad length 1 sub 0 put + /cws pad def + } if + + % Create the bitmap + /pixs [ size size mul {-1} repeat ] def + /qmv {size mul add} bind def + + % Alignment patterns + alnn 0 ne { + /trmv {size mul size add 1 sub exch sub} bind def + /aplot { + 3 1 roll 3 copy exch trmv pixs exch 3 -1 roll put + trmv pixs exch 3 -1 roll put + } bind def + /i 0 def /stag 0 def { + i size ge {exit} if + 0 1 size 1 sub { + /j exch def + j alnr add size lt { + j alnk idiv stag add 2 mod 0 eq % Staggered groups of k modules + i 0 eq j alnk lt and not and % Keep clear at top right + j alnk mod 0 eq or % Complete regular-spaced grid + } { + alnn stag add 2 mod 0 eq % Bottom right remainder + } ifelse + { + j i 1 aplot + j 1 add i 1 add 2 copy size lt exch size lt and {0 aplot} {pop pop} ifelse + } if + } for + i alnr add size eq { + /i i alnr add 1 sub def + } { + /i i alnk add def + } ifelse + /stag 1 stag sub def + } loop + alnk alnk size 2 sub { + /i exch def + i alnk idiv 2 mod 0 ne { + pixs 0 i 1 sub trmv 0 put + pixs 0 i 1 add trmv 0 put + pixs 1 i 1 sub trmv 0 put + pixs 1 i trmv 0 put + pixs 1 i 1 add trmv 0 put + pixs i 1 sub 0 trmv 0 put + pixs i 1 add 0 trmv 0 put + pixs i 1 sub 1 trmv 0 put + pixs i 1 trmv 0 put + pixs i 1 add 1 trmv 0 put + } if + pixs size 1 sub i 1 sub trmv get 1 ne { + pixs size 1 sub i 1 sub trmv 0 put + pixs size 2 sub i 1 sub trmv 0 put + pixs size 2 sub i trmv 0 put + pixs size 2 sub i 1 add trmv 0 put + pixs size 1 sub i 1 add trmv 0 put + pixs i 1 sub size 1 sub trmv 0 put + pixs i 1 sub size 2 sub trmv 0 put + pixs i size 2 sub trmv 0 put + pixs i 1 add size 2 sub trmv 0 put + pixs i 1 add size 1 sub trmv 0 put + } if + } for + } if + + % Finder patterns + /fpat [ + [ 1 1 1 1 1 1 1 0 ] + [ 1 0 0 0 0 0 0 0 ] + [ 1 0 1 1 1 1 1 0 ] + [ 1 0 1 0 0 0 0 0 ] + [ 1 0 1 0 1 1 1 0 ] + [ 1 0 1 0 1 1 1 0 ] + [ 1 0 1 0 1 1 1 0 ] + [ 0 0 0 0 0 0 0 0 ] + ] def + /fpat2 [ + [ 1 1 1 0 1 0 1 0 ] + [ 1 1 1 0 1 0 1 0 ] + [ 1 1 1 0 1 0 1 0 ] + [ 0 0 0 0 1 0 1 0 ] + [ 1 1 1 1 1 0 1 0 ] + [ 0 0 0 0 0 0 1 0 ] + [ 1 1 1 1 1 1 1 0 ] + [ 0 0 0 0 0 0 0 0 ] + ] def + 0 1 fpat length 1 sub { + /y exch def + 0 1 fpat 0 get length 1 sub { + /x exch def + /fpb fpat y get x get def + /fpb2 fpat2 y get x get def + pixs x y qmv fpb put + pixs size x sub 1 sub y qmv fpb put + pixs size x sub 1 sub size y sub 1 sub qmv fpb put + pixs x size y sub 1 sub qmv fpb2 put + } for + } for + + % Format information modules + /functionmap [ + [ [ 0 8 ] [ size 1 sub size 9 sub ] ] [ [ 1 8 ] [ size 2 sub size 9 sub ] ] + [ [ 2 8 ] [ size 3 sub size 9 sub ] ] [ [ 3 8 ] [ size 4 sub size 9 sub ] ] + [ [ 4 8 ] [ size 5 sub size 9 sub ] ] [ [ 5 8 ] [ size 6 sub size 9 sub ] ] + [ [ 6 8 ] [ size 7 sub size 9 sub ] ] [ [ 7 8 ] [ size 8 sub size 9 sub ] ] + [ [ 8 8 ] [ size 9 sub size 9 sub ] ] + [ [ 8 7 ] [ size 9 sub size 8 sub ] ] [ [ 8 6 ] [ size 9 sub size 7 sub ] ] + [ [ 8 5 ] [ size 9 sub size 6 sub ] ] [ [ 8 4 ] [ size 9 sub size 5 sub ] ] + [ [ 8 3 ] [ size 9 sub size 4 sub ] ] [ [ 8 2 ] [ size 9 sub size 3 sub ] ] + [ [ 8 1 ] [ size 9 sub size 2 sub ] ] [ [ 8 0 ] [ size 9 sub size 1 sub ] ] + [ [ size 9 sub 0 ] [ 8 size 1 sub ] ] [ [ size 9 sub 1 ] [ 8 size 2 sub ] ] + [ [ size 9 sub 2 ] [ 8 size 3 sub ] ] [ [ size 9 sub 3 ] [ 8 size 4 sub ] ] + [ [ size 9 sub 4 ] [ 8 size 5 sub ] ] [ [ size 9 sub 5 ] [ 8 size 6 sub ] ] + [ [ size 9 sub 6 ] [ 8 size 7 sub ] ] [ [ size 9 sub 7 ] [ 8 size 8 sub ] ] + [ [ size 9 sub 8 ] [ 8 size 9 sub ] ] + [ [ size 8 sub 8 ] [ 7 size 9 sub ] ] [ [ size 7 sub 8 ] [ 6 size 9 sub ] ] + [ [ size 6 sub 8 ] [ 5 size 9 sub ] ] [ [ size 5 sub 8 ] [ 4 size 9 sub ] ] + [ [ size 4 sub 8 ] [ 3 size 9 sub ] ] [ [ size 3 sub 8 ] [ 2 size 9 sub ] ] + [ [ size 2 sub 8 ] [ 1 size 9 sub ] ] [ [ size 1 sub 8 ] [ 0 size 9 sub ] ] + ] def + functionmap { + { {} forall qmv pixs exch 0 put } forall + } forall + + /maskfuncs [ + {pop pop 1} bind + {add 2 mod} bind + {1 index add 3 mod exch 3 mod add 2 mod} bind + {2 copy mod 3 1 roll 2 copy exch mod 3 1 roll 3 mod exch 3 mod + add add add 2 mod} bind + ] def + mask -1 ne { % User specifies a mask + /maskfuncs [maskfuncs mask 1 sub get] def + /bestmaskval mask 1 sub def + } if + /masks maskfuncs length array def + 0 1 masks length 1 sub { + /m exch def + /mask size size mul array def + 0 1 size 1 sub { + /j exch def + 0 1 size 1 sub { + /i exch def + i 1 add j 1 add maskfuncs m get exec 0 eq + pixs i j qmv get -1 eq and {1} {0} ifelse + mask i j qmv 3 -1 roll put + } for + } for + masks m mask put + } for + + % Walk the symbol placing the bitstream + /posx 0 def + /posy 0 def + /num 0 def + { % loop + posy size eq {exit} if + pixs posx posy qmv get -1 eq { + cws num 8 idiv get 7 num 8 mod sub neg bitshift 1 and + pixs posx posy qmv 3 -1 roll put + /num num 1 add def + } if + /posx posx 1 add def + posx size eq {/posx 0 def /posy posy 1 add def} if + } loop + + % Evaluate runlength encoded rows or columns in full symbols + /evalfulln1n3 { + /scrle exch def + % Detect runs of 3 or more like modules + /scr1 0 scrle { dup 3 ge {4 mul add dup} if pop } forall def + /scr3 0 def + % Detect 1:1:1:1:3 ratio next to 3 modules of whitespace + 5 2 scrle length 1 sub { % Scan odd (dark) runs within bounds + /j exch def + scrle j get 3 mod 0 eq { % Multiple of 3 black modules + /fact scrle j get 3 idiv def + scrle j 4 sub 4 getinterval {fact eq} forall and and and { + j 5 eq j 2 add scrle length ge or { % At either extent of run + /scr3 scr3 50 add def + } { % Bounded by dark modules + scrle j 5 sub get 3 ge scrle j 1 add get 3 ge or { + /scr3 scr3 50 add def + } if + } ifelse + } if + } if + } for + % Detect 3:1:1:1:1 ratio next to 3 modules of whitespace + 1 2 scrle length 5 sub { % Scan odd (dark) runs within bounds + /j exch def + scrle j get 3 mod 0 eq { % Multiple of 3 black modules + /fact scrle j get 3 idiv def + scrle j 1 add 4 getinterval {fact eq} forall and and and { + j 1 eq j 6 add scrle length ge or { % At either extent of run + /scr3 scr3 50 add def + } { % Bounded by dark modules + scrle j 1 sub get 3 ge scrle j 5 add get 3 ge or { + /scr3 scr3 50 add def + } if + } ifelse + } if + } if + } for + scr1 scr3 + } bind def + + % Evaluation algorithm + /evalfull { + /sym exch def + + /n1 0 def /n3 0 def + /rle size 1 add array def + /lastpairs size array def + /thispairs size array def + /sizeadd1 size 1 add def + 0 1 size 1 sub { + /i exch def - % Module matrix for layout of the codewords - /mmat dcws rscw add stype {5} {8} ifelse mul array def - /r 0 def /c 0 def - 0 stype {2} {1} ifelse cws length 1 sub { - /i exch def - stype not { - (00000000) 8 string copy dup cws i get 2 8 string cvrs - dup length 8 exch sub exch putinterval [ exch {48 sub} forall ] - dup 0 4 getinterval /top exch def - 4 4 getinterval /bot exch def - } { - (00000) 5 string copy dup cws i get 2 5 string cvrs - dup length 5 exch sub exch putinterval [ exch {48 sub} forall ] - /c1 exch def - (00000) 5 string copy dup cws i 1 add get 2 5 string cvrs - dup length 5 exch sub exch putinterval [ exch {48 sub} forall ] - /c2 exch def - /top [ c1 0 3 getinterval aload pop c2 0 2 getinterval aload pop ] def - /bot [ c1 3 2 getinterval aload pop c2 2 3 getinterval aload pop ] def - } ifelse - mmat r dcol mul c add top putinterval - mmat r 1 add dcol mul c add bot putinterval - /c c top length add def - c dcol eq {/c 0 def /r r 2 add def} if - } for + % Runlength encode (light, dark, light, ...) and evaluate each column + mark 0 0 + i size dup dup mul 1 sub { + sym exch get exch 1 index eq {exch 1 add exch} {1 exch} ifelse + } for + pop + rle 0 counttomark 2 sub getinterval astore + evalfulln1n3 n3 add /n3 exch def n1 add /n1 exch def + pop - % Create bitmap and add finder patterns - /mmv {cols mul add} bind def - /pixs [ rows cols mul {-1} repeat ] def + % Runlength encode (light, dark, light, ...) and evaluate each row + /symrow sym i size mul size getinterval def + mark 0 0 + symrow { + exch 1 index eq {exch 1 add exch} {1 exch} ifelse + } forall + pop + rle 0 counttomark 2 sub getinterval astore + evalfulln1n3 n3 add /n3 exch def n1 add /n1 exch def + pop - % Centre pattern - /artifact [ - {cols {0} repeat} bind - {cols {1} repeat} bind - {0 cols 2 sub {1} repeat 0} bind - {0 1 cols 4 sub {0} repeat 1 0} bind - {cols 1 sub 2 idiv {-1} repeat 1 cols 1 sub 2 idiv {-1} repeat} bind - {cols 1 sub 2 idiv {-1} repeat 0 cols 1 sub 2 idiv {-1} repeat} bind - {1 cols 2 sub {0} repeat 1} bind - {1 0 cols 4 sub {1} repeat 0 1} bind - ] def - /cpat << - /A (121343) - /B (12134343) - /C (12121343) - /D (1213434343) - /E (1212134343) - /F (1212121343) - /G (121213434343) - /H (121212134343) - /S (56661278) - /T (5666666666127878) - >> vers 0 1 getinterval get def - pixs 0 rows cpat length sub 2 idiv mmv - [ cpat {artifact exch 49 sub get exec} forall ] putinterval + } for - % Risers - 0 1 risl 1 sub { - /i exch def - riso risi cols 1 sub { - /j exch def - [ 1 i 12 mod 0 eq {1} {0} ifelse ] dup - pixs j i mmv - 3 -1 roll putinterval - i risl 1 sub ne { - pixs cols j sub 2 sub rows i sub 1 sub mmv - 3 -1 roll putinterval - } {pop} ifelse + n1 n3 add + } bind def + + % Evaluate the masked symbols to find the most suitable + /bestscore 999999999 def + 0 1 masks length 1 sub { + /m exch def + /masksym size size mul array def + 0 1 size size mul 1 sub { + /i exch def + masksym i pixs i get masks m get i get xor put } for + masks length 1 ne { + masksym evalfull /score exch def + score bestscore lt { + /bestsym masksym def + /bestmaskval m def + /bestscore score def + } if + } { + /bestsym masksym def + } ifelse } for + /pixs bestsym def - % Black dots - << - /A [ [12 5] ] - /B [ [16 7] ] - /C [ [26 12] ] - /D [] - /E [ [26 23] ] - /F [ [26 32] [70 32] [26 34] [70 34] ] - /G [ [27 48] [69 48] ] - /H [ [26 70] [66 70] [106 70] [26 72] [66 72] [106 72] ] - /S-10 [] - /S-20 [ [10 4] ] - /S-30 [ [15 4] [15 6] ] - /T-16 [ [8 10] ] - /T-32 [ [16 10] [16 12] ] - /T-48 [ [24 10] [24 12] [24 14] ] - >> vers get {pixs exch aload pop mmv 1 put} forall - - % Place the modules onto a pixel map between alignment patterns - /j 0 def - 0 1 pixs length 1 sub { + % Add the function information + /funval size 21 sub 2 idiv 20 add 4 mul eclval add 4 mul bestmaskval add def + [ funval 16#0F00 and -8 bitshift + funval 16#00F0 and -4 bitshift + funval 16#000F and ] + 4 16 19 rscodes /funvals exch def + /funbits [ + funvals { + 4 tobin {48 sub} forall + } forall + 0 1 0 1 0 1 + ] def + 0 1 functionmap length 1 sub { /i exch def - pixs i get -1 eq { - pixs i mmat j get put - /j j 1 add def - } if + functionmap i get { + pixs exch aload pop qmv funbits i get put + } forall } for % Return the arguments << /ren //renmatrix /pixs pixs - /pixx cols - /pixy rows - /height rows 72 div 2 mul - /width cols 72 div 2 mul + /pixx size + /pixy size + /height size 2 mul 72 div + /width size 2 mul 72 div /opt options >> @@ -18509,12 +19960,12 @@ begin end } bind def -/codeone dup load /uk.co.terryburton.bwipp defineresource pop +/hanxin dup load /uk.co.terryburton.bwipp defineresource pop end /setpacking where {pop setpacking} if %%EndData %%EndResource -% --END ENCODER codeone-- +% --END ENCODER hanxin-- % --BEGIN ENCODER gs1-cc-- % --REQUIRES preamble raiseerror renmatrix micropdf417 pdf417-- @@ -18522,7 +19973,7 @@ end % --EXAM: (01)95012345678903(3103)000123 % --EXOP: ccversion=b cccolumns=4 % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp gs1-cc 0.0 2015050900 201765 192297 +%%BeginResource: uk.co.terryburton.bwipp gs1-cc 0.0 2016042100 201765 192209 %%BeginData: 650 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -19184,7 +20635,7 @@ end % --EXAM: 2112345678900|(99)1234-abcd % --EXOP: includetext % --RNDR: renlinear renmatrix -%%BeginResource: uk.co.terryburton.bwipp ean13composite 0.0 2015050900 84039 84015 +%%BeginResource: uk.co.terryburton.bwipp ean13composite 0.0 2016042100 84127 84015 %%BeginData: 72 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -19268,7 +20719,7 @@ end % --EXAM: 02345673|(21)A12345678 % --EXOP: includetext % --RNDR: renlinear renmatrix -%%BeginResource: uk.co.terryburton.bwipp ean8composite 0.0 2015050900 84340 84317 +%%BeginResource: uk.co.terryburton.bwipp ean8composite 0.0 2016042100 84428 84317 %%BeginData: 75 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -19355,7 +20806,7 @@ end % --EXAM: 416000336108|(99)1234-abcd % --EXOP: includetext % --RNDR: renlinear renmatrix -%%BeginResource: uk.co.terryburton.bwipp upcacomposite 0.0 2015050900 84017 84082 +%%BeginResource: uk.co.terryburton.bwipp upcacomposite 0.0 2016042100 84017 87498 %%BeginData: 72 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 2 dict @@ -19439,7 +20890,7 @@ end % --EXAM: 00123457|(15)021231 % --EXOP: includetext % --RNDR: renlinear renmatrix -%%BeginResource: uk.co.terryburton.bwipp upcecomposite 0.0 2015050900 88475 84857 +%%BeginResource: uk.co.terryburton.bwipp upcecomposite 0.0 2016042100 88387 84857 %%BeginData: 87 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 2 dict @@ -19538,7 +20989,7 @@ end % --EXAM: (01)03612345678904|(11)990102 % --EXOP: % --RNDR: renlinear renmatrix -%%BeginResource: uk.co.terryburton.bwipp databaromnicomposite 0.0 2015050900 83884 87420 +%%BeginResource: uk.co.terryburton.bwipp databaromnicomposite 0.0 2016042100 87388 83828 %%BeginData: 100 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 2 dict @@ -19650,7 +21101,7 @@ end % --EXAM: (01)03412345678900|(17)010200 % --EXOP: % --RNDR: renlinear renmatrix -%%BeginResource: uk.co.terryburton.bwipp databarstackedcomposite 0.0 2015050900 89818 86093 +%%BeginResource: uk.co.terryburton.bwipp databarstackedcomposite 0.0 2016042100 89818 86093 %%BeginData: 96 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 2 dict @@ -19758,7 +21209,7 @@ end % --EXAM: (01)03612345678904|(11)990102 % --EXOP: % --RNDR: renlinear renmatrix -%%BeginResource: uk.co.terryburton.bwipp databarstackedomnicomposite 0.0 2015050900 89894 86165 +%%BeginResource: uk.co.terryburton.bwipp databarstackedomnicomposite 0.0 2016042100 89894 86165 %%BeginData: 96 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 2 dict @@ -19866,7 +21317,7 @@ end % --EXAM: (01)03612345678904|(11)990102 % --EXOP: % --RNDR: renlinear renmatrix -%%BeginResource: uk.co.terryburton.bwipp databartruncatedcomposite 0.0 2015050900 90784 87051 +%%BeginResource: uk.co.terryburton.bwipp databartruncatedcomposite 0.0 2016042100 90784 87051 %%BeginData: 100 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 2 dict @@ -19978,7 +21429,7 @@ end % --EXAM: (01)03512345678907|(21)abcdefghijklmnopqrstuv % --EXOP: % --RNDR: renlinear renmatrix -%%BeginResource: uk.co.terryburton.bwipp databarlimitedcomposite 0.0 2015050900 80661 80522 +%%BeginResource: uk.co.terryburton.bwipp databarlimitedcomposite 0.0 2016042100 80661 80522 %%BeginData: 79 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 2 dict @@ -20069,7 +21520,7 @@ end % --EXAM: (01)93712345678904(3103)001234|(91)1A2B3C4D5E % --EXOP: % --RNDR: renlinear renmatrix -%%BeginResource: uk.co.terryburton.bwipp databarexpandedcomposite 0.0 2015050900 86979 83324 +%%BeginResource: uk.co.terryburton.bwipp databarexpandedcomposite 0.0 2016042100 83387 86828 %%BeginData: 98 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 2 dict @@ -20179,7 +21630,7 @@ end % --EXAM: (01)00012345678905(10)ABCDEF|(21)12345678 % --EXOP: segments=4 % --RNDR: renmatrix renlinear -%%BeginResource: uk.co.terryburton.bwipp databarexpandedstackedcomposite 0.0 2015050900 89645 89413 +%%BeginResource: uk.co.terryburton.bwipp databarexpandedstackedcomposite 0.0 2016042100 86317 89413 %%BeginData: 95 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 2 dict @@ -20286,7 +21737,7 @@ end % --EXAM: (00)030123456789012340|(02)13012345678909(37)24(10)1234567ABCDEFG % --EXOP: ccversion=c % --RNDR: renlinear renmatrix -%%BeginResource: uk.co.terryburton.bwipp gs1-128composite 0.0 2015050900 86884 89985 +%%BeginResource: uk.co.terryburton.bwipp gs1-128composite 0.0 2016042100 90300 86481 %%BeginData: 100 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 2 dict @@ -20354,59 +21805,205 @@ begin dup (bhs) get 0 get 72 mul /linheight exch def //renlinear exec - % Plot the separator - mark - 1 linsbs {1 index 0 eq {{1}} {{0}} ifelse repeat} forall - counttomark 1 sub array astore /sep exch def pop pop - 0 linheight rmoveto << - /ren //renmatrix - /pixs sep - /pixx sep length - /pixy 1 - /height 1 72 div - /width sep length 72 div - /opt options - >> //renmatrix exec + % Plot the separator + mark + 1 linsbs {1 index 0 eq {{1}} {{0}} ifelse repeat} forall + counttomark 1 sub array astore /sep exch def pop pop + 0 linheight rmoveto << + /ren //renmatrix + /pixs sep + /pixx sep length + /pixy 1 + /height 1 72 div + /width sep length 72 div + /opt options + >> //renmatrix exec + + % Plot the 2D part + linktype (a) eq { + /s linwidth 2 sub 11 idiv def + /p s 9 sub 2 idiv def + /x s p sub 1 sub 11 mul 10 add p 0 eq {2 add} if 99 sub def + x 1 rmoveto + } { + -7 1 rmoveto + } ifelse + + compsym //renmatrix exec + + grestore + + end + +} bind def +/gs1-128composite dup load /uk.co.terryburton.bwipp defineresource pop +end +/setpacking where {pop setpacking} if +%%EndData +%%EndResource +% --END ENCODER gs1-128composite-- + +% --BEGIN ENCODER gs1datamatrix-- +% --REQUIRES preamble raiseerror renmatrix datamatrix-- +% --DESC: GS1 Data Matrix +% --EXAM: (01)03453120000011(17)120508(10)ABCD1234(410)9501101020917 +% --EXOP: +% --RNDR: renmatrix +%%BeginResource: uk.co.terryburton.bwipp gs1datamatrix 0.0 2016042100 78432 74670 +%%BeginData: 134 ASCII Lines +/setpacking where {pop currentpacking true setpacking} if +1 dict +dup /raiseerror dup /uk.co.terryburton.bwipp findresource put +dup /renmatrix dup /uk.co.terryburton.bwipp findresource put +dup /datamatrix dup /uk.co.terryburton.bwipp findresource put +begin +/gs1datamatrix { + + 20 dict begin % Confine variables to local scope + + /options exch def % We are given an option string + /barcode exch def % We are given a barcode string + + /dontdraw false def + + % Parse the input options + options type /stringtype eq { + 1 dict begin + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + currentdict end /options exch def + } if + options {def} forall + + % Expand ordinals of the form ^NNN to ASCII + /expand { + /in exch def + /out in length string def + /j 0 def + in + { % loop + (^) search { + dup out exch j exch putinterval + length j add 1 add /j exch def + pop + dup 0 3 getinterval cvi out exch j 1 sub exch put + dup length 3 sub 3 exch getinterval + } { + dup out exch j exch putinterval + length j add /j exch def + out 0 j getinterval exit + } ifelse + } loop + } bind def + + % Parse out AIs + /ais [] def + /aival 2 dict def + barcode dup length 1 sub 1 exch getinterval + { % loop + dup () eq {exit} if + (\)) search pop + exch pop + exch (\() search { + exch pop exch 3 1 roll + } { + () 3 1 roll + } ifelse + [ ais aload pop counttomark 2 add index ] /ais exch def + aival 3 1 roll expand put + } loop + pop + + % Pre-defined fixed length data field AIs + % any AI whose prefix is not included in this table must be + % terminated with "FNC1", even if it's fixed length + /aifixed 23 dict def + [ + 0 1 4 {} for + ] { + (00) 2 string copy dup dup 1 5 -1 roll 48 add put aifixed 3 1 roll put + } forall + [ + 11 1 20 {} for + 23 + 31 1 36 {} for + 41 + ] { + 10 2 string cvrs dup aifixed 3 1 roll put + } forall - % Plot the 2D part - linktype (a) eq { - /s linwidth 2 sub 11 idiv def - /p s 9 sub 2 idiv def - /x s p sub 1 sub 11 mul 10 add p 0 eq {2 add} if 99 sub def - x 1 rmoveto - } { - -7 1 rmoveto - } ifelse + % Create the datamatrix data + /fnc1 -1 def + /dmtx [ fnc1 ] def + 0 1 ais length 1 sub { + /i exch def + /ai ais i get def + /val aival ai get def + dmtx length ai length add val length add array + dup 0 dmtx putinterval + dup dmtx length ai [ exch {} forall ] putinterval + dup dmtx length ai length add val [ exch {} forall ] putinterval + /dmtx exch def + i ais length 1 sub ne aifixed ai 0 2 getinterval known not and { % Append FNC1 + dmtx length 1 add array + dup 0 dmtx putinterval + dup dmtx length fnc1 put + /dmtx exch def + } if + } for - compsym //renmatrix exec + % Compose input to datamatrix + /barcode dmtx length 1 add 5 mul string def + /i 0 def /j 0 def { + i dmtx length eq {exit} if + dmtx i get dup fnc1 eq { + pop barcode j (^FNC1) putinterval + /j j 4 add def + } { + barcode exch j exch put + } ifelse + /i i 1 add def + /j j 1 add def + } loop + /barcode barcode 0 j getinterval def - grestore + % Get the result of encoding with datamatrix + options (dontdraw) true put + options (parsefnc) true put + /args barcode options //datamatrix exec def + args (opt) options put + args + + dontdraw not //renmatrix if + end } bind def -/gs1-128composite dup load /uk.co.terryburton.bwipp defineresource pop +/gs1datamatrix dup load /uk.co.terryburton.bwipp defineresource pop end /setpacking where {pop setpacking} if %%EndData %%EndResource -% --END ENCODER gs1-128composite-- +% --END ENCODER gs1datamatrix-- -% --BEGIN ENCODER gs1datamatrix-- +% --BEGIN ENCODER gs1datamatrixrectangular-- % --REQUIRES preamble raiseerror renmatrix datamatrix-- -% --DESC: GS1 Data Matrix +% --DESC: GS1 Data Matrix Rectangular % --EXAM: (01)03453120000011(17)120508(10)ABCD1234(410)9501101020917 % --EXOP: % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp gs1datamatrix 0.0 2015050900 78248 77990 -%%BeginData: 134 ASCII Lines +%%BeginResource: uk.co.terryburton.bwipp gs1datamatrixrectangular 0.0 2016042100 78611 74838 +%%BeginData: 135 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict dup /raiseerror dup /uk.co.terryburton.bwipp findresource put dup /renmatrix dup /uk.co.terryburton.bwipp findresource put dup /datamatrix dup /uk.co.terryburton.bwipp findresource put begin -/gs1datamatrix { +/gs1datamatrixrectangular { 20 dict begin % Confine variables to local scope @@ -20518,9 +22115,10 @@ begin } loop /barcode barcode 0 j getinterval def - % Get the result of encoding with code128 + % Get the result of encoding with datamatrix options (dontdraw) true put options (parsefnc) true put + options (format) (rectangle) put /args barcode options //datamatrix exec def args (opt) options put @@ -20531,12 +22129,12 @@ begin end } bind def -/gs1datamatrix dup load /uk.co.terryburton.bwipp defineresource pop +/gs1datamatrixrectangular dup load /uk.co.terryburton.bwipp defineresource pop end /setpacking where {pop setpacking} if %%EndData %%EndResource -% --END ENCODER gs1datamatrix-- +% --END ENCODER gs1datamatrixrectangular-- % --BEGIN ENCODER gs1qrcode-- % --REQUIRES preamble raiseerror renmatrix qrcode-- @@ -20544,7 +22142,7 @@ end % --EXAM: (01)03453120000011(8200)http://www.abc.net(10)ABCD1234(410)9501101020917 % --EXOP: % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp gs1qrcode 0.0 2015050900 78280 77938 +%%BeginResource: uk.co.terryburton.bwipp gs1qrcode 0.0 2016042100 78192 78026 %%BeginData: 133 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -20689,7 +22287,7 @@ end % --EXAM: A123BJC5D6E71 % --EXOP: includetext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp hibccode39 0.0 2015050900 63169 62924 +%%BeginResource: uk.co.terryburton.bwipp hibccode39 0.0 2016042100 63169 62924 %%BeginData: 92 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -20793,7 +22391,7 @@ end % --EXAM: A123BJC5D6E71 % --EXOP: includetext % --RNDR: renlinear -%%BeginResource: uk.co.terryburton.bwipp hibccode128 0.0 2015050900 67220 66909 +%%BeginResource: uk.co.terryburton.bwipp hibccode128 0.0 2016042100 67484 66909 %%BeginData: 91 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -20896,7 +22494,7 @@ end % --EXAM: A123BJC5D6E71 % --EXOP: % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp hibcdatamatrix 0.0 2015050900 68711 64879 +%%BeginResource: uk.co.terryburton.bwipp hibcdatamatrix 0.0 2016042100 65207 64879 %%BeginData: 74 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -20976,13 +22574,100 @@ end %%EndResource % --END ENCODER hibcdatamatrix-- +% --BEGIN ENCODER hibcdatamatrixrectangular-- +% --REQUIRES preamble raiseerror renmatrix datamatrix-- +% --DESC: HIBC Data Matrix Rectangular +% --EXAM: A123BJC5D6E71 +% --EXOP: +% --RNDR: renmatrix +%%BeginResource: uk.co.terryburton.bwipp hibcdatamatrixrectangular 0.0 2016042100 65520 65071 +%%BeginData: 75 ASCII Lines +/setpacking where {pop currentpacking true setpacking} if +1 dict +dup /raiseerror dup /uk.co.terryburton.bwipp findresource put +dup /renmatrix dup /uk.co.terryburton.bwipp findresource put +dup /datamatrix dup /uk.co.terryburton.bwipp findresource put +begin +/hibcdatamatrixrectangular { + + 20 dict begin % Confine variables to local scope + + /options exch def % We are given an option string + /barcode exch def % We are given a barcode string + + /dontdraw false def + /validatecheck false def + + % Parse the input options + options type /stringtype eq { + 1 dict begin + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + currentdict end /options exch def + } if + options {def} forall + + % Create a string of the available characters + /barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%) def + /charvals 43 dict def + 0 1 42 {charvals exch dup barchars exch 1 getinterval exch put} for + + % Validate the input + 0 1 barcode length 1 sub { + barcode exch 1 getinterval charvals exch known not { + /bwipp.hibcdatamatrixrectangularBadCharacter (HIBC Data Matrix Rectangular must contain only digits, capital letters, spaces and the symbols -.$/+%) //raiseerror exec + } if + } for + + /barlen barcode length validatecheck {1 sub} if def + + /checksum 41 def + 0 1 barlen 1 sub { + barcode exch 1 getinterval charvals exch get + checksum add /checksum exch def + } for + /checksum checksum 43 mod def + validatecheck { + barcode barlen get barchars checksum get ne { + /bwipp.hibcdatamatrixrectangularBadCheckDigit (Incorrect HIBC Data Matrix Rectangular check digit provided) //raiseerror exec + } if + /barcode barcode 0 barlen getinterval def + } if + + /barcode barlen 2 add string dup 1 barcode putinterval def + barcode 0 43 put + barcode barlen 1 add barchars checksum get put + + % Get the result of encoding with datamatrix + options (dontdraw) true put + options (validatecheck) false put + options (format) (rectangle) put + /args barcode options //datamatrix exec def + + args (opt) options put + args + + dontdraw not //renmatrix if + + end + +} bind def +/hibcdatamatrixrectangular dup load /uk.co.terryburton.bwipp defineresource pop +end +/setpacking where {pop setpacking} if +%%EndData +%%EndResource +% --END ENCODER hibcdatamatrixrectangular-- + % --BEGIN ENCODER hibcpdf417-- % --REQUIRES preamble raiseerror renmatrix pdf417-- % --DESC: HIBC PDF417 % --EXAM: A123BJC5D6E71 % --EXOP: % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp hibcpdf417 0.0 2015050900 65468 65072 +%%BeginResource: uk.co.terryburton.bwipp hibcpdf417 0.0 2016042100 65468 65072 %%BeginData: 78 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -21072,7 +22757,7 @@ end % --EXAM: A123BJC5D6E71 % --EXOP: % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp hibcmicropdf417 0.0 2015050900 65606 65195 +%%BeginResource: uk.co.terryburton.bwipp hibcmicropdf417 0.0 2016042100 65606 65195 %%BeginData: 78 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -21162,7 +22847,7 @@ end % --EXAM: A123BJC5D6E71 % --EXOP: % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp hibcqrcode 0.0 2015050900 64983 68179 +%%BeginResource: uk.co.terryburton.bwipp hibcqrcode 0.0 2016042100 65071 68091 %%BeginData: 74 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -21248,7 +22933,7 @@ end % --EXAM: A123BJC5D6E71 % --EXOP: % --RNDR: renmatrix -%%BeginResource: uk.co.terryburton.bwipp hibccodablockf 0.0 2015050900 60823 64313 +%%BeginResource: uk.co.terryburton.bwipp hibccodablockf 0.0 2016042100 60823 64313 %%BeginData: 74 ASCII Lines /setpacking where {pop currentpacking true setpacking} if 1 dict @@ -21328,4 +23013,90 @@ end %%EndResource % --END ENCODER hibccodablockf-- +% --BEGIN ENCODER hibcazteccode-- +% --REQUIRES preamble raiseerror renmatrix azteccode-- +% --DESC: HIBC Aztec Code +% --EXAM: A123BJC5D6E71 +% --EXOP: +% --RNDR: renmatrix +%%BeginResource: uk.co.terryburton.bwipp hibcazteccode 0.0 2016042100 65179 68272 +%%BeginData: 74 ASCII Lines +/setpacking where {pop currentpacking true setpacking} if +1 dict +dup /raiseerror dup /uk.co.terryburton.bwipp findresource put +dup /renmatrix dup /uk.co.terryburton.bwipp findresource put +dup /azteccode dup /uk.co.terryburton.bwipp findresource put +begin +/hibcazteccode { + + 20 dict begin % Confine variables to local scope + + /options exch def % We are given an option string + /barcode exch def % We are given a barcode string + + /dontdraw false def + /validatecheck false def + + % Parse the input options + options type /stringtype eq { + 1 dict begin + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + currentdict end /options exch def + } if + options {def} forall + + % Create a string of the available characters + /barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%) def + /charvals 43 dict def + 0 1 42 {charvals exch dup barchars exch 1 getinterval exch put} for + + % Validate the input + 0 1 barcode length 1 sub { + barcode exch 1 getinterval charvals exch known not { + /bwipp.hibcazteccodeBadCharacter (HIBC Aztec Code must contain only digits, capital letters, spaces and the symbols -.$/+%) //raiseerror exec + } if + } for + + /barlen barcode length validatecheck {1 sub} if def + + /checksum 41 def + 0 1 barlen 1 sub { + barcode exch 1 getinterval charvals exch get + checksum add /checksum exch def + } for + /checksum checksum 43 mod def + validatecheck { + barcode barlen get barchars checksum get ne { + /bwipp.hibcazteccodeBadCheckDigit (Incorrect HIBC Aztec Code check digit provided) //raiseerror exec + } if + /barcode barcode 0 barlen getinterval def + } if + + /barcode barlen 2 add string dup 1 barcode putinterval def + barcode 0 43 put + barcode barlen 1 add barchars checksum get put + + % Get the result of encoding with azteccode + options (dontdraw) true put + options (validatecheck) false put + /args barcode options //azteccode exec def + + args (opt) options put + args + + dontdraw not //renmatrix if + + end + +} bind def +/hibcazteccode dup load /uk.co.terryburton.bwipp defineresource pop +end +/setpacking where {pop setpacking} if +%%EndData +%%EndResource +% --END ENCODER hibcazteccode-- + % --END TEMPLATE-- -- cgit v1.2.3