r18224 by jghali - #11467: Add QR Code Option to Barcode Plugin

scribus-commit scribus-commit at lists.scribus.net
Mon Mar 25 23:00:41 UTC 2013


Author: jghali
Date: Mon Mar 25 23:00:41 2013
New Revision: 18224

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18224
Log:
#11467: Add QR Code Option to Barcode Plugin

Modified:
    trunk/Scribus/scribus/plugins/barcodegenerator/barcode.cpp
    trunk/Scribus/scribus/plugins/barcodegenerator/barcode.ps
    trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp

Modified: trunk/Scribus/scribus/plugins/barcodegenerator/barcode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18224&path=/trunk/Scribus/scribus/plugins/barcodegenerator/barcode.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/barcodegenerator/barcode.cpp (original)
+++ trunk/Scribus/scribus/plugins/barcodegenerator/barcode.cpp Mon Mar 25 23:00:41 2013
@@ -38,9 +38,9 @@
 	about->authors = QString::fromUtf8("Terry Burton - <tez at terryburton.co.uk>, Petr Van\xc4\x9bk <petr at scribus.info>");
 	about->shortDescription = tr("Scribus frontend for Pure PostScript Barcode Writer");
 	about->description = "Barcode Writer in Pure PostScript is an award-winning open source barcode maker, as used by NASA, that facilitates the printing of all major barcode symbologies entirely within level 2 PostScript, ideal for variable data printing. The complete process of generating printed barcodes is performed entirely within the printer (or print system) so that it is no longer the responsibility of your application or a library. There is no need for any barcode fonts and the flexibility offered by direct PostScript means you can avoid re-implementing barcode generator code, or migrating to new libraries, whenever your project language needs change.\nhttp://www.terryburton.co.uk/barcodewriter/";
-	about->version = "Backend: 2006-01-17";
+	about->version = "Backend: 2013-02-27";
 	// about->releaseDate
-	about->copyright = QString::fromUtf8("Backend: Copyright (c) 2005 Terry Burton - tez at terryburton.co.uk\nFrontend: Copyright (c) 2005 Petr Van\xc4\x9bk - petr at scribus.info");
+	about->copyright = QString::fromUtf8("Backend: Copyright (c) 2004-2013 Terry Burton - tez at terryburton.co.uk\nFrontend: Copyright (c) 2005 Petr Van\xc4\x9bk - petr at scribus.info");
 	about->license = "Backend: MIT/X-Consortium, Frontend: GPL";
 	return about;
 }

Modified: trunk/Scribus/scribus/plugins/barcodegenerator/barcode.ps
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18224&path=/trunk/Scribus/scribus/plugins/barcodegenerator/barcode.ps
==============================================================================
--- trunk/Scribus/scribus/plugins/barcodegenerator/barcode.ps (original)
+++ trunk/Scribus/scribus/plugins/barcodegenerator/barcode.ps Mon Mar 25 23:00:41 2013
@@ -3,10 +3,12 @@
 %%DocumentPaperSizes: a4
 %%EndComments
 
-% Barcode Writer in Pure PostScript - Version 2011-01-15
+% Barcode Writer in Pure PostScript - Version 2013-02-27
 % http://www.terryburton.co.uk/barcodewriter/
 %
-% Copyright (c) 2004-2010 Terry Burton
+% Copyright (c) 2004-2013 Terry Burton
+%
+% $Id$
 %
 % Permission is hereby granted, free of charge, to any
 % person obtaining a copy of this software and associated
@@ -205,11 +207,11 @@
     textcolor (unset) ne { textcolor setanycolor } if
     includetext {
         textxalign (unset) eq textyalign (unset) eq and alttext () eq and {
-            /s 0 def /f () def
+            /s 0 def /fn () def
             txt {
                 {} forall
-                2 copy s ne exch f ne or {
-                    2 copy /s exch def /f exch def            
+                2 copy s ne exch fn ne or {
+                    2 copy /s exch def /fn exch def            
                     exch findfont exch scalefont setfont          
                 } {
                     pop pop
@@ -303,7 +305,7 @@
     % Default options
     /width 1 def
     /height 1 def
-    /color (unset) def
+    /barcolor (unset) def
     /backgroundcolor (unset) def
 
     % Apply the renderer options and the user options
@@ -312,24 +314,8 @@
 
     /width width cvr def
     /height height cvr def
-    /color color cvlit def
+    /barcolor barcolor cvlit def
     /backgroundcolor backgroundcolor cvlit def
-
-    % Extend bitmap horizontally to an 8-bit boundary
-    /pixx8 pixx 8 div ceiling cvi 8 mul def
-    /pixs8 [ pixx8 pixy mul {0} repeat ] def
-    0 1 pixy 1 sub {
-        /i exch def
-        pixs8 pixx8 i mul pixs pixx i mul pixx getinterval putinterval
-    } for
-    /pixs pixs8 def
-
-    % Convert bitmap into 8-bit sample string
-    /imgstr pixs length 8 idiv string def
-    0 1 pixs length 1 sub {
-        /i exch def
-        imgstr i 8 idiv 2 copy get 2 7 i 8 mod sub exp cvi pixs i get mul add put
-    } for
 
     % Set RGB or CMYK color depending on length of given hex string
     /setanycolor {
@@ -345,11 +331,25 @@
     % Draw the image
     gsave
     currentpoint translate
-    72 width mul 72 height mul scale
-    .0001 .0001 moveto .9999 .0001 lineto .9999 .9999 lineto .0001 .9999 lineto closepath
+    width pixx div 72 mul height pixy div 72 mul scale
+    0 0 moveto pixx 0 lineto pixx pixy lineto 0 pixy lineto closepath
     backgroundcolor (unset) ne { gsave backgroundcolor setanycolor fill grestore } if 
-    color (unset) ne { color setanycolor } if
-    pixx pixy true [ pixx 0 0 pixy neg 0 pixy ] {imgstr} imagemask
+    barcolor (unset) ne { barcolor setanycolor } if
+    /i 0 def
+    pixs {
+	/x i pixx mod def
+	/y pixy 1 sub i pixx idiv sub def
+	1 eq {
+	    newpath
+	    x y moveto
+	    1 0 rlineto
+	    0 1 rlineto
+	    -1 0 rlineto
+	    0 -1 rlineto
+	    closepath fill
+	} if
+	/i i 1 add def
+    } forall
     grestore
 
     end
@@ -666,7 +666,7 @@
 % --BEGIN ENCODER ean13--
 % --SUGGESTS ean5 ean2--
 % --DESC: EAN-13
-% --EXAM: 977147396801
+% --EXAM: 2071473968010
 % --EXOP: includetext guardwhitespace
 % --RNDR: renlinear
 /setpacking where {pop currentpacking true setpacking} if
@@ -686,9 +686,14 @@
     /includetext false def             % Enable/disable text
     /textfont /Helvetica def
     /textsize 12 def
+    /textxoffset -10 def
     /textyoffset -4 def
     /height 1 def
     /addongap 12 def
+    /addontextfont (unset) def
+    /addontextsize (unset) def
+    /addontextxoffset (unset) def
+    /addontextyoffset (unset) def
 
     % Parse the input options, either a string or a dict
     options type /stringtype eq {
@@ -703,9 +708,14 @@
 
     /textfont textfont cvlit def
     /textsize textsize cvr def
+    /textxoffset textxoffset cvr def
     /textyoffset textyoffset cvr def
     /height height cvr def
     /addongap addongap cvr def   
+    addontextfont (unset) ne {/addontextfont addontextfont cvlit def} if
+    addontextsize (unset) ne {/addontextsize addontextsize cvr def} if
+    addontextxoffset (unset) ne {/addontextxoffset addontextxoffset cvr def} if
+    addontextyoffset (unset) ne {/addontextyoffset addontextyoffset cvr def} if
 
     % Split off the addon
     barcode ( ) search {
@@ -758,7 +768,7 @@
 
     % First digit - determine mirrormap by this and show before guard bars
     /mirrormap mirrormaps barcode 0 get 48 sub get def
-    txt 0 [barcode 0 1 getinterval -10 textyoffset textfont textsize] put
+    txt 0 [barcode 0 1 getinterval textxoffset textyoffset textfont textsize] put
 
     % Left side - performs mirroring
     1 1 6 {
@@ -780,7 +790,7 @@
             /enc revenc def
         } if
         sbs i 1 sub 4 mul 3 add enc putinterval   % Put encoded digit into sbs
-        txt i [barcode i 1 getinterval i 1 sub 7 mul 4 add textyoffset textfont textsize] put
+        txt i [barcode i 1 getinterval i 1 sub 7 mul 14 add textxoffset add textyoffset textfont textsize] put
     } for
 
     % Put the middle character
@@ -796,7 +806,7 @@
         pop pop                        % Discard seek and post
         /enc encs indx get def         % Get the indxth encoding
         sbs i 1 sub 4 mul 8 add enc putinterval  % Put encoded digit into sbs
-        txt i [barcode i 1 getinterval i 1 sub 7 mul 8 add textyoffset textfont textsize] put
+        txt i [barcode i 1 getinterval i 1 sub 7 mul 18 add textxoffset add textyoffset textfont textsize] put
     } for
 
     % Put the end character
@@ -819,9 +829,10 @@
             /dontdraw true
             /includetext true
             /height height 0.15 sub
-            /textxoffset 95 addongap add
-            /textsize textsize
-            /textfont textfont
+            /textxoffset addontextxoffset (unset) ne {addontextxoffset} {95 addongap add} ifelse
+            addontextyoffset (unset) ne {/textyoffset addontextyoffset} if
+            /textsize addontextsize (unset) ne {addontextsize} {textsize} ifelse
+            /textfont addontextfont (unset) ne {addontextfont} {textfont} ifelse
         >> def
         addon length 2 eq {addon addopts //ean2 exec} if
         addon length 5 eq {addon addopts //ean5 exec} if
@@ -879,9 +890,14 @@
     /includetext false def              % Enable/disable text
     /textfont /Helvetica def
     /textsize 12 def
+    /textxoffset 4 def
     /textyoffset -4 def
     /height 1 def
     /addongap 12 def
+    /addontextfont (unset) def
+    /addontextsize (unset) def
+    /addontextxoffset (unset) def
+    /addontextyoffset (unset) def
     
     % Parse the input options, either a string or a dict
     options type /stringtype eq {
@@ -896,9 +912,14 @@
    
     /textfont textfont cvlit def
     /textsize textsize cvr def
+    /textxoffset textxoffset cvr def
     /textyoffset textyoffset cvr def
     /height height cvr def
-    /addongap addongap cvr def   
+    /addongap addongap cvr def
+    addontextfont (unset) ne {/addontextfont addontextfont cvlit def} if
+    addontextsize (unset) ne {/addontextsize addontextsize cvr def} if
+    addontextxoffset (unset) ne {/addontextxoffset addontextxoffset cvr def} if
+    addontextyoffset (unset) ne {/addontextyoffset addontextyoffset cvr def} if
 
     % Split off the addon
     barcode ( ) search {
@@ -953,7 +974,7 @@
         pop pop                            % Discard seek and post
         /enc encs indx get def             % Get the indxth encoding
         sbs i 4 mul 3 add enc putinterval  % Put encoded digit into sbs
-        txt i [barcode i 1 getinterval i 7 mul 4 add textyoffset textfont textsize] put
+        txt i [barcode i 1 getinterval i 7 mul textxoffset add textyoffset textfont textsize] put
     } for
 
     % Put the middle character
@@ -969,7 +990,7 @@
         pop pop                            % Discard seek and post
         /enc encs indx get def             % Get the indxth encoding
         sbs i 4 mul 8 add enc putinterval  % Put encoded digit into sbs
-        txt i [barcode i 1 getinterval i 7 mul 8 add textyoffset textfont textsize] put
+        txt i [barcode i 1 getinterval i 7 mul textxoffset add 4 add textyoffset textfont textsize] put
     } for
 
     % Put the end character
@@ -992,9 +1013,10 @@
             /dontdraw true
             /includetext true
             /height height 0.15 sub
-            /textxoffset 67 addongap add
-            /textsize textsize
-            /textfont textfont
+            /textxoffset addontextxoffset (unset) ne {addontextxoffset} {67 addongap add} ifelse
+            addontextyoffset (unset) ne {/textyoffset addontextyoffset} if
+            /textsize addontextsize (unset) ne {addontextsize} {textsize} ifelse
+            /textfont addontextfont (unset) ne {addontextfont} {textfont} ifelse
         >> def
         addon length 2 eq {addon addopts //ean2 exec} if
         addon length 5 eq {addon addopts //ean5 exec} if
@@ -1033,7 +1055,7 @@
 % --BEGIN ENCODER upca--
 % --SUGGESTS ean5 ean2--
 % --DESC: UPC-A
-% --EXAM: 78858101497
+% --EXAM: 488581014973
 % --EXOP: includetext
 % --RNDR: renlinear
 /setpacking where {pop currentpacking true setpacking} if
@@ -1053,9 +1075,14 @@
     /includetext false def         % Enable/disable text
     /textfont /Helvetica def
     /textsize 12 def
+    /textxoffset -7 def
     /textyoffset -4 def
     /height 1 def 
     /addongap 12 def
+    /addontextfont (unset) def
+    /addontextsize (unset) def
+    /addontextxoffset (unset) def
+    /addontextyoffset (unset) def
 
     % Parse the input options
     options type /stringtype eq {
@@ -1070,10 +1097,15 @@
 
     /textfont textfont cvlit def
     /textsize textsize cvr def
+    /textxoffset textxoffset cvr def
     /textyoffset textyoffset cvr def
     /height height cvr def
     /addongap addongap cvr def
-   
+    addontextfont (unset) ne {/addontextfont addontextfont cvlit def} if
+    addontextsize (unset) ne {/addontextsize addontextsize cvr def} if
+    addontextxoffset (unset) ne {/addontextxoffset addontextxoffset cvr def} if
+    addontextyoffset (unset) ne {/addontextyoffset addontextyoffset cvr def} if
+
     % Split off the addon
     barcode ( ) search {
         /barcode exch def
@@ -1128,9 +1160,9 @@
         /enc encs indx get def             % Get the indxth encoding
         sbs i 4 mul 3 add enc putinterval  % Put encoded digit into sbs
         i 0 eq {      % First digit is before the guard bars
-            txt 0 [barcode 0 1 getinterval -7 textyoffset textfont textsize 2 sub] put
+            txt 0 [barcode 0 1 getinterval textxoffset textyoffset textfont textsize 2 sub] put
         } {
-            txt i [barcode i 1 getinterval i 7 mul 4 add textyoffset textfont textsize] put
+            txt i [barcode i 1 getinterval i 7 mul 11 add textxoffset add textyoffset textfont textsize] put
         } ifelse
     } for
 
@@ -1148,9 +1180,9 @@
         /enc encs indx get def             % Get the indxth encoding
         sbs i 4 mul 8 add enc putinterval  % Put encoded digit into sbs
         i 11 eq {       % Last digit is after guard bars
-            txt 11 [barcode 11 1 getinterval 96 textyoffset textfont textsize 2 sub] put
+            txt 11 [barcode 11 1 getinterval textxoffset 103 add textyoffset textfont textsize 2 sub] put
         } {
-            txt i [barcode i 1 getinterval i 7 mul 8 add textyoffset textfont textsize] put
+            txt i [barcode i 1 getinterval i 7 mul textxoffset add 15 add textyoffset textfont textsize] put
         } ifelse
     } for
 
@@ -1174,9 +1206,10 @@
             /dontdraw true
             /includetext true
             /height height 0.15 sub
-            /textxoffset 95 addongap add
-            /textsize textsize
-            /textfont textfont
+            /textxoffset addontextxoffset (unset) ne {addontextxoffset} {95 addongap add} ifelse
+            addontextyoffset (unset) ne {/textyoffset addontextyoffset} if
+            /textsize addontextsize (unset) ne {addontextsize} {textsize} ifelse
+            /textfont addontextfont (unset) ne {addontextfont} {textfont} ifelse
         >> def
         addon length 2 eq {addon addopts //ean2 exec} if
         addon length 5 eq {addon addopts //ean5 exec} if
@@ -1214,7 +1247,7 @@
 % --BEGIN ENCODER upce--
 % --SUGGESTS ean5 ean2--
 % --DESC: UPC-E
-% --EXAM: 0123456
+% --EXAM: 00123457
 % --EXOP: includetext height=0.4
 % --RNDR: renlinear
 /setpacking where {pop currentpacking true setpacking} if
@@ -1234,9 +1267,14 @@
     /includetext false def               % Enable/disable text
     /textfont /Helvetica def
     /textsize 12 def
+    /textxoffset -7 def
     /textyoffset -4 def
     /height 1 def
-    /addongap 12 def   
+    /addongap 12 def
+    /addontextfont (unset) def
+    /addontextsize (unset) def
+    /addontextxoffset (unset) def
+    /addontextyoffset (unset) def
  
     % Parse the input options
     options type /stringtype eq {
@@ -1251,9 +1289,14 @@
  
     /textfont textfont cvlit def
     /textsize textsize cvr def
+    /textxoffset textxoffset cvr def
     /textyoffset textyoffset cvr def
     /height height cvr def
-    /addongap addongap cvr def    
+    /addongap addongap cvr def
+    addontextfont (unset) ne {/addontextfont addontextfont cvlit def} if
+    addontextsize (unset) ne {/addontextsize addontextsize cvr def} if
+    addontextxoffset (unset) ne {/addontextxoffset addontextxoffset cvr def} if
+    addontextyoffset (unset) ne {/addontextyoffset addontextyoffset cvr def} if
 
     % Ensure 0 or 1 number systems
     barcode 0 get dup 48 ne exch 49 ne and {
@@ -1321,7 +1364,7 @@
     pad 7 checksum 48 add put       % Put ascii for checksum at end of pad
     /barcode pad def
     /txt 8 array def
-    txt 0 [barcode 0 1 getinterval -7 textyoffset textfont textsize 2 sub] put
+    txt 0 [barcode 0 1 getinterval textxoffset textyoffset textfont textsize 2 sub] put
 
     % Determine the mirror map based on checksum
     /mirrormap mirrormaps checksum get def
@@ -1364,10 +1407,10 @@
             /enc revenc def
         } if
         sbs i 1 sub 4 mul 3 add enc putinterval   % Put encoded digit into sbs
-        txt i [barcode i 1 getinterval i 1 sub 7 mul 4 add textyoffset textfont textsize] put
+        txt i [barcode i 1 getinterval i 1 sub 7 mul 11 add textxoffset add textyoffset textfont textsize] put
     } for
 
-    txt 7 [barcode 7 1 getinterval 6 7 mul 11 add textyoffset textfont textsize 2 sub] put
+    txt 7 [barcode 7 1 getinterval 6 7 mul 18 add textxoffset add textyoffset textfont textsize 2 sub] put
 
     % Put the end character
     sbs 27 encs 11 get putinterval
@@ -1389,9 +1432,10 @@
             /dontdraw true
             /includetext true
             /height height 0.15 sub
-            /textxoffset 51 addongap add
-            /textsize textsize
-            /textfont textfont
+            /textxoffset addontextxoffset (unset) ne {addontextxoffset} {51 addongap add} ifelse
+            addontextyoffset (unset) ne {/textyoffset addontextyoffset} if
+            /textsize addontextsize (unset) ne {addontextsize} {textsize} ifelse
+            /textfont addontextfont (unset) ne {addontextfont} {textfont} ifelse
         >> def
         addon length 2 eq {addon addopts //ean2 exec} if
         addon length 5 eq {addon addopts //ean5 exec} if
@@ -1447,9 +1491,10 @@
 
     /dontdraw false def
     /includetext false def  % Enable/disable ISBN text
-    /isbnfont /Courier def
-    /isbnsize 9 def
-    /isbnpos (unset) def
+    /isbntextfont /Courier def
+    /isbntextsize 9 def
+    /isbntextxoffset (unset) def
+    /isbntextyoffset (unset) def
     /height 1 def
     /addongap 12 def   
     /legacy false def
@@ -1465,15 +1510,12 @@
     } if
     options {def} forall
     
-    /isbnfont isbnfont cvlit def
-    /isbnsize isbnsize cvr def
+    /isbntextfont isbntextfont cvlit def
+    /isbntextsize isbntextsize cvr def
+    isbntextxoffset (unset) ne {/isbntextxoffset isbntextxoffset cvr def} if
+    isbntextyoffset (unset) ne {/isbntextyoffset isbntextyoffset cvr def} if
     /height height cvr def
     /addongap addongap cvr def
-    isbnpos (unset) eq {
-        /isbnpos height 72 mul 3 add def
-    } {
-        /isbnpos isbnpos cvr def
-    } ifelse
 
     % Split off the addon
     isbntxt ( ) search {
@@ -1565,19 +1607,20 @@
 
     % Add the ISBN text
     includetext {
-        isbn length 9 eq {
-            /isbnxpos -1 def
-        } {
-            /isbnxpos -12 def
-        } ifelse
+        isbntextxoffset (unset) eq {
+            /isbntextxoffset isbn length 9 eq {-1} {-12} ifelse def
+        } if
+        isbntextyoffset (unset) eq {
+            /isbntextyoffset height 72 mul 3 add def
+        } if
         args (txt) known {
             /txt args (txt) get def
             /newtxt txt length 1 add array def
             newtxt 0 txt putinterval
-            newtxt newtxt length 1 sub [isbntxt isbnxpos isbnpos isbnfont isbnsize] put
+            newtxt newtxt length 1 sub [isbntxt isbntextxoffset isbntextyoffset isbntextfont isbntextsize] put
             args (txt) newtxt put
         } {
-            args (txt) [ [isbntxt isbnxpos isbnpos isbnfont isbnsize] ] put
+            args (txt) [ [isbntxt isbntextxoffset isbntextyoffset isbntextfont isbntextsize] ] put
         } ifelse
     } if
 
@@ -1615,9 +1658,10 @@
 
     /dontdraw false def
     /includetext false def  % Enable/disable ISMN text
-    /ismnfont /Courier def
-    /ismnsize 9 def
-    /ismnpos (unset) def
+    /ismntextfont /Courier def
+    /ismntextsize 9 def
+    /ismntextxoffset (unset) def
+    /ismntextyoffset (unset) def
     /height 1 def
     /addongap 12 def   
     /legacy false def
@@ -1633,15 +1677,12 @@
     } if
     options {def} forall
     
-    /ismnfont ismnfont cvlit def
-    /ismnsize ismnsize cvr def
+    /ismntextfont ismntextfont cvlit def
+    /ismntextsize ismntextsize cvr def
+    ismntextxoffset (unset) ne {/ismntextxoffset ismntextxoffset cvr def} if
+    ismntextyoffset (unset) ne {/ismntextyoffset ismntextyoffset cvr def} if
     /height height cvr def
     /addongap addongap cvr def
-    ismnpos (unset) eq {
-        /ismnpos height 72 mul 3 add def
-    } {
-        /ismnpos ismnpos cvr def
-    } ifelse
    
     % Split off the addon
     ismntxt ( ) search {
@@ -1719,19 +1760,20 @@
 
     % Add the ISMN text
     includetext {
-        ismntxt length 18 eq {
-            /ismnxpos -1 def
-        } {
-            /ismnxpos -12 def
-        } ifelse
+        ismntextxoffset (unset) eq {
+            /ismntextxoffset ismntxt length 18 eq {-1} {-12} ifelse def
+        } if
+        ismntextyoffset (unset) eq {
+            /ismntextyoffset height 72 mul 3 add def
+        } if
         args (txt) known {
             /txt args (txt) get def
             /newtxt txt length 1 add array def
             newtxt 0 txt putinterval
-            newtxt newtxt length 1 sub [ismntxt ismnxpos ismnpos ismnfont ismnsize] put
+            newtxt newtxt length 1 sub [ismntxt ismntextxoffset ismntextyoffset ismntextfont ismntextsize] put
             args (txt) newtxt put
         } {
-            args (txt) [ [ismntxt ismnxpos ismnpos ismnfont ismnsize] ] put
+            args (txt) [ [ismntxt ismntextxoffset ismntextyoffset ismntextfont ismntextsize] ] put
         } ifelse
     } if
 
@@ -1769,9 +1811,10 @@
 
     /dontdraw false def
     /includetext false def  % Enable/disable ISSN text
-    /issnfont /Courier def
-    /issnsize 9 def
-    /issnpos (unset) def
+    /issntextfont /Courier def
+    /issntextsize 9 def
+    /issntextxoffset (unset) def
+    /issntextyoffset (unset) def
     /height 1 def
     /addongap 12 def   
 
@@ -1786,15 +1829,12 @@
     } if
     options {def} forall
     
-    /issnfont issnfont cvlit def
-    /issnsize issnsize cvr def
+    /issntextfont issntextfont cvlit def
+    /issntextsize issntextsize cvr def
+    issntextxoffset (unset) ne {/issntextxoffset issntextxoffset cvr def} if
+    issntextyoffset (unset) ne {/issntextyoffset issntextyoffset cvr def} if
     /height height cvr def
     /addongap addongap cvr def
-    issnpos (unset) eq {
-        /issnpos height 72 mul 3 add def
-    } {
-        /issnpos issnpos cvr def
-    } ifelse
    
     % Split off the ISSN
     issntxt ( ) search {
@@ -1803,11 +1843,11 @@
         /seqvar exch def
     } if
 
-    % Split off the sequence variant and 2 digit addon
+    % Split off the sequence variant and addon
     seqvar ( ) search {
         /seqvar exch def
         pop
-        2 string dup exch 0 4 -1 roll putinterval /addon exch def
+        /addon exch def
     } {
         pop
         /addon () def
@@ -1865,15 +1905,18 @@
 
     % Add the ISSN text
     includetext {
-        /issnxpos 10 def
+        issntextxoffset (unset) eq {/issntextxoffset 10 def} if
+        issntextyoffset (unset) eq {
+            /issntextyoffset height 72 mul 3 add def
+        } if
         args (txt) known {
             /txt args (txt) get def
             /newtxt txt length 1 add array def
             newtxt 0 txt putinterval
-            newtxt newtxt length 1 sub [issntxt issnxpos issnpos issnfont issnsize] put
+            newtxt newtxt length 1 sub [issntxt issntextxoffset issntextyoffset issntextfont issntextsize] put
             args (txt) newtxt put
         } {
-            args (txt) [ [issntxt issnxpos issnpos issnfont issnsize] ] put
+            args (txt) [ [issntxt issntextxoffset issntextyoffset issntextfont issntextsize] ] put
         } ifelse
     } if
 
@@ -2084,8 +2127,8 @@
                 p msglen ge {exit} if
                 msg p get
                 dup setc exch known not {pop exit} if
-                dup 48 lt exch 57 gt or {
-                    % Non-digit in odd position of run like two digits
+                fn1 eq {
+                    % FNC1 in odd position of run like two digits
                     s 2 mod 0 eq {/s s 1 add def} {exit} ifelse
                 } if
                 /n n 1 add def
@@ -2106,31 +2149,41 @@
         } bind def
         /encc {
             dup type /arraytype ne {
-                setc exch get cws exch j exch put
-                /j j 1 add def
+                setc exch get
             } {
-                /in exch def
-                /k 0 def {
-                    k in length eq {exit} if
-                    in k get dup 48 lt exch 57 gt or {
-                        setc in k get get
-                        /k k 1 add def
-                    } {
-                        in k get 48 sub 10 mul in k 1 add get 48 sub add
-                        /k k 2 add def
-                    } ifelse
-                    cws exch j exch put
-                    /j j 1 add def
-                } loop
+                aload pop 48 sub exch 48 sub 10 mul add
             } ifelse
+            cws exch j exch put
+            /j j 1 add def
         } bind def
 
         % Character exclusively in either alphabet A or B
         /anotb {dup seta exch known exch setb exch known not and} bind def
         /bnota {dup setb exch known exch seta exch known not and} bind def
+
+        % Pre-compute relative position of next anotb and next bnota characters
+        /nextanotb [ msg length {0} repeat 9999 ] def
+        /nextbnota [ msg length {0} repeat 9999 ] def
+        msg length 1 sub -1 0 {
+            /i exch def
+            msg i get anotb {
+                nextanotb i 0 put
+            } {
+                nextanotb i nextanotb i 1 add get 1 add put
+            } ifelse
+            msg i get bnota {
+                nextbnota i 0 put
+            } {
+                nextbnota i nextbnota i 1 add get 1 add put
+            } ifelse
+        } for
+
+        % Does a-only come before b-only after given position and vice versa
+        /abeforeb {dup nextanotb exch get exch nextbnota exch get lt} bind def
+        /bbeforea {dup nextbnota exch get exch nextanotb exch get lt} bind def
         
         /cws barcode length 2 mul 3 add array def
-        
+
         % Select start character
         /j 0 def
         msglen 0 gt {0 numsscr} {-1 -1} ifelse /nums exch def /nchars exch def
@@ -2150,59 +2203,41 @@
                 /cset (setc) def
                 exit
             } if
-            nchars msglen lt {
-                msg nchars get anotb {
-                    sta enca
-                    /cset (seta) def
-                    exit
-                } if
-            } if
+            0 abeforeb { 
+                sta enca
+                /cset (seta) def
+                exit 
+            } if 
             stb enca
             /cset (setb) def
             exit
         } loop
-        
-        % Special handling of data starting in set C
-        /i 0 def
-        cset (setc) eq {
-            nums 2 mod 1 eq {
-                nchars msglen eq {
-                    msg 0 nchars 1 sub getinterval encc
-                    swb encc
-                    msg nchars 1 sub get encb
-                    /cset (setb) def
-                } {
-                    msg nchars get anotb {
-                        msg 0 nchars 1 sub getinterval encc
-                        swa encc
-                        msg nchars 1 sub get enca
-                        /cset (seta) def
-                    } {
-                        msg 0 nchars 1 sub getinterval encc
-                        swb encc
-                        msg nchars 1 sub get encb
-                        /cset (setb) def
-                    } ifelse
-                } ifelse
-                /i nchars def
-            } if
-        } if
-        
-        {  % Main encoding loop
+
+        % Main encoding loop
+        /i 0 def {  
             i msglen eq {exit} if
         
             i numsscr /nums exch def /nchars exch def
         
             % Determine switches and shifts
             {  % common exit
-                cset (seta) eq cset (setb) eq or nums 4 ge and {
-                    swc cset (seta) eq {enca} {encb} ifelse
-                    /cset (setc) def
-                    exit
+                cset (seta) eq cset (setb) eq or nums 4 ge and 
+                msg i get fn1 ne and {
+                    nums 2 mod 0 eq {
+                        swc cset (seta) eq {enca} {encb} ifelse
+                        /cset (setc) def
+                        exit
+                    } {
+                        msg i get cset (seta) eq {enca} {encb} ifelse
+                        /i i 1 add def
+                        swc cset (seta) eq {enca} {encb} ifelse
+                        /cset (setc) def
+                        exit
+                    } ifelse
                 } if
-                cset (setb) eq msg i get anotb and {
+                cset (setb) eq msg i get anotb and { 
                     i msglen 1 sub lt {
-                        msg i 1 add get bnota {
+                        i 1 add bbeforea { 
                             sft encb
                             msg i get enca
                             /i i 1 add def
@@ -2215,7 +2250,7 @@
                 } if
                 cset (seta) eq msg i get bnota and {
                     i msglen 1 sub lt {
-                        msg i 1 add get anotb {
+                        i 1 add abeforeb {
                             sft enca
                             msg i get encb
                             /i i 1 add def
@@ -2227,13 +2262,13 @@
                     exit
                 } if
                 cset (setc) eq nums 2 lt and {
-                    msg i get anotb {
+                    i abeforeb {
                         swa encc
                         /cset (seta) def
-                    } {
-                        swb encc
-                        /cset (setb) def
-                    } ifelse
+                        exit
+                    } if
+                    swb encc
+                    /cset (setb) def
                     exit
                 } if
         
@@ -2241,19 +2276,22 @@
                 cset (seta) eq {
                     msg i get enca
                     /i i 1 add def
+                    exit
                 } if
                 cset (setb) eq {
                     msg i get encb
                     /i i 1 add def
+                    exit
                 } if
                 cset (setc) eq {
-                    nums 2 mod 0 eq {
-                        msg i nchars getinterval encc
-                        /i i nchars add def
-                    } { 
-                        msg i nchars 1 sub getinterval encc
-                        /i i nchars 1 sub add def
+                    msg i get fn1 eq {
+                        fn1 encc
+                        /i i 1 add def
+                    } {
+                        msg i 2 getinterval encc
+                        /i i 2 add def 
                     } ifelse
+                    exit
                 } if
          
                 exit
@@ -2262,7 +2300,7 @@
         } loop
         /cws cws 0 j getinterval def
     } if  % auto encoding
- 
+
     % Derive checksum and place stop character
     /cws j 2 add array dup 0 cws putinterval def
     /csum cws 0 get def
@@ -2346,7 +2384,7 @@
     /textsize 10 def
     /textxoffset 0 def
     /textyoffset -7 def
-    /height 1 def
+    /height 0.5 def
     /linkagea false def
     /linkagec false def
  
@@ -2466,6 +2504,7 @@
     /barcode barcode 0 j getinterval def
 
     % Get the result of encoding with code128
+    options (height) height put
     options (dontdraw) true put
     options (parsefnc) true put
     /args barcode options //code128 exec def
@@ -3015,6 +3054,7 @@
     /textyoffset -7 def
     /textxoffset 0 def
     /height 1 def
+    /pzn8 false def
  
     % Parse the input options
     options type /stringtype eq {
@@ -3032,28 +3072,26 @@
     /textyoffset textyoffset cvr def
     /textxoffset textxoffset cvr def
     /height height cvr def
- 
-    /text 13 string def
-    text 0 barcode 0 6 getinterval putinterval
+
+    /msg pzn8 {9} {8} ifelse string def
+    /msglen msg length def
+    msg 0 45 put 
+    msg 1 barcode 0 msglen 2 sub getinterval putinterval
  
     % calculate check digit
-    text 6 0
-    0 1 5 {
-        dup text exch get 48 sub exch 2 add mul add
-    } for
-    11 mod 48 add put
- 
-    /barcode 8 string def
-    barcode 1 text 0 7 getinterval putinterval
-    barcode 0 45 put
+    0 
+    1 1 msglen 2 sub {dup msg exch get 48 sub exch pzn8 not {1 add} if mul add} for
+    11 mod 48 add
+    msg exch msglen 1 sub exch put
  
     % Get the result of encoding with code39
     options (dontdraw) true put
-    /args barcode options //code39 exec def
+    /args msg options //code39 exec def
  
     % format HRI
-    text 6 text 0 7 getinterval putinterval
+    /text msglen 5 add string def
     text 0 (PZN - ) putinterval
+    text 6 msg 1 msglen 1 sub getinterval putinterval
  
     args (txt) [ [text textxoffset textyoffset textfont textsize] ] put
     args (textxalign) (center) put
@@ -4112,7 +4150,9 @@
                 } ifelse
                 sep3 exch i exch put
             } for
-            checksum 9 mod 3 eq {  % Right shifted module for value 3 finder
+            /f3 [1 1 1 1 1 1 1 1 1 0 1 1 1] def
+            true 0 1 12 {dup bot exch 19 add get exch f3 exch get eq and} for {
+                % Right shifted module for value 3 finder
                 sep3 19 [ 0 0 0 0 0 0 0 0 0 0 1 0 0 ] putinterval
             } if
             /pixs [
@@ -4601,7 +4641,7 @@
     /segments segments cvi def
 
     segments -1 eq {
-        /segments format (expandedstacked) eq {2} {22} ifelse def
+        /segments format (expandedstacked) eq {4} {22} ifelse def
     } if
 
     % Expand ordinals of the form ^NNN to ASCII
@@ -4832,7 +4872,7 @@
     } {
         /vlf [] def
     } ifelse
-    
+
     % 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
@@ -4908,7 +4948,7 @@
             /gpf exch def
         } if
     } for
-    
+
     % Calculate the number of bits remaining to the next valid symbol size
     /rembits {
         dup
@@ -5002,6 +5042,7 @@
             mode (alphanumeric) eq {
                 gpf i get fnc1 eq {
                     fnc1 alphanumeric encode
+                    /mode (numeric) def
                     /i i 1 add def
                     exit
                 } if
@@ -5028,6 +5069,7 @@
             mode (iso646) eq {
                 gpf i get fnc1 eq {
                     fnc1 iso646 encode
+                    /mode (numeric) def
                     /i i 1 add def
                     exit
                 } if
@@ -5049,7 +5091,7 @@
         } loop
     } loop
     /gpf gpfenc 0 j getinterval def
-   
+
     % Complete the variable length field and create pad
     1 12 add method length add vlf length add cdf length add gpf length add 
     dup rembits dup array /pad exch def
@@ -6219,7 +6261,7 @@
 % --END ENCODER rationalizedCodabar--
 
 % --BEGIN ENCODER onecode--
-% --DESC: United States Postal Service OneCode
+% --DESC: United States Postal Service Intelligent Mail
 % --EXAM: 0123456709498765432101234567891
 % --EXOP: barcolor=FF0000
 % --RNDR: renlinear
@@ -7762,8 +7804,8 @@
 
 % --BEGIN ENCODER telepen--
 % --DESC: Telepen
-% --EXAM: Telepen
-% --EXOP: includetext
+% --EXAM: 123456
+% --EXOP: numeric includetext
 % --RNDR: renlinear
 /setpacking where {pop currentpacking true setpacking} if
 1 dict
@@ -8334,6 +8376,2322 @@
 /setpacking where {pop setpacking} if
 % --END ENCODER posicode--
 
+% --BEGIN ENCODER codablockf--
+% --DESC: Codablock F
+% --EXAM: CODABLOCK F 34567890123456789010040digit
+% --EXOP: columns=8
+% --RNDR: renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/codablockf {
+
+    20 dict begin
+
+    /options exch def
+    /barcode exch def
+
+    /dontdraw false def
+    /rows -1 def
+    /columns 8 def
+    /rowheight 10 def
+    /sepheight 1 def
+    /encoding (auto) def
+    /parse false def
+    /parsefnc 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
+
+    /rows rows cvi def
+    /columns columns cvi def
+    /rowheight rowheight cvi def
+    /sepheight sepheight cvi def
+
+    columns 4 ge columns 62 le and 
+    rows 2 ge rows 44 le and rows -1 eq or and {/c columns def} if
+
+    % 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 
+    /swa -1 def  /swb -2 def  /swc -3 def  /sft -4 def
+    /fn1 -5 def  /fn2 -6 def  /fn3 -7 def  /fn4 -8 def
+    /sta -9 def  /stp -10 def
+
+    % Character maps for each state
+    /charmaps [
+      %  A    B    C         A    B    C         A    B    C
+      [  32   32  (00) ]  [ (!)  (!)  (01) ]  [ (")  (")  (02) ]  % 0-2 
+      [ (#)  (#)  (03) ]  [ ($)  ($)  (04) ]  [ (%)  (%)  (05) ]  % 3-5
+      [ (&)  (&)  (06) ]  [ (')  (')  (07) ]  [  40   40  (08) ]  % 6-8
+      [  41   41  (09) ]  [ (*)  (*)  (10) ]  [ (+)  (+)  (11) ]  % 9-11
+      [ (,)  (,)  (12) ]  [ (-)  (-)  (13) ]  [ (.)  (.)  (14) ]  % 12-14
+      [ (/)  (/)  (15) ]  [ (0)  (0)  (16) ]  [ (1)  (1)  (17) ]  % 15-17
+      [ (2)  (2)  (18) ]  [ (3)  (3)  (19) ]  [ (4)  (4)  (20) ]  % 18-20
+      [ (5)  (5)  (21) ]  [ (6)  (6)  (22) ]  [ (7)  (7)  (23) ]  % 21-23
+      [ (8)  (8)  (24) ]  [ (9)  (9)  (25) ]  [ (:)  (:)  (26) ]  % 24-26
+      [ (;)  (;)  (27) ]  [ (<)  (<)  (28) ]  [ (=)  (=)  (29) ]  % 27-29
+      [ (>)  (>)  (30) ]  [ (?)  (?)  (31) ]  [ (@)  (@)  (32) ]  % 30-32
+      [ (A)  (A)  (33) ]  [ (B)  (B)  (34) ]  [ (C)  (C)  (35) ]  % 33-35
+      [ (D)  (D)  (36) ]  [ (E)  (E)  (37) ]  [ (F)  (F)  (38) ]  % 36-38
+      [ (G)  (G)  (39) ]  [ (H)  (H)  (40) ]  [ (I)  (I)  (41) ]  % 39-41
+      [ (J)  (J)  (42) ]  [ (K)  (K)  (43) ]  [ (L)  (L)  (44) ]  % 42-44
+      [ (M)  (M)  (45) ]  [ (N)  (N)  (46) ]  [ (O)  (O)  (47) ]  % 45-47
+      [ (P)  (P)  (48) ]  [ (Q)  (Q)  (49) ]  [ (R)  (R)  (50) ]  % 48-50
+      [ (S)  (S)  (51) ]  [ (T)  (T)  (52) ]  [ (U)  (U)  (53) ]  % 51-53
+      [ (V)  (V)  (54) ]  [ (W)  (W)  (55) ]  [ (X)  (X)  (56) ]  % 54-56
+      [ (Y)  (Y)  (57) ]  [ (Z)  (Z)  (58) ]  [ ([)  ([)  (59) ]  % 57-59
+      [  92   92  (60) ]  [ (])  (])  (61) ]  [ (^)  (^)  (62) ]  % 60-62
+      [ (_)  (_)  (63) ]  [   0  (`)  (64) ]  [   1  (a)  (65) ]  % 63-65
+      [   2  (b)  (66) ]  [   3  (c)  (67) ]  [   4  (d)  (68) ]  % 66-68
+      [   5  (e)  (69) ]  [   6  (f)  (70) ]  [   7  (g)  (71) ]  % 69-71
+      [   8  (h)  (72) ]  [   9  (i)  (73) ]  [  10  (j)  (74) ]  % 72-74
+      [  11  (k)  (75) ]  [  12  (l)  (76) ]  [  13  (m)  (77) ]  % 75-77
+      [  14  (n)  (78) ]  [  15  (o)  (79) ]  [  16  (p)  (80) ]  % 78-80
+      [  17  (q)  (81) ]  [  18  (r)  (82) ]  [  19  (s)  (83) ]  % 81-83
+      [  20  (t)  (84) ]  [  21  (u)  (85) ]  [  22  (v)  (86) ]  % 84-86
+      [  23  (w)  (87) ]  [  24  (x)  (88) ]  [  25  (y)  (89) ]  % 87-89
+      [  26  (z)  (90) ]  [  27  ({)  (91) ]  [  28  (|)  (92) ]  % 90-92
+      [  29  (})  (93) ]  [  30  (~)  (94) ]  [  31  127  (95) ]  % 93-95
+      [ fn3  fn3  (96) ]  [ fn2  fn2  (97) ]  [ sft  sft  (98) ]  % 96-98
+      [ swc  swc  (99) ]  [ swb  fn4  swb  ]  [ fn4  swa  swa  ]  % 99-101
+      [ fn1  fn1  fn1  ]  [ sta  sta  sta  ]  [ stp  stp  stp  ]  % 102-104
+    ] def
+    
+    % Invert charmaps to give character to value maps for each state
+    /charvals [ 105 dict 105 dict 105 dict ] def
+    0 1 charmaps length 1 sub {
+        /i exch def
+        /encs charmaps i get def
+        0 1 2 {
+            /j exch def
+            encs j get dup type /stringtype eq {0 get} if  % convert string to ASCII if required
+            charvals j get exch i put 
+        } for
+    } for
+    /seta charvals 0 get def
+    /setb charvals 1 get def
+    /setc charvals 2 get def
+    
+    /fncvals <<
+        (FNC1) fn1
+        (FNC2) fn2
+        (FNC3) fn3
+        (FNC4) fn4
+    >> 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
+
+    % Determine digit runlength and characters from given position
+    /numsscr {
+        /n 0 def /s 0 def
+        /p exch def {
+            p msglen ge {exit} if
+            msg p get
+            dup setc exch known not {pop exit} if
+            fn1 eq {
+                % FNC1 in odd position of run like two digits
+                s 2 mod 0 eq {/s s 1 add def} {exit} ifelse
+            } if
+            /n n 1 add def
+            /s s 1 add def
+            /p p 1 add def
+        } loop
+        n s
+    } bind def
+
+    % Encoding for each alphabet
+    /enca {
+        seta exch get cws exch j exch put
+        /j j 1 add def
+    } bind def
+    /encb {
+        setb exch get cws exch j exch put
+        /j j 1 add def
+    } bind def
+    /encc {
+        dup type /arraytype ne {
+            setc exch get
+        } {
+            aload pop 48 sub exch 48 sub 10 mul add
+        } ifelse
+        cws exch j exch put
+        /j j 1 add def
+    } bind def
+
+    % Character exclusively in either alphabet A or B
+    /anotb {dup seta exch known exch setb exch known not and} bind def
+    /bnota {dup setb exch known exch seta exch known not and} bind def
+
+    % Pre-compute relative position of next anotb and next bnota characters
+    /nextanotb [ msg length {0} repeat 9999 ] def
+    /nextbnota [ msg length {0} repeat 9999 ] def
+    msg length 1 sub -1 0 {
+        /i exch def
+        msg i get anotb {
+            nextanotb i 0 put
+        } {
+            nextanotb i nextanotb i 1 add get 1 add put
+        } ifelse
+        msg i get bnota {
+            nextbnota i 0 put
+        } {
+            nextbnota i nextbnota i 1 add get 1 add put
+        } ifelse
+    } for
+
+    % Does a-only come before b-only after given position and vice versa
+    /abeforeb {dup nextanotb exch get exch nextbnota exch get lt} bind def
+    /bbeforea {dup nextbnota exch get exch nextanotb exch get lt} bind def
+
+    % Add padding to row
+    /padrow {
+        {
+           {  % common exit
+               cset (seta) eq {swc enca /cset (setc) def exit} if
+               cset (setb) eq {swc encb /cset (setc) def exit} if
+               cset (setc) eq {swb encc /cset (setb) def exit} if
+           } loop
+        } repeat
+    } bind def
+
+    % Convert message to codewords
+    /cws c 5 add rows -1 ne {rows} {44} ifelse mul array def
+
+    /i 0 def /j 0 def /r 1 def
+    /lastrow false def {
+        
+        lastrow {exit} if
+
+        % Add start character and code subset selector
+        sta enca
+        i msglen lt {i numsscr} {-1 -1} ifelse /nums exch def /nchars exch def
+        {  % common exit
+            msglen 0 eq {
+                swb enca
+                /cset (setb) def
+                exit
+            } if
+            nums 2 ge {
+                swc enca
+                /cset (setc) def
+                exit
+            } if
+            i abeforeb { 
+                sft enca
+                /cset (seta) def
+                exit 
+            } if 
+            swb enca
+            /cset (setb) def
+            exit
+        } loop
+        /j j 1 add def  % Skip row indicator position
+
+        % Main encoding loop
+        /endofrow false def {
+            /rem c 3 add j c 5 add mod sub def  % Codewords to end of row
+
+            i msglen eq endofrow or {exit} if
+        
+            i numsscr /nums exch def /nchars exch def
+
+            % Determine switches and shifts
+            {  % common exit
+                cset (seta) eq cset (setb) eq or nums 4 ge and 
+                msg i get fn1 ne and {
+                    nums 2 mod 0 eq
+                    rem 3 ge and {
+                        swc cset (seta) eq {enca} {encb} ifelse
+                        /cset (setc) def
+                        2 {
+                            msg i get fn1 eq {
+                                fn1 encc
+                                /i i 1 add def
+                            } {
+                                msg i 2 getinterval encc
+                                /i i 2 add def
+                            } ifelse
+                        } repeat
+                        exit
+                    } if
+                    nums 2 mod 0 ne
+                    rem 4 ge and {
+                        msg i get cset (seta) eq {enca} {encb} ifelse
+                        /i i 1 add def
+                        swc cset (seta) eq {enca} {encb} ifelse
+                        /cset (setc) def
+                        2 {
+                            msg i get fn1 eq {
+                                fn1 encc
+                                /i i 1 add def
+                            } {
+                                msg i 2 getinterval encc
+                                /i i 2 add def
+                            } ifelse
+                        } repeat
+                        exit
+                    } if
+                } if
+                cset (setb) eq msg i get anotb and 
+                rem 2 ge and { 
+                    i msglen 1 sub lt {
+                        i 1 add bbeforea { 
+                            sft encb
+                            msg i get enca
+                            /i i 1 add def
+                            exit
+                        } if
+                    } if
+                    swa encb
+                    /cset (seta) def
+                    msg i get enca
+                    /i i 1 add def
+                    exit
+                } if
+                cset (seta) eq msg i get bnota and
+                rem 2 ge and {
+                    i msglen 1 sub lt {
+                        i 1 add abeforeb {
+                            sft enca
+                            msg i get encb
+                            /i i 1 add def
+                            exit
+                        } if
+                    } if
+                    swb enca
+                    /cset (setb) def
+                    msg i get encb
+                    /i i 1 add def
+                    exit
+                } if
+                cset (setc) eq nums 2 lt and
+                rem 2 ge and {
+                    i abeforeb {
+                        swa encc
+                        /cset (seta) def
+                        msg i get enca
+                        /i i 1 add def
+                        exit
+                    } if
+                    swb encc
+                    /cset (setb) def
+                    msg i get encb
+                    /i i 1 add def
+                    exit
+                } if
+        
+                % No switches or latches so try to encode
+                cset (seta) eq seta msg i get known and
+                rem 1 ge and {
+                    msg i get enca
+                    /i i 1 add def
+                    exit
+                } if
+                cset (setb) eq setb msg i get known and
+                rem 1 ge and {
+                    msg i get encb
+                    /i i 1 add def
+                    exit
+                } if
+                cset (setc) eq nums 2 ge and
+                rem 1 ge and {
+                    msg i get fn1 eq {
+                        fn1 encc
+                        /i i 1 add def
+                    } {
+                        msg i 2 getinterval encc
+                        /i i 2 add def 
+                    } ifelse
+                    exit
+                } if
+
+                % Encoding does not fit in the row
+                /endofrow true def
+                exit
+
+            } loop  % common exit
+
+        } loop
+
+        % Determine whether this is the final row
+        r rows eq rows -1 eq or r 1 gt and i msglen eq and rem 2 ge and {
+            rem 2 sub padrow
+            /j j 3 add def  % Skip symbol and row checksum character positions
+            stp enca
+            /lastrow true def
+        } {
+            rem padrow
+            /j j 1 add def  % Skip row checksum character positions
+            stp enca
+            /r r 1 add def
+        } ifelse
+
+    } loop
+    /cws cws 0 j getinterval def
+
+    % Maps for row indicators and symbol checksums
+    /abmap [
+        64 1 95 {} for
+         0 1 15 {} for
+        26 1 63 {} for
+    ] def
+    /cmap [ 0 1 85 {} for ] def
+    
+    % Add symbol check characters to last row
+    /chkmsg msglen array def
+    /j 0 def
+    0 1 msglen 1 sub {
+        /i exch def
+        /char msg i get def
+        char 0 ge {chkmsg j char put /j j 1 add def} if
+        char fn1 eq i 0 ne and {chkmsg j 29 put /j j 1 add def} if
+    } for
+    /t1 0 def /t2 0 def /k1 0 def /k2 0 def
+    0 1 j 1 sub {
+        /i exch def
+        /t1 chkmsg i get i mul 86 mod def
+        /t2 t1 chkmsg i get add 86 mod def
+        /k1 k1 t2 add 86 mod def
+        /k2 k2 t1 add 86 mod def
+    } for
+    cws cws length 4 sub cset (setc) ne {abmap} {cmap} ifelse k1 get put
+    cws cws length 3 sub cset (setc) ne {abmap} {cmap} ifelse k2 get put
+
+    % Populate row indicators
+    cws 2 2 copy 1 sub get 99 ne {abmap} {cmap} ifelse r 2 sub get put
+    1 1 r 1 sub {
+        /i exch def
+        cws i c 5 add mul 2 add 2 copy 1 sub get 99 ne {abmap} {cmap} ifelse i 42 add get put
+    } for
+
+    % Calculate row check characters
+    0 1 r 1 sub {
+        cws exch c 5 add mul c 4 add getinterval /rcws exch def
+        /csum rcws 0 get def
+        1 1 rcws length 2 sub {
+            /i exch def
+            /csum csum rcws i get i mul add def
+        } for
+        rcws rcws length 1 sub csum 103 mod put
+    } for
+
+    % Create an array containing the character mappings
+    /encs
+    [ (212222) (222122) (222221) (121223) (121322) (131222) (122213)
+      (122312) (132212) (221213) (221312) (231212) (112232) (122132)
+      (122231) (113222) (123122) (123221) (223211) (221132) (221231)
+      (213212) (223112) (312131) (311222) (321122) (321221) (312212)
+      (322112) (322211) (212123) (212321) (232121) (111323) (131123)
+      (131321) (112313) (132113) (132311) (211313) (231113) (231311)
+      (112133) (112331) (132131) (113123) (113321) (133121) (313121)
+      (211331) (231131) (213113) (213311) (213131) (311123) (311321)
+      (331121) (312113) (312311) (332111) (314111) (221411) (431111)
+      (111224) (111422) (121124) (121421) (141122) (141221) (112214)
+      (112412) (122114) (122411) (142112) (142211) (241211) (221114)
+      (413111) (241112) (134111) (111242) (121142) (121241) (114212)
+      (124112) (124211) (411212) (421112) (421211) (212141) (214121)
+      (412121) (111143) (111341) (131141) (114113) (114311) (411113)
+      (411311) (113141) (114131) (311141) (411131) (211412) (2331112)
+    ] def
+
+    % Derive the bits for each row
+    /rowbits r array def
+    0 1 r 1 sub {
+        /i exch def
+        /sbs [
+            cws i c 5 add mul c 5 add getinterval {
+                encs exch get {48 sub} forall
+            } forall 
+        ] def
+        mark
+        0 sbs {1 index 1 eq {{0}} {{1}} ifelse repeat} forall
+        counttomark 1 sub array astore exch pop exch pop
+        rowbits i 3 -1 roll put
+    } for
+
+    % Populate the bitmap
+    /symwid c 11 mul 57 add def
+    /pixs [
+        symwid sepheight mul {1} repeat
+        0 1 r 2 sub {
+            /i exch def
+            rowheight {rowbits i get aload pop} repeat
+            sepheight {
+                1 1 0 1 0 0 0 0 1 0 0
+                symwid 24 sub {1} repeat
+                1 1 0 0 0 1 1 1 0 1 0 1 1
+            } repeat
+        } for
+        rowheight {rowbits r 1 sub get aload pop} repeat
+        symwid sepheight mul {1} repeat
+    ] def
+    
+    % Return the arguments
+    <<
+    /ren //renmatrix
+    /pixs pixs
+    /pixx symwid
+    /pixy pixs length symwid idiv
+    /height pixs length symwid idiv 72 div
+    /width symwid 72 div
+    /opt options
+    >>
+
+    dontdraw not //renmatrix if
+
+    end
+
+} bind def
+/codablockf dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER codablockf--
+
+% --BEGIN ENCODER code16k--
+% --DESC: Code 16K
+% --EXAM: Abcd-1234567890-wxyZ
+% --EXOP:
+% --RNDR: renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/code16k {
+
+    20 dict begin
+
+    /options exch def
+    /barcode exch def
+
+    /dontdraw false def
+    /mode -1 def
+    /pos -1 def
+    /rows 0 def
+    /rowheight 8 def
+    /sepheight 1 def
+    /encoding (auto) def
+    /raw false def
+    /parse false def
+    /parsefnc 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
+
+    /mode mode cvi def
+    /pos pos cvi def
+    /rows rows cvi def
+    /rowheight rowheight cvi def
+    /sepheight sepheight cvi def
+
+    pos -1 ne {/rows 16 def} if
+
+    % 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 
+    /swa  -1 def  /swb  -2 def  /swc  -3 def 
+    /sa1  -4 def  /sb1  -5 def  /sc1  -6 def 
+    /sa2  -7 def  /sb2  -8 def  /sc2  -9 def 
+    /pad -10 def  /sb3 -11 def  /sc3 -12 def
+    /fn1 -13 def  /fn2 -14 def  /fn3 -15 def  /fn4 -16 def
+
+    % Character maps for each state
+    /charmaps [
+      %  A    B    C         A    B    C         A    B    C
+      [  32   32  (00) ]  [ (!)  (!)  (01) ]  [ (")  (")  (02) ]  % 0-2 
+      [ (#)  (#)  (03) ]  [ ($)  ($)  (04) ]  [ (%)  (%)  (05) ]  % 3-5
+      [ (&)  (&)  (06) ]  [ (')  (')  (07) ]  [  40   40  (08) ]  % 6-8
+      [  41   41  (09) ]  [ (*)  (*)  (10) ]  [ (+)  (+)  (11) ]  % 9-11
+      [ (,)  (,)  (12) ]  [ (-)  (-)  (13) ]  [ (.)  (.)  (14) ]  % 12-14
+      [ (/)  (/)  (15) ]  [ (0)  (0)  (16) ]  [ (1)  (1)  (17) ]  % 15-17
+      [ (2)  (2)  (18) ]  [ (3)  (3)  (19) ]  [ (4)  (4)  (20) ]  % 18-20
+      [ (5)  (5)  (21) ]  [ (6)  (6)  (22) ]  [ (7)  (7)  (23) ]  % 21-23
+      [ (8)  (8)  (24) ]  [ (9)  (9)  (25) ]  [ (:)  (:)  (26) ]  % 24-26
+      [ (;)  (;)  (27) ]  [ (<)  (<)  (28) ]  [ (=)  (=)  (29) ]  % 27-29
+      [ (>)  (>)  (30) ]  [ (?)  (?)  (31) ]  [ (@)  (@)  (32) ]  % 30-32
+      [ (A)  (A)  (33) ]  [ (B)  (B)  (34) ]  [ (C)  (C)  (35) ]  % 33-35
+      [ (D)  (D)  (36) ]  [ (E)  (E)  (37) ]  [ (F)  (F)  (38) ]  % 36-38
+      [ (G)  (G)  (39) ]  [ (H)  (H)  (40) ]  [ (I)  (I)  (41) ]  % 39-41
+      [ (J)  (J)  (42) ]  [ (K)  (K)  (43) ]  [ (L)  (L)  (44) ]  % 42-44
+      [ (M)  (M)  (45) ]  [ (N)  (N)  (46) ]  [ (O)  (O)  (47) ]  % 45-47
+      [ (P)  (P)  (48) ]  [ (Q)  (Q)  (49) ]  [ (R)  (R)  (50) ]  % 48-50
+      [ (S)  (S)  (51) ]  [ (T)  (T)  (52) ]  [ (U)  (U)  (53) ]  % 51-53
+      [ (V)  (V)  (54) ]  [ (W)  (W)  (55) ]  [ (X)  (X)  (56) ]  % 54-56
+      [ (Y)  (Y)  (57) ]  [ (Z)  (Z)  (58) ]  [ ([)  ([)  (59) ]  % 57-59
+      [  92   92  (60) ]  [ (])  (])  (61) ]  [ (^)  (^)  (62) ]  % 60-62
+      [ (_)  (_)  (63) ]  [   0  (`)  (64) ]  [   1  (a)  (65) ]  % 63-65
+      [   2  (b)  (66) ]  [   3  (c)  (67) ]  [   4  (d)  (68) ]  % 66-68
+      [   5  (e)  (69) ]  [   6  (f)  (70) ]  [   7  (g)  (71) ]  % 69-71
+      [   8  (h)  (72) ]  [   9  (i)  (73) ]  [  10  (j)  (74) ]  % 72-74
+      [  11  (k)  (75) ]  [  12  (l)  (76) ]  [  13  (m)  (77) ]  % 75-77
+      [  14  (n)  (78) ]  [  15  (o)  (79) ]  [  16  (p)  (80) ]  % 78-80
+      [  17  (q)  (81) ]  [  18  (r)  (82) ]  [  19  (s)  (83) ]  % 81-83
+      [  20  (t)  (84) ]  [  21  (u)  (85) ]  [  22  (v)  (86) ]  % 84-86
+      [  23  (w)  (87) ]  [  24  (x)  (88) ]  [  25  (y)  (89) ]  % 87-89
+      [  26  (z)  (90) ]  [  27  ({)  (91) ]  [  28  (|)  (92) ]  % 90-92
+      [  29  (})  (93) ]  [  30  (~)  (94) ]  [  31  127  (95) ]  % 93-95
+      [ fn3  fn3  (96) ]  [ fn2  fn2  (97) ]  [ sb1  sa1  (98) ]  % 96-98
+      [ swc  swc  (99) ]  [ swb  fn4  swb  ]  [ fn4  swa  swa  ]  % 99-101
+      [ fn1  fn1  fn1  ]  [ pad  pad  pad  ]  [ sb2  sa2  sb1  ]  % 102-104
+      [ sc2  sc2  sb2  ]  [ sc3  sc3  sb3  ]                      % 105-106
+    ] def 
+    
+    % Invert charmaps to give character to value maps for each state
+    /charvals [ 109 dict 109 dict 109 dict ] def
+    0 1 charmaps length 1 sub {
+        /i exch def
+        /encs charmaps i get def
+        0 1 2 {
+            /j exch def
+            encs j get dup type /stringtype eq {0 get} if  % convert string to ASCII if required
+            charvals j get exch i put 
+        } for
+    } for
+    /seta charvals 0 get def
+    /setb charvals 1 get def
+    /setc charvals 2 get def
+
+    raw {/encoding (raw) 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
+        /text () def
+    } if
+
+    encoding (auto) eq { 
+
+        /fncvals <<
+            (FNC1) fn1
+            (FNC2) fn2
+            (FNC3) fn3
+            (FNC4) fn4
+        >> 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
+    
+        % Determine digit runlength and characters from given position
+        /numsscr {
+            /n 0 def /s 0 def
+            /p exch def {
+                p msglen ge {exit} if
+                msg p get
+                dup setc exch known not {pop exit} if
+                fn1 eq {
+                    % FNC1 in odd position of run like two digits
+                    s 2 mod 0 eq {/s s 1 add def} {exit} ifelse
+                } if
+                /n n 1 add def
+                /s s 1 add def
+                /p p 1 add def
+            } loop
+            n s
+        } bind def
+
+        % Encoding for each alphabet
+        /enca {
+            seta exch get cws exch j exch put
+            /j j 1 add def
+        } bind def
+        /encb {
+            setb exch get cws exch j exch put
+            /j j 1 add def
+        } bind def
+        /encc {
+            dup type /arraytype ne {
+                setc exch get
+            } {
+                aload pop 48 sub exch 48 sub 10 mul add
+            } ifelse
+            cws exch j exch put
+            /j j 1 add def
+        } bind def
+
+        % Character exclusively in either alphabet A or B
+        /anotb {dup seta exch known exch setb exch known not and} bind def
+        /bnota {dup setb exch known exch seta exch known not and} bind def
+
+        % Pre-compute relative position of next anotb and next bnota characters
+        /nextanotb [ msg length {0} repeat 9999 ] def
+        /nextbnota [ msg length {0} repeat 9999 ] def
+        msg length 1 sub -1 0 {
+            /i exch def
+            msg i get anotb {
+                nextanotb i 0 put
+            } {
+                nextanotb i nextanotb i 1 add get 1 add put
+            } ifelse
+            msg i get bnota {
+                nextbnota i 0 put
+            } {
+                nextbnota i nextbnota i 1 add get 1 add put
+            } ifelse
+        } for
+
+        % Does a-only come before b-only after given position and vice versa
+        /abeforeb {dup nextanotb exch get exch nextbnota exch get lt} bind def
+        /bbeforea {dup nextbnota exch get exch nextanotb exch get lt} bind def
+ 
+        /cws barcode length 2 mul 3 add array def
+       
+        % Select mode and encode first characters
+        /i 0 def /j 0 def
+        {  % common exit
+            % extended data length
+            pos -1 ne {
+                % encode one and two
+                cws 0 pos 10 idiv 1 sub put
+                cws 1 pos 10 mod 1 sub put 
+                /j 2 def
+                /cset (setb) def
+                /mode 7 def
+                exit
+            } if
+            % empty => b
+            msglen 0 eq {
+                /cset (setb) def
+                /mode 1 def
+                exit
+            } if
+            % FNC1 . 2+ nums => c fnc1
+            msglen 2 ge {
+                msg 0 get fn1 eq 1 numsscr exch pop 2 ge and {
+                    /cset (setc) def
+                    /mode 4 def
+                    /i 1 def
+                    exit
+                } if
+            } if
+            % FNC1 => b fnc1
+            msg 0 get fn1 eq {
+                /cset (setb) def
+                /mode 3 def
+                /i 1 def
+                exit
+            } if
+            msglen 2 ge {
+                % 2+ even nums => c
+                0 numsscr exch pop dup 2 ge exch 2 mod 0 eq and {
+                    /cset (setc) def
+                    /mode 2 def
+                    exit
+                } if
+                % 3+ odd nums => c sb1 encode
+                0 numsscr exch pop dup 3 ge exch 2 mod 1 eq and {
+                    msg 0 get encb
+                    /cset (setc) def
+                    /mode 5 def
+                    /i 1 def
+                    exit
+                } if
+                % b . 2+ even nums => c sb1 encode
+                setb msg 0 get known
+                1 numsscr exch pop dup 2 ge exch 2 mod 0 eq and and {
+                    msg 0 get encb
+                    /cset (setc) def
+                    /mode 5 def
+                    /i 1 def
+                    exit
+                } if
+                % b . 3+ odd nums => c sb2 encode 
+                setb msg 0 get known
+                1 numsscr exch pop dup 3 ge exch 2 mod 1 eq and and {
+                    msg 0 get encb
+                    msg 1 get encb
+                    /cset (setc) def
+                    /mode 6 def
+                    /i 2 def
+                    exit
+                } if
+                % b . b . 2+ even nums => c sb2 encode
+                setb msg 0 get known
+                setb msg 1 get known and
+                2 numsscr exch pop dup 2 ge exch 2 mod 0 eq and and {
+                    msg 0 get encb
+                    msg 1 get encb
+                    /cset (setc) def
+                    /mode 6 def
+                    /i 2 def
+                    exit
+                } if
+            } if
+            % anotb before bnota => a
+            0 abeforeb {
+                /cset (seta) def
+                /mode 0 def
+                exit
+            } if
+            % otherwise => b
+            /cset (setb) def
+            /mode 1 def
+            exit
+        } loop
+
+        {  % Encode remainder
+            i msglen eq {exit} if
+        
+            i numsscr /nums exch def /nchars exch def
+        
+            % Determine switches and shifts
+            {  % common exit
+                cset (seta) eq {
+                    % bnota . anotb before bnota => sb1 encode
+                    i msglen 1 sub lt {
+                        msg i get bnota
+                        i 1 add abeforeb and {
+                            sb1 enca
+                            msg i get encb
+                            /i i 1 add def
+                            exit
+                        } if
+                    } if
+                    % bnota . bnota . anotb before bnota => sb2 encode
+                    i msglen 2 sub lt {
+                        msg i get bnota
+                        msg i 1 add get bnota and
+                        i 2 add abeforeb and {
+                            sb2 enca
+                            msg i get encb
+                            msg i 1 add get encb
+                            /i i 2 add def
+                            exit
+                        } if
+                    } if
+                    % bnota => swb
+                    msg i get bnota {
+                        swb enca
+                        /cset (setb) def
+                        exit
+                    } if
+                    % 4 nums . a => sc2 encode
+                    i msglen 4 sub lt {
+                        nums 4 eq 
+                        seta msg i 4 add get known and {
+                            sc2 enca
+                            2 {
+                                msg i get fn1 eq {
+                                    fn1 encc
+                                    /i i 1 add def
+                                } {
+                                    msg i 2 getinterval encc
+                                    /i i 2 add def 
+                                } ifelse
+                            } repeat
+                            exit
+                        } if
+                    } if
+                    % 6 nums . a => sc3 encode
+                    i msglen 6 sub lt { 
+                        nums 6 eq 
+                        seta msg i 6 add get known and {
+                            sc3 enca
+                            3 {
+                                msg i get fn1 eq {
+                                    fn1 encc
+                                    /i i 1 add def
+                                } {
+                                    msg i 2 getinterval encc
+                                    /i i 2 add def
+                                } ifelse
+                            } repeat
+                            exit
+                        } if
+                    } if
+                    % 4+ even nums => swc
+                    nums 4 ge nums 2 mod 0 eq and {
+                        swc enca
+                        /cset (setc) def
+                        exit
+                    } if
+                    % otherwise => encode
+                    msg i get enca
+                    /i i 1 add def
+                    exit
+                } if
+                cset (setb) eq {
+                    % anotb . bnota before anotb => sa1 encode
+                    i msglen 1 sub lt {
+                        msg i get anotb
+                        i 1 add bbeforea and {
+                            sa1 encb
+                            msg i get enca
+                            /i i 1 add def
+                            exit
+                        } if
+                    } if
+                    % anotb . anotb . bnota before anotb => sa2 encode
+                    i msglen 2 sub lt {
+                        msg i get anotb 
+                        msg i 1 add get anotb and
+                        i 2 add bbeforea and {
+                            sa2 encb
+                            msg i get enca
+                            msg i 1 add get enca
+                            /i i 2 add def
+                            exit
+                        } if
+                    } if
+                    % anotb => swa
+                    msg i get anotb {
+                        swa encb
+                        /cset (seta) def
+                        exit
+                    } if
+                    % 4 nums . b => sc2 encode
+                    i msglen 4 sub lt {
+                        nums 4 eq
+                        setb msg i 4 add get known and {
+                            sc2 encb
+                            2 {
+                                msg i get fn1 eq {
+                                    fn1 encc
+                                    /i i 1 add def
+                                } {
+                                    msg i 2 getinterval encc
+                                    /i i 2 add def
+                                } ifelse
+                            } repeat
+                            exit
+                        } if
+                    } if
+                    % 6 nums . b => sc3 encode
+                    i msglen 6 sub lt {
+                        nums 6 eq
+                        setb msg i 6 add get known and {
+                            sc3 encb
+                            3 {
+                                msg i get fn1 eq {
+                                    fn1 encc
+                                    /i i 1 add def
+                                } {
+                                    msg i 2 getinterval encc
+                                    /i i 2 add def
+                                } ifelse
+                            } repeat
+                            exit
+                        } if
+                    } if
+                    % 4+ even nums => swc
+                    nums 4 ge nums 2 mod 0 eq and {
+                        swc encb
+                        /cset (setc) def
+                        exit
+                    } if
+                    % otherwise => encode
+                    msg i get encb
+                    /i i 1 add def
+                    exit 
+                } if
+                cset (setc) eq {
+                    % 2+ nums => encode
+                    nums 2 ge {
+                        msg i get fn1 eq {
+                            fn1 encc
+                            /i i 1 add def
+                        } {
+                            msg i 2 getinterval encc
+                            /i i 2 add def
+                        } ifelse
+                        exit
+                    } if
+                    % b . 2+ even nums => sb1 encode
+                    i msglen 1 sub lt {
+                        setb msg i get known
+                        i 1 add numsscr exch pop dup 2 ge exch 2 mod 0 eq and and {
+                            sb1 encc
+                            msg i get encb
+                            /i i 1 add def
+                            exit
+                        } if
+                    } if
+                    % b . 3+ odd nums => sb2 encode
+                    i msglen 1 sub lt {
+                        setb msg i get known
+                        i 1 add numsscr exch pop dup 3 ge exch 2 mod 1 eq and and {
+                            sb2 encc
+                            msg i get encb
+                            msg i 1 add get encb
+                            /i i 2 add def
+                            exit
+                        } if
+                    } if
+                    % b . b . 2+ even nums => sb2 encode
+                    i msglen 2 sub lt {
+                        setb msg i get known
+                        setb msg i 1 add get known and
+                        i 2 add numsscr exch pop dup 2 ge exch 2 mod 0 eq and and {
+                            sb2 encc
+                            msg i get encb
+                            msg i 1 add get encb
+                            /i i 2 add def
+                            exit
+                        } if
+                    } if
+                    % b . b . 3+ odd nums => sb3 encode
+                    i msglen 3 sub lt {
+                        setb msg i get known
+                        setb msg i 1 add get known and
+                        i 2 add numsscr exch pop dup 3 ge exch 2 mod 1 eq and and {
+                            sb3 encc
+                            msg i get encb
+                            msg i 1 add get encb
+                            msg i 2 add get encb
+                            /i i 3 add def
+                            exit
+                        } if
+                    } if
+                    % b . b . b . 2+ even nums => sb3 encode
+                    i msglen 3 sub lt {
+                        setb msg i get known 
+                        setb msg i 1 add get known and
+                        setb msg i 2 add get known and
+                        i 3 add numsscr exch pop dup 2 ge exch 2 mod 0 eq and and {
+                            sb3 encc
+                            msg i get encb
+                            msg i 1 add get encb
+                            msg i 2 add get encb
+                            /i i 3 add def
+                            exit 
+                        } if
+                    } if
+                    % anotb before bnota => swa
+                    i abeforeb {
+                        swa encc
+                        /cset (seta) def
+                        exit
+                    } if
+                    % otherwise => swb
+                    swb encc
+                    /cset (setb) def
+                    exit
+                } if
+                exit
+            } loop
+        
+        } loop
+        /cws cws 0 j getinterval def
+    } if  % auto encoding
+    
+    % Basic metrics for the each symbol
+    %     r  dcws 
+    /metrics [
+        [  2    7 ]
+        [  3   12 ]
+        [  4   17 ]
+        [  5   22 ]
+        [  6   27 ]
+        [  7   32 ]
+        [  8   37 ]
+        [  9   42 ]
+        [ 10   47 ]
+        [ 11   52 ]
+        [ 12   57 ]
+        [ 13   62 ]
+        [ 14   67 ]
+        [ 15   72 ]
+        [ 16   77 ]
+    ] def
+
+    % Select metrics of an appropriate symbol
+    /urows rows def
+    /i 0 def
+    { % loop
+        /m metrics i get def
+        /r    m 0 get def        % Columns in symbol
+        /dcws m 1 get def        % Data codewords in symbol
+        /okay true def
+        urows 0 ne urows r ne and {/okay false def} if
+        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
+    /cws [ cws aload pop dcws cws length sub {103} repeat ] def
+
+    % Add the start character
+    /cws [ r 2 sub 7 mul mode add cws aload pop ] def
+
+    % Calculate the check characters
+    0 0 1 dcws {dup 2 add exch cws exch get mul add} for 
+    107 mod /c1 exch def
+    0 0 1 dcws {dup 1 add exch cws exch get mul add} for 
+    c1 dcws 2 add mul add 107 mod /c2 exch def
+    /cws [ cws aload pop c1 c2 ] def
+
+    % Create an array containing the character mappings
+    /encs
+    [ (212222) (222122) (222221) (121223) (121322) (131222) (122213)
+      (122312) (132212) (221213) (221312) (231212) (112232) (122132)
+      (122231) (113222) (123122) (123221) (223211) (221132) (221231)
+      (213212) (223112) (312131) (311222) (321122) (321221) (312212)
+      (322112) (322211) (212123) (212321) (232121) (111323) (131123)
+      (131321) (112313) (132113) (132311) (211313) (231113) (231311)
+      (112133) (112331) (132131) (113123) (113321) (133121) (313121)
+      (211331) (231131) (213113) (213311) (213131) (311123) (311321)
+      (331121) (312113) (312311) (332111) (314111) (221411) (431111)
+      (111224) (111422) (121124) (121421) (141122) (141221) (112214)
+      (112412) (122114) (122411) (142112) (142211) (241211) (221114)
+      (413111) (241112) (134111) (111242) (121142) (121241) (114212)
+      (124112) (124211) (411212) (421112) (421211) (212141) (214121)
+      (412121) (111143) (111341) (131141) (114113) (114311) (411113)
+      (411311) (113141) (114131) (311141) (411131) (211412) (211214)
+      (211232) (211133)
+    ] def
+
+    % Start/stop character encodings
+    /startencs [ 
+        (3211) (2221) (2122) (1411) (1132) (1231) (1114) (3112)
+        (3211) (2221) (2122) (1411) (1132) (1231) (1114) (3112)
+    ] def
+    /stopencsodd [
+        (3211) (2221) (2122) (1411) (1132) (1231) (1114) (3112)
+        (1132) (1231) (1114) (3112) (3211) (2221) (2122) (1411)
+    ] def
+    /stopencseven [
+        (2122) (1411) (1132) (1231) (1114) (3112) (1132) (1231)
+        (1114) (3112) (3211) (2221) (2122) (1411) (3211) (2221)
+    ] def
+    pos -1 eq pos 10 idiv 2 mod 1 eq or {
+        /stopencs stopencsodd def
+    } {
+        /stopencs stopencseven def
+    } ifelse
+ 
+    % Derive the bits for each row
+    /rowbits r array def
+    0 1 r 1 sub {
+        /i exch def
+        /sbs [
+            10
+            startencs i get {48 sub} forall
+            1
+            cws i 5 mul 5 getinterval {
+                encs exch get {48 sub} forall
+            } forall 
+            stopencs i get {48 sub} forall
+            1
+        ] def
+        mark
+        1 sbs {1 index 0 eq {{1}} {{0}} ifelse repeat} forall
+        counttomark 1 sub array astore exch pop exch pop
+        rowbits i 3 -1 roll put
+    } for
+
+    % Populate the bitmap
+    /pixs [
+        81 sepheight mul {1} repeat
+        0 1 r 2 sub {
+            /i exch def
+            rowheight {rowbits i get aload pop} repeat
+            sepheight {10 {0} repeat 70 {1} repeat 0} repeat
+        } for
+        rowheight {rowbits r 1 sub get aload pop} repeat
+        81 sepheight mul {1} repeat
+    ] def
+    
+    % Return the arguments
+    <<
+    /ren //renmatrix
+    /pixs pixs
+    /pixx 81
+    /pixy pixs length 81 idiv
+    /height pixs length 81 idiv 72 div
+    /width 81 72 div
+    /opt options
+    >>
+
+    dontdraw not //renmatrix if
+
+    end
+
+} bind def
+/code16k dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER code16k--
+
+% --BEGIN ENCODER code49--
+% --DESC: Code 49
+% --EXAM: MULTIPLE ROWS IN CODE 49
+% --EXOP:
+% --RNDR: renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/code49 {
+
+    20 dict begin
+
+    /options exch def
+    /barcode exch def
+
+    /dontdraw false def
+    /mode -1 def
+    /pos -1 def
+    /rows 0 def
+    /rowheight 8 def
+    /sepheight 1 def
+    /parse false def
+    /parsefnc 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
+
+    /mode mode cvi def
+    /pos pos cvi def
+    /rows rows cvi def
+    /rowheight rowheight cvi def
+    /sepheight sepheight 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 
+    /s1 -1 def /s2 -2 def /fn1 -3 def /fn2 -4 def /fn3 -5 def /ns -6 def
+    /fncvals <<
+        (FNC1) fn1
+        (FNC2) fn2
+        (FNC3) fn3
+    >> 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
+
+    % Character encodings
+    /charmap [
+        (0) (1) (2) (3) (4) (5) (6) (7) (8) (9)
+        (A) (B) (C) (D) (E) (F) (G) (H) (I) (J) (K) (L) (M)
+        (N) (O) (P) (Q) (R) (S) (T) (U) (V) (W) (X) (Y) (Z)
+        (-) (.) ( ) ($) (/) (+) (%)
+        s1  s2  fn1 fn2 fn3 ns
+    ] def
+
+    % Invert charmap to give character to value map
+    /charvals 49 dict def
+    0 1 48 {
+        /i exch def
+        charmap i get 
+        dup type /stringtype eq {0 get} if  % convert string to ASCII if required
+        charvals exch i put 
+    } for
+
+    % Shifted character encodings
+    /combos
+    [ (1 ) (1A) (1B) (1C) (1D) (1E) (1F) (1G) (1H) (1I) (1J) (1K) (1L) (1M) (1N) (1O)
+      (1P) (1Q) (1R) (1S) (1T) (1U) (1V) (1W) (1X) (1Y) (1Z) (11) (12) (13) (14) (15)
+      (  ) (16) (17) (18) ( $) ( %) (19) (10) (1-) (1.) (1$) ( +) (1/) ( -) ( .) ( /)
+      ( 0) ( 1) ( 2) ( 3) ( 4) ( 5) ( 6) ( 7) ( 8) ( 9) (1+) (21) (22) (23) (24) (25)
+      (26) ( A) ( B) ( C) ( D) ( E) ( F) ( G) ( H) ( I) ( J) ( K) ( L) ( M) ( N) ( O)
+      ( P) ( Q) ( R) ( S) ( T) ( U) ( V) ( W) ( X) ( Y) ( Z) (27) (28) (29) (20) (2-)
+      (2.) (2A) (2B) (2C) (2D) (2E) (2F) (2G) (2H) (2I) (2J) (2K) (2L) (2M) (2N) (2O)
+      (2P) (2Q) (2R) (2S) (2T) (2U) (2V) (2W) (2X) (2Y) (2Z) (2$) (2/) (2+) (2%) (2 )
+    ] def
+    0 1 127 {
+        /i exch def
+        combos i get dup 0 get /c1 exch def 1 get /c2 exch def
+        c1 49 eq {  % s1 char
+            charvals i [ charvals s1 get charvals c2 get ] put
+        } if
+        c1 50 eq {  % s2 char
+            charvals i [ charvals s2 get charvals c2 get ] put
+        } if
+    } for
+
+    /encodealpha {
+        charvals exch get
+        dup type /arraytype ne {1 array astore} if
+        dup cws exch j exch putinterval
+        length j add /j exch def
+    } bind def
+
+    /base48 {
+        0 exch {48 sub exch 10 mul add} forall
+        [ 3 1 roll exch 1 sub {dup 48 mod exch 48 idiv} repeat ]
+        [ exch dup length 1 sub -1 0 {1 index exch get exch} for pop ]
+        dup cws exch j exch putinterval
+        length j add /j exch def
+    } bind def
+
+    /encodenumeric {
+        /nums exch def
+        /pre nums length dup 5 mod dup 2 ne {sub} {sub 5 sub} ifelse def
+        0 5 pre 1 sub {nums exch 5 getinterval 3 exch base48} for
+        /nums nums pre nums length pre sub getinterval def
+        nums length
+        dup 1 eq {nums i get encodealpha} if
+        dup 3 eq {2 nums base48} if
+        dup 4 eq {3 [49 48 nums aload pop] base48} if
+        7 eq {
+            3 [49 48 nums 0 4 getinterval aload pop] base48
+            2 nums 4 3 getinterval base48
+        } if
+    } bind def
+
+    % Pre-compute alphanumeric and numeric runlengths
+    /numericruns [ msglen {0} repeat 0 ] def
+    msglen 1 sub -1 0 {
+        /i exch def
+        msg i get
+        dup 48 ge exch 57 le and {
+            numericruns i numericruns i 1 add get 1 add put
+        } {
+            numericruns i 0 put
+        } ifelse
+    } for
+
+    % Autoselect mode
+    mode -1 eq {
+        {  % common exit
+            pos -1 ne {/mode 3 def exit} if
+            numericruns 0 get 5 ge {/mode 2 def exit} if
+            charvals msg 0 get get
+            dup type /arraytype ne {pop /mode 0 def exit} if
+            0 get 43 eq {4} {5} ifelse /mode exch def
+            exit
+        } loop
+    } if
+
+    /cws msglen 2 mul 1 add array def
+    /method (alpha) def /i -1 def /j -1 def
+
+    % Handle start for each mode
+    mode 0 eq mode 1 eq or {/method (alpha) def /i 0 def /j 0 def} if 
+    mode 2 eq {/method (numeric) def /i 0 def /j 0 def} if
+    mode 3 eq {
+        /posval [ 
+            12 22
+            13 23 33
+            14 24 34 44
+            15 25 35 45 55
+            16 26 36 46 56 66
+            17 27 37 47 57 67 77 
+            18 28 38 48 58 68 78 88 
+            19 29 39 49 59 69 79 89 99
+        ] def
+        cws 0 0 1 43 {dup posval exch get pos ne {pop} if} for 1 add put
+        /method (alpha) def /i 0 def /j 1 def
+    } if
+    mode 4 eq mode 5 eq or {
+        cws 0 charvals msg 0 get get 1 get put
+        /method (alpha) def /i 1 def /j 1 def
+    } if
+
+    % Encode remainder
+    {
+        i msglen eq {exit} if
+        {  % not a loop but common exit point
+            method (alpha) eq {
+                numericruns i get 5 ge {
+                    ns encodealpha
+                    /method (numeric) def
+                    exit
+                } if
+                msg i get encodealpha
+                /i i 1 add def
+                exit
+            } if
+            method (numeric) eq {
+                numericruns i get 5 lt {
+                    ns encodealpha
+                    /method (alpha) def
+                    exit
+                } if
+                msg i numericruns i get getinterval encodenumeric
+                /i i numericruns i get add def
+                exit
+            } if
+        } loop
+    } loop
+    /cws cws 0 j getinterval def
+
+    % Basic metrics for the each symbol
+    %     r dcws 
+    /metrics [
+        [ 2    9 ]
+        [ 3   16 ]
+        [ 4   23 ]
+        [ 5   30 ]
+        [ 6   37 ]
+        [ 7   42 ]
+        [ 8   49 ]
+    ] def
+
+    % Select metrics of an appropriate symbol
+    /urows rows def
+    /i 0 def
+    { % loop
+        /m metrics i get def
+        /r    m 0 get def        % Columns in symbol
+        /dcws m 1 get def        % Data codewords in symbol
+        /okay true def
+        urows 0 ne urows r ne and {/okay false def} if
+        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
+    /cws [ cws aload pop dcws cws length sub {48} repeat ] def
+
+    % Populate code character array and add row check characters
+    /ccs r 8 mul array def
+    /j 0 def
+    0 1 r 2 sub {
+        /i exch def
+        /cc cws j 7 getinterval def
+        ccs i 8 mul cc putinterval       
+        ccs i 8 mul 7 add 0 cc {add} forall 49 mod put
+        /j j 7 add def
+    } for
+    j dcws lt {
+        ccs ccs length 8 sub cws j dcws j sub getinterval putinterval
+    } if
+
+    % Place row count character
+    /cr7 r 2 sub 7 mul mode add def
+    ccs ccs length 2 sub cr7 put
+
+    % Calculate the symbol check characters
+    [  1  9 31 26  2 12 17 23 37 18 22  6 27 44 15 43 39
+      11 13  5 41 33 36  8  4 32  3 19 40 25 29 10 24 30 ]
+    dup [ exch 20 exch 0 32 getinterval aload pop ] /weightx exch def
+    dup [ exch 16 exch 1 32 getinterval aload pop ] /weighty exch def
+        [ exch 38 exch 2 32 getinterval aload pop ] /weightz exch def
+    /calccheck {
+        /weights exch def
+        /score 0 def
+        0 1 r 1 sub 8 mul 2 idiv 1 sub {
+            /i exch def
+            ccs i 2 mul get 49 mul ccs i 2 mul 1 add get add 
+            weights i 1 add get mul /score exch score add def
+        } for
+        score
+    } bind def
+    /lastrow ccs ccs length 8 sub 8 getinterval def
+
+    % wr1 check character
+    r 7 ge {
+        cr7 weightz 0 get mul weightz calccheck add 2401 mod
+        dup 49 idiv exch 49 mod 2 array astore
+        lastrow 0 3 -1 roll putinterval
+    } if
+    /wr1 lastrow 0 get 49 mul lastrow 1 get add def
+
+    % wr2 check character
+    cr7 weighty 0 get mul weighty calccheck add 
+    wr1 weighty r 4 mul 3 sub get mul add
+    2401 mod dup /wr2 exch def
+    dup 49 idiv exch 49 mod 2 array astore        
+    lastrow 2 3 -1 roll putinterval
+
+    % wr3 check character
+    cr7 weightx 0 get mul weightx calccheck add
+    wr1 weightx r 4 mul 3 sub get mul add
+    wr2 weightx r 4 mul 2 sub get mul add
+    2401 mod
+    dup 49 idiv exch 49 mod 2 array astore        
+    lastrow 4 3 -1 roll putinterval
+
+    % Place last row check character
+    ccs ccs length 8 sub 7 getinterval 0 exch {add} forall 49 mod
+    ccs ccs length 1 sub 3 -1 roll put
+
+    /patterns [
+        [  % Even parity
+            (11521132) (25112131) (14212132) (25121221) (14221222) (12412132) (23321221)
+            (12421222) (21521221) (15112222) (15121312) (13312222) (24221311) (13321312)
+            (11512222) (22421311) (11521312) (25112311) (14212312) (23312311) (12412312)
+            (21512311) (16121131) (14321131) (12521131) (15212131) (15221221) (13412131)
+            (13421221) (11612131) (16112221) (16121311) (14312221) (14321311) (12512221)
+            (12521311) (15212311) (13412311) (11612311) (11131135) (31131133) (51131131)
+            (21122134) (41122132) (21131224) (41131222) (11113135) (31113133) (51113131)
+            (11122225) (31122223) (51122221) (11131315) (31131313) (51131311) (21113224)
+            (41113222) (21122314) (41122312) (11113315) (31113313) (51113311) (12131134)
+            (32131132) (21231133) (41231131) (22122133) (42122131) (11222134) (22131223)
+            (42131221) (11231224) (31231222) (12113134) (32113132) (12122224) (32122222)
+            (12131314) (32131312) (21231313) (41231311) (22113223) (42113221) (11213224)
+            (22122313) (42122311) (11222314) (31222312) (12113314) (32113312) (21213313)
+            (41213311) (13131133) (33131131) (22231132) (11331133) (31331131) (23122132)
+            (12222133) (23131222) (12231223) (32231221) (21331222) (13113133) (33113131)
+            (13122223) (33122221) (11313133) (13131313) (33131311) (11322223) (22231312)
+            (11331313) (31331311) (23113222) (12213223) (23122312) (12222313) (32222311)
+            (21322312) (13113313) (33113311) (22213312) (11313313) (31313311) (14131132)
+            (23231131) (12331132) (21431131) (24122131) (13222132) (24131221) (13231222)
+            (11422132) (22331221) (11431222) (14113132) (14122222) (12313132) (14131312)
+            (12322222) (23231311) (12331312) (21431311) (24113221) (13213222) (24122311)
+            (13222312) (11413222) (22322311) (11422312) (14113312) (23213311) (12313312)
+            (21413311) (15131131) (13331131) (14222131) (14231221) (12422131) (12431221)
+            (15113131) (15122221) (13313131) (15131311) (13322221) (11513131) (13331311)
+            (11522221) (14213221) (14222311) (12413221) (12422311) (15113311) (13313311)
+            (11513311) (11141134) (31141132) (21132133) (41132131) (21141223) (41141221)
+            (11123134) (31123132) (11132224) (31132222) (11141314) (31141312) (21114133)
+            (41114131) (21123223) (41123221) (21132313) (41132311) (11114224) (31114222)
+            (11123314) (31123312) (21114313) (41114311) (12141133) (32141131) (21241132)
+            (22132132) (11232133) (22141222) (11241223) (31241221) (12123133) (32123131)
+            (12132223) (32132221) (12141313) (32141311) (21241312) (22114132) (11214133)
+            (22123222) (11223223) (22132312) (11232313) (31232311) (12114223) (32114221)
+            (12123313) (32123311) (21223312) (22114312) (11214313) (31214311) (13141132)
+            (22241131) (11341132) (23132131) (12232132) (23141221) (12241222) (21341221)
+            (13123132) (13132222) (11323132) (13141312) (11332222) (22241311) (11341312)
+            (23114131) (12214132) (23123221) (12223222) (23132311) (12232312) (21332311)
+            (13114222) (13123312) (11314222) (22223311) (11323312) (23114311) (12214312)
+            (21314311) (14141131) (12341131) (13232131) (13241221) (11432131) (14123131)
+            (14132221) (12323131) (14141311) (12332221) (12341311) (13214131) (13223221)
+            (11414131) (13232311) (11423221) (11432311) (14114221) (14123311) (12314221)
+            (12323311) (13214311) (11414311) (11151133) (31151131) (21142132) (21151222)
+            (11133133) (31133131) (11142223) (31142221) (11151313) (31151311) (21124132)
+            (21133222) (21142312) (11115133) (31115131) (11124223) (31124221) (11133313)
+            (31133311) (21115222) (21124312) (12151132) (21251131) (22142131) (11242132)
+            (22151221) (11251222) (12133132) (12142222) (12151312) (21251311) (22124131)
+            (11224132) (22133221) (11233222) (22142311) (11242312) (12115132) (12124222)
+            (12133312) (21233311) (22115221) (11215222) (22124311) (11224312) (13151131)
+            (12242131) (12251221) (13133131) (13142221) (11333131) (13151311) (11342221)
+            (12224131) (12233221) (12242311) (13115131) (13124221) (11315131) (13133311)
+            (11324221) (11333311) (12215221) (12224311) (11161132) (21152131) (21161221)
+            (11143132) (11152222) (11161312) (21134131) (21143221) (21152311) (11125132)
+            (11134222) (11143312) (21116131) (21125221) (21134311) (12161131) (11252131)
+            (12143131) (12152221) (12161311) (11234131) (11243221) (11252311) (12125131)
+            (12134221) (12143311) (11216131) (11225221) (11234311) (11111236) (31111234)
+            (51111232) (21111325) (41111323) (61111321) (11111416) (31111414) (51111412)
+            (31211143) (51211141) (12111235) (32111233) (52111231) (21211234) (41211232)
+            (22111324) (42111322) (11211325) (31211323) (51211321) (12111415) (32111413)
+            (52111411) (21211414) (41211412) (12211144) (32211142) (21311143) (41311141)
+            (13111234) (33111232) (22211233) (42211231) (11311234) (31311232) (23111323)
+            (43111321) (12211324) (32211322) (21311323) (41311321) (13111414) (33111412)
+            (22211413) (42211411) (11311414) (31311412) (13211143) (33211141) (22311142)
+            (11411143) (31411141) (14111233) (34111231) (23211232) (12311233) (32311231)
+            (21411232) (24111322) (13211323) (33211321) (22311322) (11411323) (31411321)
+            (14111413) (34111411) (23211412) (12311413) (32311411) (21411412) (14211142)
+            (23311141) (12411142) (21511141) (15111232) (24211231) (13311232) (22411231)
+            (11511232) (25111321) (14211322) (23311321) (12411322) (21511321) (15111412)
+            (24211411) (13311412) (22411411) (11511412) (15211141) (13411141) (11611141)
+            (16111231) (14311231) (12511231) (15211321) (13411321) (11611321) (16111411)
+            (14311411) (12511411) (21121144) (41121142) (11112145) (31112143) (51112141)
+            (11121235) (31121233) (51121231) (21112234) (41112232) (21121324) (41121322)
+            (11112325) (31112323) (51112321) (11121415) (31121413) (51121411) (21112414)
+            (41112412) (22121143) (42121141) (11221144) (31221142) (12112144) (32112142)
+            (12121234) (32121232) (21221233) (41221231) (22112233) (42112231) (11212234)
+            (22121323) (42121321) (11221324) (31221322) (12112324) (32112322) (12121414)
+            (32121412) (21221413) (41221411) (22112413) (42112411) (11212414) (31212412)
+            (23121142) (12221143) (32221141) (21321142) (13112143) (33112141) (13121233)
+            (33121231) (11312143) (22221232) (11321233) (31321231) (23112232) (12212233)
+            (23121322) (12221323) (32221321) (21321322) (13112323) (33112321) (13121413)
+            (33121411) (11312323) (22221412) (11321413) (31321411) (23112412) (12212413)
+            (32212411) (21312412) (24121141) (13221142) (22321141) (11421142) (14112142)
+            (14121232) (12312142) (23221231) (12321232) (21421231) (24112231) (13212232)
+            (24121321) (13221322) (11412232) (22321321) (11421322) (14112322) (14121412)
+            (12312322) (23221411) (12321412) (21421411) (24112411) (13212412) (22312411)
+            (11412412) (14221141) (12421141) (15112141) (15121231) (13312141) (13321231)
+            (11512141) (11521231) (14212231) (14221321) (12412231) (12421321) (15112321)
+            (15121411) (13312321) (13321411) (11512321) (11521411) (14212411) (12412411)
+            (21131143) (41131141) (11122144) (31122142) (11131234) (31131232) (21113143)
+            (41113141) (21122233) (41122231) (21131323) (41131321) (11113234) (31113232)
+            (11122324) (31122322) (11131414) (31131412) (21113323) (41113321) (21122413)
+            (41122411) (11113414) (31113412) (22131142) (11231143) (31231141) (12122143)
+            (32122141) (12131233) (32131231) (21231232) (22113142) (11213143) (22122232)
+            (11222233) (22131322) (11231323) (31231321) (12113233) (32113231) (12122323)
+            (32122321) (12131413) (32131411) (21231412) (22113322) (11213323) (22122412)
+            (11222413) (31222411) (12113413) (32113411) (21213412) (23131141) (12231142)
+            (21331141) (13122142) (13131232) (11322142) (22231231) (11331232) (23113141)
+            (12213142) (23122231) (12222232) (23131321) (12231322) (21331321) (13113232)
+            (13122322) (11313232) (13131412) (11322322) (22231411) (11331412) (23113321)
+            (12213322) (23122411) (12222412) (21322411) (13113412) (22213411) (11313412)
+            (13231141) (11431141) (14122141) (14131231) (12322141) (12331231) (13213141)
+            (13222231) (11413141) (13231321) (11422231) (11431321) (14113231) (14122321)
+            (12313231) (14131411) (12322321) (12331411) (13213321) (13222411) (11413321)
+            (11422411) (14113411) (12313411) (21141142) (11132143) (31132141) (11141233)
+            (31141231) (21123142) (21132232) (21141322) (11114143) (31114141) (11123233)
+            (31123231) (11132323) (31132321) (11141413) (31141411) (21114232) (21123322)
+            (21132412) (11114323) (31114321) (11123413) (31123411) (22141141) (11241142)
+            (12132142) (12141232) (21241231) (22123141) (11223142) (22132231) (11232232)
+            (22141321) (11241322) (12114142) (12123232) (12132322) (12141412) (21241411)
+            (22114231) (11214232) (22123321) (11223322) (22132411) (11232412) (12114322)
+            (12123412) (21223411) (12241141) (13132141) (13141231) (11332141) (11341231)
+            (12223141) (12232231) (12241321) (13114141) (13123231) (11314141) (13132321)
+            (11323231) (13141411) (11332321) (11341411) (12214231) (12223321) (12232411)
+            (13114321) (13123411) (11314321) (11323411) (21151141) (11142142) (11151232)
+            (21133141) (21142231) (21151321) (11124142) (11133232) (11142322) (11151412)
+            (21115141) (21124231) (21133321) (21142411) (11115232) (11124322) (11133412)
+            (11251141) (12142141) (12151231) (11233141) (11242231) (11251321) (12124141)
+            (12133231) (12142321) (12151411) (11215141) (11224231) (11233321) (11242411)
+            (12115231) (12124321) (12133411) (11152141) (11161231) (11134141) (11143231)
+            (11152321) (11161411) (11116141) (11125231) (11134321) (11143411) (21111244)
+            (41111242) (11111335) (31111333) (51111331) (21111424) (41111422) (11111515)
+            (31111513) (51111511) (21211153) (41211151) (22111243) (42111241) (11211244)
+            (31211242) (12111334) (32111332) (21211333) (41211331) (22111423) (42111421)
+            (11211424) (31211422) (12111514) (32111512) (21211513) (41211511) (22211152)
+            (11311153) (31311151) (23111242) (12211243) (32211241) (21311242) (13111333)
+            (33111331) (22211332) (11311333) (31311331) (23111422) (12211423) (32211421)
+            (21311422) (13111513) (33111511) (22211512) (11311513) (31311511) (23211151)
+            (12311152) (21411151) (24111241) (13211242) (22311241) (11411242) (14111332)
+            (23211331) (12311332) (21411331) (24111421) (13211422) (22311421) (11411422)
+            (14111512) (23211511) (12311512) (21411511) (13311151) (11511151) (14211241)
+            (12411241) (15111331) (13311331) (11511331) (14211421) (12411421) (15111511)
+            (13311511) (11511511) (31121152) (21112153) (41112151) (21121243) (41121241)
+            (11112244) (31112242) (11121334) (31121332) (21112333) (41112331) (21121423)
+            (41121421) (11112424) (31112422) (11121514) (31121512) (21112513) (41112511)
+            (12121153) (32121151) (21221152) (22112152) (11212153) (22121242) (11221243)
+            (31221241) (12112243) (32112241) (12121333) (32121331) (21221332) (22112332)
+            (11212333) (22121422) (11221423) (31221421) (12112423) (32112421) (12121513)
+            (32121511) (21221512) (22112512) (11212513) (31212511) (13121152) (22221151)
+            (11321152) (23112151) (12212152) (23121241) (12221242) (21321241) (13112242)
+            (13121332) (11312242) (22221331) (11321332) (23112331) (12212332) (23121421)
+            (12221422) (21321421) (13112422) (13121512) (11312422) (22221511) (11321512)
+            (23112511) (12212512) (21312511) (14121151) (12321151) (13212151) (13221241)
+            (11412151) (11421241) (14112241) (14121331) (12312241) (12321331) (13212331)
+            (13221421) (11412331) (11421421) (14112421) (14121511) (12312421) (12321511)
+            (13212511) (11412511) (11131153) (31131151) (21122152) (21131242) (11113153)
+            (31113151) (11122243) (31122241) (11131333) (31131331) (21113242) (21122332)
+            (21131422) (11113333) (31113331) (11122423) (31122421) (11131513) (31131511)
+            (21113422) (21122512) (12131152) (21231151) (22122151) (11222152) (22131241)
+            (11231242) (12113152) (12122242) (12131332) (21231331) (22113241) (11213242)
+            (22122331) (11222332) (22131421) (11231422) (12113332) (12122422) (12131512)
+            (21231511) (22113421) (11213422) (22122511) (11222512) (13131151) (11331151)
+            (12222151) (12231241) (13113151) (13122241) (11313151) (13131331) (11322241)
+            (11331331) (12213241) (12222331) (12231421) (13113331) (13122421) (11313331)
+            (13131511) (11322421) (11331511) (12213421) (12222511) (11141152) (21132151)
+            (21141241) (11123152) (11132242) (11141332) (21114151) (21123241) (21132331)
+            (21141421) (11114242) (11123332) (11132422) (11141512) (21114331) (21123421)
+            (21132511) (12141151) (11232151) (11241241) (12123151) (12132241) (12141331)
+            (11214151) (11223241) (11232331) (11241421) (12114241) (12123331) (12132421)
+            (12141511) (11214331) (11223421) (11232511) (11151151) (11133151) (11142241)
+            (11151331) (11115151) (11124241) (11133331) (11142421) (11151511) (11111254)
+            (31111252) (21111343) (41111341) (11111434) (31111432) (21111523) (41111521)
+            (11111614) (31111612) (31211161) (12111253) (32111251) (21211252) (22111342)
+            (11211343) (31211341) (12111433) (32111431) (21211432) (22111522) (11211523)
+            (31211521) (12111613) (32111611) (21211612) (12211162) (21311161) (13111252)
+            (22211251) (11311252) (23111341) (12211342) (21311341) (13111432) (22211431)
+            (11311432) (23111521) (12211522) (21311521) (13111612) (22211611) (11311612)
+            (13211161) (11411161) (14111251) (12311251) (13211341) (11411341) (14111431)
+            (12311431) (13211521) (11411521) (14111611) (12311611) (21121162) (11112163)
+            (31112161) (11121253) (31121251) (21112252) (21121342) (11112343) (31112341)
+            (11121433) (31121431) (21112432) (21121522) (11112523) (31112521) (11121613)
+            (31121611) (22121161) (11221162) (12112162) (12121252) (21221251) (22112251)
+            (11212252) (22121341) (11221342) (12112342) (12121432) (21221431) (22112431)
+            (11212432) (22121521) (11221522) (12112522) (12121612) (21221611) (12221161)
+            (13112161) (13121251) (11312161) (11321251) (32121115) (52121113) (21221116)
+            (41221114) (61221112) (22112116) (42112114) (31212115) (51212113) (13121116)
+            (33121114) (22221115) (42221113) (11321116) (31321114) (51321112) (23112115)
+            (43112113) (12212116) (32212114) (52212112) (21312115) (41312113) (61312111)
+            (14121115) (34121113) (23221114) (43221112) (12321115) (32321113) (52321111)
+            (21421114) (41421112) (24112114) (13212115) (33212113) (22312114) (42312112)
+            (11412115) (31412113) (51412111) (15121114) (24221113) (13321114) (33321112)
+            (22421113) (42421111) (11521114) (31521112) (25112113) (14212114) (34212112)
+            (23312113) (43312111) (12412114) (32412112) (21512113) (41512111) (16121113)
+            (25221112) (14321113) (34321111) (23421112) (12521113) (32521111) (15212113)
+            (24312112) (13412113) (33412111) (22512112) (11612113) (31612111) (31131115)
+            (51131113) (21122116) (41122114) (61122112) (31113115) (51113113) (12131116)
+            (32131114) (52131112) (21231115) (41231113) (61231111) (22122115) (42122113)
+            (11222116) (31222114) (51222112) (12113116) (32113114) (52113112) (21213115)
+            (41213113) (61213111) (13131115) (33131113) (22231114) (42231112) (11331115)
+            (31331113) (51331111) (23122114) (43122112) (12222115) (32222113) (52222111)
+            (21322114) (41322112) (13113115) (33113113) (22213114) (42213112) (11313115)
+            (31313113) (51313111) (14131114) (34131112) (23231113) (43231111) (12331114)
+            (32331112) (21431113) (41431111) (24122113) (13222114) (33222112) (22322113)
+            (42322111) (11422114) (31422112) (14113114) (34113112) (23213113) (43213111)
+            (12313114) (32313112) (21413113) (41413111) (15131113) (24231112) (13331113)
+            (33331111) (22431112) (25122112) (14222113) (34222111) (23322112) (12422113)
+            (32422111) (21522112) (15113113) (24213112) (13313113) (33313111) (22413112)
+            (11513113) (31513111) (16131112) (25231111) (14331112) (23431111) (15222112)
+            (24322111) (13422112) (22522111) (16113112) (25213111) (14313112) (23413111)
+            (12513112) (21613111) (11141116) (31141114) (51141112) (21132115) (41132113)
+            (61132111) (11123116) (31123114) (51123112) (21114115) (41114113) (61114111)
+            (12141115) (32141113) (52141111) (21241114) (41241112) (22132114) (42132112)
+            (11232115) (31232113) (51232111) (12123115) (32123113) (52123111) (21223114)
+            (41223112) (22114114) (42114112) (11214115) (31214113) (51214111) (13141114)
+            (33141112) (22241113) (42241111) (11341114) (31341112) (23132113) (43132111)
+            (12232114) (32232112) (21332113) (41332111) (13123114) (33123112) (22223113)
+            (42223111) (11323114) (31323112) (23114113) (43114111) (12214114) (32214112)
+            (21314113) (41314111) (14141113) (34141111) (23241112) (12341113) (32341111)
+            (24132112) (13232113) (33232111) (22332112) (11432113) (31432111) (14123113)
+            (34123111) (23223112) (12323113) (32323111) (21423112) (24114112) (13214113)
+            (33214111) (22314112) (11414113) (31414111) (15141112) (24241111) (13341112)
+            (25132111) (14232112) (23332111) (12432112) (15123112) (24223111) (13323112)
+            (22423111) (11523112) (25114111) (14214112) (23314111) (12414112) (21514111)
+            (16141111) (14341111) (15232111) (13432111) (16123111) (14323111) (12523111)
+            (15214111) (13414111) (11614111) (11151115) (31151113) (51151111) (21142114)
+            (41142112) (11133115) (31133113) (51133111) (21124114) (41124112) (11115115)
+            (31115113) (51115111) (12151114) (32151112) (21251113) (41251111) (22142113)
+            (42142111) (11242114) (31242112) (12133114) (32133112) (21233113) (41233111)
+            (22124113) (42124111) (11224114) (31224112) (12115114) (32115112) (21215113)
+            (41215111) (13151113) (33151111) (22251112) (23142112) (12242113) (32242111)
+            (21342112) (13133113) (33133111) (22233112) (11333113) (31333111) (23124112)
+            (12224113) (32224111) (21324112) (13115113) (33115111) (22215112) (11315113)
+            (31315111) (14151112) (23251111) (24142111) (13242112) (22342111) (14133112)
+            (23233111) (12333112) (21433111) (24124111) (13224112) (22324111) (11424112)
+            (14115112) (23215111) (12315112) (21415111) (15151111) (14242111) (15133111)
+            (13333111) (14224111) (12424111) (15115111) (13315111) (11515111) (11161114)
+            (31161112) (21152113) (41152111) (11143114) (31143112) (21134113) (41134111)
+            (11125114) (31125112) (21116113) (41116111) (12161113) (32161111) (22152112)
+            (11252113) (31252111) (12143113) (32143111) (21243112) (22134112) (11234113)
+            (31234111) (12125113) (32125111) (21225112) (22116112) (11216113) (31216111)
+            (13161112) (23152111) (12252112) (13143112) (22243111) (11343112) (23134111)
+            (12234112) (21334111) (13125112) (22225111) (11325112) (23116111) (12216112)
+            (21316111) (14161111) (13252111) (14143111) (12343111) (13234111) (11434111)
+            (14125111) (12325111) (13216111) (11416111) (31111216) (51111214) (31211125)
+            (51211123) (32111215) (52111213) (21211216) (41211214) (61211212) (12211126)
+            (32211124) (52211122) (21311125) (41311123) (61311121) (13111216) (33111214)
+            (22211215) (42211213) (11311216) (31311214) (51311212) (13211125) (33211123)
+            (22311124) (42311122) (11411125) (31411123) (51411121) (14111215) (34111213)
+            (23211214) (43211212) (12311215) (32311213) (52311211) (21411214) (41411212)
+            (14211124) (34211122) (23311123) (43311121) (12411124) (32411122) (21511123)
+            (41511121) (15111214) (24211213) (13311214) (33311212) (22411213) (42411211)
+            (11511214) (31511212) (15211123) (24311122) (13411123) (33411121) (22511122)
+            (11611123) (31611121) (16111213) (25211212) (14311213) (34311211) (23411212)
+            (12511213) (32511211) (21611212) (21121126) (41121124) (61121122) (31112125)
+            (51112123) (31121215) (51121213) (21112216) (41112214) (61112212) (22121125)
+            (42121123) (11221126) (31221124) (51221122) (12112126) (32112124) (52112122)
+            (12121216) (32121214) (52121212) (21221215) (41221213) (61221211) (22112215)
+            (42112213) (11212216) (31212214) (51212212) (23121124) (43121122) (12221125)
+            (32221123) (52221121) (21321124) (41321122) (13112125) (33112123) (13121215)
+            (33121213) (11312125) (22221214) (42221212) (11321215) (31321213) (51321211)
+            (23112214) (43112212) (12212215) (32212213) (52212211) (21312214) (41312212)
+            (24121123) (13221124) (33221122) (22321123) (42321121) (11421124) (31421122)
+            (14112124) (34112122) (14121214) (34121212) (12312124) (23221213) (43221211)
+            (12321214) (32321212) (21421213) (41421211) (24112213) (13212214) (33212212)
+            (22312213) (42312211) (11412214) (31412212) (25121122) (14221123) (34221121)
+            (23321122) (12421123) (32421121) (21521122) (15112123) (15121213) (13312123)
+            (24221212) (13321213) (33321211) (11512123) (22421212) (11521213) (31521211)
+            (25112212) (14212213) (34212211) (23312212) (12412213) (32412211) (21512212)
+            (15221122) (24321121) (13421122) (22521121) (16112122) (16121212) (14312122)
+            (25221211) (14321212) (12512122) (23421211) (12521212) (15212212) (24312211)
+            (13412212) (22512211) (11612212) (21131125) (41131123) (61131121) (11122126)
+            (31122124) (51122122) (11131216) (31131214) (51131212) (21113125) (41113123)
+            (61113121) (21122215) (41122213) (61122211) (11113216) (31113214) (51113212)
+            (22131124) (42131122) (11231125) (31231123) (51231121) (12122125) (32122123)
+            (52122121) (12131215) (32131213) (52131211) (21231214) (41231212) (22113124)
+            (42113122) (11213125) (22122214) (42122212) (11222215) (31222213) (51222211)
+            (12113215) (32113213) (52113211) (21213214) (41213212) (23131123) (43131121)
+            (12231124) (32231122) (21331123) (41331121) (13122124) (33122122) (13131214)
+            (33131212) (11322124) (22231213) (42231211) (11331214) (31331212) (23113123)
+            (43113121) (12213124) (23122213) (43122211) (12222214) (32222212) (21322213)
+            (41322211) (13113214) (33113212) (22213213) (42213211) (11313214) (31313212)
+            (24131122) (13231123) (33231121) (22331122) (11431123) (31431121) (14122123)
+            (34122121) (14131213) (34131211) (12322123) (23231212) (12331213) (32331211)
+            (21431212) (24113122) (13213123) (24122212) (13222213) (33222211) (11413123)
+            (22322212) (11422213) (31422211) (14113213) (34113211) (23213212) (12313213)
+            (32313211) (21413212) (25131121) (14231122) (23331121) (12431122) (15122122)
+            (15131212) (13322122) (24231211) (13331212) (11522122) (22431211) (25113121)
+            (14213122) (25122211) (14222212) (12413122) (23322211) (12422212) (21522211)
+            (15113212) (24213211) (13313212) (22413211) (11513212) (15231121) (13431121)
+            (16122121) (16131211) (14322121) (14331211) (12522121) (15213121) (15222211)
+            (13413121) (13422211) (11613121) (16113211) (14313211) (12513211) (21141124)
+            (41141122) (11132125) (31132123) (51132121) (11141215) (31141213) (51141211)
+            (21123124) (41123122) (21132214) (41132212) (11114125) (31114123) (51114121)
+            (11123215) (31123213) (51123211) (21114214) (41114212) (22141123) (42141121)
+            (11241124) (31241122) (12132124) (32132122) (12141214) (32141212) (21241213)
+            (41241211) (22123123) (42123121) (11223124) (22132213) (42132211) (11232214)
+            (31232212) (12114124) (32114122) (12123214) (32123212) (21223213) (41223211)
+            (22114213) (42114211) (11214214) (31214212) (23141122) (12241123) (32241121)
+            (21341122) (13132123) (33132121) (13141213) (33141211) (11332123) (22241212)
+            (11341213) (31341211) (23123122) (12223123) (23132212) (12232213) (32232211)
+            (21332212) (13114123) (33114121) (13123213) (33123211) (11314123) (22223212)
+            (11323213) (31323211) (23114212) (12214213) (32214211) (21314212) (24141121)
+            (13241122) (22341121) (14132122) (14141212) (12332122) (23241211) (12341212)
+            (24123121) (13223122) (24132211) (13232212) (11423122) (22332211) (11432212)
+            (14114122) (14123212) (12314122) (23223211) (12323212) (21423211) (24114211)
+            (13214212) (22314211) (11414212) (14241121) (15132121) (15141211) (13332121)
+            (13341211) (14223121) (14232211) (12423121) (12432211) (15114121) (15123211)
+            (13314121) (13323211) (11514121) (11523211) (14214211) (12414211) (21151123)
+            (41151121) (11142124) (31142122) (11151214) (31151212) (21133123) (41133121)
+            (21142213) (41142211) (11124124) (31124122) (11133214) (31133212) (21115123)
+            (41115121) (21124213) (41124211) (11115214) (31115212) (22151122) (11251123)
+            (31251121) (12142123) (32142121) (12151213) (32151211) (21251212) (22133122)
+            (11233123) (22142212) (11242213) (31242211) (12124123) (32124121) (12133213)
+            (32133211) (21233212) (22115122) (11215123) (22124212) (11224213) (31224211)
+            (12115213) (32115211) (21215212) (23151121) (12251122) (13142122) (13151212)
+            (11342122) (22251211) (23133121) (12233122) (23142211) (12242212) (21342211)
+            (13124122) (13133212) (11324122) (22233211) (11333212) (23115121) (12215122)
+            (23124211) (12224212) (21324211) (13115212) (22215211) (11315212) (13251121)
+            (14142121) (14151211) (12342121) (13233121) (13242211) (11433121) (14124121)
+            (14133211) (12324121) (12333211) (13215121) (13224211) (11415121) (11424211)
+            (14115211) (12315211) (21161122) (11152123) (31152121) (11161213) (31161211)
+            (21143122) (21152212) (11134123) (31134121) (11143213) (31143211) (21125122)
+            (21134212) (11116123) (31116121) (11125213) (31125211) (22161121) (12152122)
+            (12161212) (22143121) (11243122) (22152211) (11252212) (12134122) (12143212)
+            (21243211) (22125121) (11225122) (22134211) (11234212) (12116122) (12125212)
+            (21225211) (13152121) (13161211) (12243121) (12252211) (13134121) (13143211)
+            (11334121) (11343211) (12225121) (12234211) (13116121) (13125211) (11316121)
+            (11325211) (21111226) (41111224) (61111222) (31111315) (51111313) (21211135)
+            (41211133) (61211131) (22111225) (42111223) (11211226) (31211224) (51211222)
+            (12111316) (32111314) (52111312) (21211315) (41211313) (61211311) (22211134)
+            (42211132) (11311135) (31311133) (51311131) (23111224) (43111222) (12211225)
+            (32211223) (52211221) (21311224) (41311222) (13111315) (33111313) (22211314)
+            (42211312) (11311315) (31311313) (51311311) (23211133) (43211131) (12311134)
+            (32311132) (21411133) (41411131) (24111223) (13211224) (33211222) (22311223)
+            (42311221) (11411224) (31411222) (14111314) (34111312) (23211313) (43211311)
+            (12311314) (32311312) (21411313) (41411311) (24211132) (13311133) (33311131)
+            (22411132) (11511133) (31511131) (25111222) (14211223) (34211221) (23311222)
+            (12411223) (32411221) (21511222) (15111313) (24211312) (13311313) (33311311)
+            (22411312) (11511313) (31511311) (25211131) (14311132) (23411131) (12511132)
+            (21611131) (15211222) (24311221) (13411222) (22511221) (11611222) (16111312)
+            (25211311) (14311312) (23411311) (12511312) (21611311) (31121134) (51121132)
+            (21112135) (41112133) (61112131) (21121225) (41121223) (61121221) (11112226)
+            (31112224) (51112222) (11121316) (31121314) (51121312) (21112315) (41112313)
+            (61112311) (12121135) (32121133) (52121131) (21221134) (41221132) (22112134)
+            (42112132) (11212135) (22121224) (42121222) (11221225) (31221223) (51221221)
+            (12112225) (32112223) (52112221) (12121315) (32121313) (52121311) (21221314)
+            (41221312) (22112314) (42112312) (11212315) (31212313) (51212311) (13121134)
+            (33121132) (22221133) (42221131) (11321134) (31321132) (23112133) (43112131)
+            (12212134) (23121223) (43121221) (12221224) (32221222) (21321223) (41321221)
+            (13112224) (33112222) (13121314) (33121312) (11312224) (22221313) (42221311)
+            (11321314) (31321312) (23112313) (43112311) (12212314) (32212312) (21312313)
+            (41312311) (14121133) (34121131) (23221132) (12321133) (32321131) (21421132)
+            (24112132) (13212133) (24121222) (13221223) (33221221) (11412133) (22321222)
+            (11421223) (31421221) (14112223) (34112221) (14121313) (34121311) (12312223)
+            (23221312) (12321313) (32321311) (21421312) (24112312) (13212313) (33212311)
+            (22312312) (11412313) (31412311) (15121132) (24221131) (13321132) (22421131)
+        ] [  % Odd parity
+            (22121116) (42121114) (31221115) (51221113) (32112115) (52112113) (21212116)
+            (41212114) (61212112) (23121115) (43121113) (12221116) (32221114) (52221112)
+            (21321115) (41321113) (61321111) (13112116) (33112114) (22212115) (42212113)
+            (11312116) (31312114) (51312112) (24121114) (13221115) (33221113) (22321114)
+            (42321112) (11421115) (31421113) (51421111) (14112115) (34112113) (23212114)
+            (43212112) (12312115) (32312113) (52312111) (21412114) (41412112) (25121113)
+            (14221114) (34221112) (23321113) (43321111) (12421114) (32421112) (21521113)
+            (41521111) (15112114) (24212113) (13312114) (33312112) (22412113) (42412111)
+            (11512114) (31512112) (15221113) (24321112) (13421113) (33421111) (22521112)
+            (16112113) (25212112) (14312113) (34312111) (23412112) (12512113) (32512111)
+            (21612112) (21131116) (41131114) (61131112) (31122115) (51122113) (21113116)
+            (41113114) (61113112) (22131115) (42131113) (11231116) (31231114) (51231112)
+            (12122116) (32122114) (52122112) (21222115) (41222113) (61222111) (22113115)
+            (42113113) (11213116) (31213114) (51213112) (23131114) (43131112) (12231115)
+            (32231113) (52231111) (21331114) (41331112) (13122115) (33122113) (22222114)
+            (42222112) (11322115) (31322113) (51322111) (23113114) (43113112) (12213115)
+            (32213113) (52213111) (21313114) (41313112) (24131113) (13231114) (33231112)
+            (22331113) (42331111) (11431114) (31431112) (14122114) (34122112) (23222113)
+            (43222111) (12322114) (32322112) (21422113) (41422111) (24113113) (13213114)
+            (33213112) (22313113) (42313111) (11413114) (31413112) (25131112) (14231113)
+            (34231111) (23331112) (12431113) (32431111) (15122113) (24222112) (13322113)
+            (33322111) (22422112) (11522113) (31522111) (25113112) (14213113) (34213111)
+            (23313112) (12413113) (32413111) (21513112) (15231112) (24331111) (13431112)
+            (16122112) (25222111) (14322112) (23422111) (12522112) (15213112) (24313111)
+            (13413112) (22513111) (11613112) (21141115) (41141113) (61141111) (11132116)
+            (31132114) (51132112) (21123115) (41123113) (61123111) (11114116) (31114114)
+            (51114112) (22141114) (42141112) (11241115) (31241113) (51241111) (12132115)
+            (32132113) (52132111) (21232114) (41232112) (22123114) (42123112) (11223115)
+            (31223113) (51223111) (12114115) (32114113) (52114111) (21214114) (41214112)
+            (23141113) (43141111) (12241114) (32241112) (21341113) (41341111) (13132114)
+            (33132112) (22232113) (42232111) (11332114) (31332112) (23123113) (43123111)
+            (12223114) (32223112) (21323113) (41323111) (13114114) (33114112) (22214113)
+            (42214111) (11314114) (31314112) (24141112) (13241113) (33241111) (22341112)
+            (14132113) (34132111) (23232112) (12332113) (32332111) (21432112) (24123112)
+            (13223113) (33223111) (22323112) (11423113) (31423111) (14114113) (34114111)
+            (23214112) (12314113) (32314111) (21414112) (25141111) (14241112) (23341111)
+            (15132112) (24232111) (13332112) (22432111) (25123111) (14223112) (23323111)
+            (12423112) (21523111) (15114112) (24214111) (13314112) (22414111) (11514112)
+            (15241111) (16132111) (14332111) (15223111) (13423111) (16114111) (14314111)
+            (12514111) (21151114) (41151112) (11142115) (31142113) (51142111) (21133114)
+            (41133112) (11124115) (31124113) (51124111) (21115114) (41115112) (22151113)
+            (42151111) (11251114) (31251112) (12142114) (32142112) (21242113) (41242111)
+            (22133113) (42133111) (11233114) (31233112) (12124114) (32124112) (21224113)
+            (41224111) (22115113) (42115111) (11215114) (31215112) (23151112) (12251113)
+            (32251111) (13142113) (33142111) (22242112) (11342113) (31342111) (23133112)
+            (12233113) (32233111) (21333112) (13124113) (33124111) (22224112) (11324113)
+            (31324111) (23115112) (12215113) (32215111) (21315112) (24151111) (13251112)
+            (14142112) (23242111) (12342112) (24133111) (13233112) (22333111) (11433112)
+            (14124112) (23224111) (12324112) (21424111) (24115111) (13215112) (22315111)
+            (11415112) (14251111) (15142111) (13342111) (14233111) (12433111) (15124111)
+            (13324111) (11524111) (14215111) (12415111) (21161113) (41161111) (11152114)
+            (31152112) (21143113) (41143111) (11134114) (31134112) (21125113) (41125111)
+            (11116114) (31116112) (22161112) (12152113) (32152111) (21252112) (22143112)
+            (11243113) (31243111) (12134113) (32134111) (21234112) (22125112) (11225113)
+            (31225111) (12116113) (32116111) (21216112) (23161111) (13152112) (22252111)
+            (23143111) (12243112) (21343111) (13134112) (22234111) (11334112) (23125111)
+            (12225112) (21325111) (13116112) (22216111) (11316112) (14152111) (13243111)
+            (14134111) (12334111) (13225111) (11425111) (14116111) (12316111) (41111215)
+            (61111213) (21211126) (41211124) (61211122) (22111216) (42111214) (31211215)
+            (51211213) (22211125) (42211123) (11311126) (31311124) (51311122) (23111215)
+            (43111213) (12211216) (32211214) (52211212) (21311215) (41311213) (61311211)
+            (23211124) (43211122) (12311125) (32311123) (52311121) (21411124) (41411122)
+            (24111214) (13211215) (33211213) (22311214) (42311212) (11411215) (31411213)
+            (51411211) (24211123) (13311124) (33311122) (22411123) (42411121) (11511124)
+            (31511122) (25111213) (14211214) (34211212) (23311213) (43311211) (12411214)
+            (32411212) (21511213) (41511211) (25211122) (14311123) (34311121) (23411122)
+            (12511123) (32511121) (21611122) (15211213) (24311212) (13411213) (33411211)
+            (22511212) (11611213) (31611211) (31121125) (51121123) (21112126) (41112124)
+            (61112122) (21121216) (41121214) (61121212) (31112215) (51112213) (12121126)
+            (32121124) (52121122) (21221125) (41221123) (61221121) (22112125) (42112123)
+            (11212126) (22121215) (42121213) (11221216) (31221214) (51221212) (12112216)
+            (32112214) (52112212) (21212215) (41212213) (61212211) (13121125) (33121123)
+            (22221124) (42221122) (11321125) (31321123) (51321121) (23112124) (43112122)
+            (12212125) (23121214) (43121212) (12221215) (32221213) (52221211) (21321214)
+            (41321212) (13112215) (33112213) (22212214) (42212212) (11312215) (31312213)
+            (51312211) (14121124) (34121122) (23221123) (43221121) (12321124) (32321122)
+            (21421123) (41421121) (24112123) (13212124) (24121213) (13221214) (33221212)
+            (11412124) (22321213) (42321211) (11421214) (31421212) (14112214) (34112212)
+            (23212213) (43212211) (12312214) (32312212) (21412213) (41412211) (15121123)
+            (24221122) (13321123) (33321121) (22421122) (11521123) (31521121) (25112122)
+            (14212123) (25121212) (14221213) (34221211) (12412123) (23321212) (12421213)
+            (32421211) (21521212) (15112213) (24212212) (13312213) (33312211) (22412212)
+            (11512213) (31512211) (16121122) (25221121) (14321122) (23421121) (12521122)
+            (15212122) (15221212) (13412122) (24321211) (13421212) (11612122) (22521211)
+            (16112212) (25212211) (14312212) (23412211) (12512212) (21612211) (11131126)
+            (31131124) (51131122) (21122125) (41122123) (61122121) (21131215) (41131213)
+            (61131211) (11113126) (31113124) (51113122) (11122216) (31122214) (51122212)
+            (21113215) (41113213) (61113211) (12131125) (32131123) (52131121) (21231124)
+            (41231122) (22122124) (42122122) (11222125) (22131214) (42131212) (11231215)
+            (31231213) (51231211) (12113125) (32113123) (52113121) (12122215) (32122213)
+            (52122211) (21222214) (41222212) (22113214) (42113212) (11213215) (31213213)
+            (51213211) (13131124) (33131122) (22231123) (42231121) (11331124) (31331122)
+            (23122123) (43122121) (12222124) (23131213) (43131211) (12231214) (32231212)
+            (21331213) (41331211) (13113124) (33113122) (13122214) (33122212) (11313124)
+            (22222213) (42222211) (11322214) (31322212) (23113213) (43113211) (12213214)
+            (32213212) (21313213) (41313211) (14131123) (34131121) (23231122) (12331123)
+            (32331121) (21431122) (24122122) (13222123) (24131212) (13231213) (33231211)
+            (11422123) (22331212) (11431213) (31431211) (14113123) (34113121) (14122213)
+            (34122211) (12313123) (23222212) (12322213) (32322211) (21422212) (24113212)
+            (13213213) (33213211) (22313212) (11413213) (31413211) (15131122) (24231121)
+            (13331122) (22431121) (25122121) (14222122) (25131211) (14231212) (12422122)
+            (23331211) (12431212) (15113122) (15122212) (13313122) (24222211) (13322212)
+            (11513122) (22422211) (11522212) (25113211) (14213212) (23313211) (12413212)
+            (21513211) (16131121) (14331121) (15222121) (15231211) (13422121) (13431211)
+            (16113121) (16122211) (14313121) (14322211) (12513121) (12522211) (15213211)
+            (13413211) (11613211) (11141125) (31141123) (51141121) (21132124) (41132122)
+            (21141214) (41141212) (11123125) (31123123) (51123121) (11132215) (31132213)
+            (51132211) (21114124) (41114122) (21123214) (41123212) (11114215) (31114213)
+            (51114211) (12141124) (32141122) (21241123) (41241121) (22132123) (42132121)
+            (11232124) (22141213) (42141211) (11241214) (31241212) (12123124) (32123122)
+            (12132214) (32132212) (21232213) (41232211) (22114123) (42114121) (11214124)
+            (22123213) (42123211) (11223214) (31223212) (12114214) (32114212) (21214213)
+            (41214211) (13141123) (33141121) (22241122) (11341123) (31341121) (23132122)
+            (12232123) (23141212) (12241213) (32241211) (21341212) (13123123) (33123121)
+            (13132213) (33132211) (11323123) (22232212) (11332213) (31332211) (23114122)
+            (12214123) (23123212) (12223213) (32223211) (21323212) (13114213) (33114211)
+            (22214212) (11314213) (31314211) (14141122) (23241121) (12341122) (24132121)
+            (13232122) (24141211) (13241212) (11432122) (22341211) (14123122) (14132212)
+            (12323122) (23232211) (12332212) (21432211) (24114121) (13214122) (24123211)
+            (13223212) (11414122) (22323211) (11423212) (14114212) (23214211) (12314212)
+            (21414211) (15141121) (13341121) (14232121) (14241211) (12432121) (15123121)
+            (15132211) (13323121) (13332211) (11523121) (14214121) (14223211) (12414121)
+            (12423211) (15114211) (13314211) (11514211) (11151124) (31151122) (21142123)
+            (41142121) (21151213) (41151211) (11133124) (31133122) (11142214) (31142212)
+            (21124123) (41124121) (21133213) (41133211) (11115124) (31115122) (11124214)
+            (31124212) (21115213) (41115211) (12151123) (32151121) (21251122) (22142122)
+            (11242123) (22151212) (11251213) (31251211) (12133123) (32133121) (12142213)
+            (32142211) (21242212) (22124122) (11224123) (22133212) (11233213) (31233211)
+            (12115123) (32115121) (12124213) (32124211) (21224212) (22115212) (11215213)
+            (31215211) (13151122) (22251121) (23142121) (12242122) (23151211) (12251212)
+            (13133122) (13142212) (11333122) (22242211) (11342212) (23124121) (12224122)
+            (23133211) (12233212) (21333211) (13115122) (13124212) (11315122) (22224211)
+            (11324212) (23115211) (12215212) (21315211) (14151121) (13242121) (13251211)
+            (14133121) (14142211) (12333121) (12342211) (13224121) (13233211) (11424121)
+            (11433211) (14115121) (14124211) (12315121) (12324211) (13215211) (11415211)
+            (11161123) (31161121) (21152122) (21161212) (11143123) (31143121) (11152213)
+            (31152211) (21134122) (21143212) (11125123) (31125121) (11134213) (31134211)
+            (21116122) (21125212) (12161122) (22152121) (11252122) (22161211) (12143122)
+            (12152212) (21252211) (22134121) (11234122) (22143211) (11243212) (12125122)
+            (12134212) (21234211) (22116121) (11216122) (22125211) (11225212) (13161121)
+            (12252121) (13143121) (13152211) (11343121) (12234121) (12243211) (13125121)
+            (13134211) (11325121) (11334211) (12216121) (12225211) (31111225) (51111223)
+            (21111316) (41111314) (61111312) (31211134) (51211132) (12111226) (32111224)
+            (52111222) (21211225) (41211223) (61211221) (22111315) (42111313) (11211316)
+            (31211314) (51211312) (12211135) (32211133) (52211131) (21311134) (41311132)
+            (13111225) (33111223) (22211224) (42211222) (11311225) (31311223) (51311221)
+            (23111314) (43111312) (12211315) (32211313) (52211311) (21311314) (41311312)
+            (13211134) (33211132) (22311133) (42311131) (11411134) (31411132) (14111224)
+            (34111222) (23211223) (43211221) (12311224) (32311222) (21411223) (41411221)
+            (24111313) (13211314) (33211312) (22311313) (42311311) (11411314) (31411312)
+            (14211133) (34211131) (23311132) (12411133) (32411131) (21511132) (15111223)
+            (24211222) (13311223) (33311221) (22411222) (11511223) (31511221) (25111312)
+            (14211313) (34211311) (23311312) (12411313) (32411311) (21511312) (15211132)
+            (24311131) (13411132) (22511131) (11611132) (16111222) (25211221) (14311222)
+            (23411221) (12511222) (21611221) (15211312) (24311311) (13411312) (22511311)
+            (11611312) (21121135) (41121133) (61121131) (11112136) (31112134) (51112132)
+            (11121226) (31121224) (51121222) (21112225) (41112223) (61112221) (21121315)
+            (41121313) (61121311) (11112316) (31112314) (51112312) (22121134) (42121132)
+            (11221135) (31221133) (51221131) (12112135) (32112133) (52112131) (12121225)
+            (32121223) (52121221) (21221224) (41221222) (22112224) (42112222) (11212225)
+            (22121314) (42121312) (11221315) (31221313) (51221311) (12112315) (32112313)
+            (52112311) (21212314) (41212312) (23121133) (43121131) (12221134) (32221132)
+            (21321133) (41321131) (13112134) (33112132) (13121224) (33121222) (11312134)
+            (22221223) (42221221) (11321224) (31321222) (23112223) (43112221) (12212224)
+            (23121313) (43121311) (12221314) (32221312) (21321313) (41321311) (13112314)
+            (33112312) (22212313) (42212311) (11312314) (31312312) (24121132) (13221133)
+            (33221131) (22321132) (11421133) (31421131) (14112133) (34112131) (14121223)
+            (34121221) (12312133) (23221222) (12321223) (32321221) (21421222) (24112222)
+            (13212223) (24121312) (13221313) (33221311) (11412223) (22321312) (11421313)
+            (31421311) (14112313) (34112311) (23212312) (12312313) (32312311) (21412312)
+            (25121131) (14221132) (23321131) (12421132) (21521131) (15112132) (15121222)
+            (13312132) (24221221) (13321222) (11512132) (22421221) (11521222) (25112221)
+            (14212222) (25121311) (14221312) (12412222) (23321311) (12421312) (21521311)
+            (15112312) (24212311) (13312312) (22412311) (11512312) (15221131) (13421131)
+            (16112131) (16121221) (14312131) (14321221) (12512131) (12521221) (15212221)
+            (15221311) (13412221) (13421311) (11612221) (16112311) (14312311) (12512311)
+            (21131134) (41131132) (11122135) (31122133) (51122131) (11131225) (31131223)
+            (51131221) (21113134) (41113132) (21122224) (41122222) (21131314) (41131312)
+            (11113225) (31113223) (51113221) (11122315) (31122313) (51122311) (21113314)
+            (41113312) (22131133) (42131131) (11231134) (31231132) (12122134) (32122132)
+            (12131224) (32131222) (21231223) (41231221) (22113133) (42113131) (11213134)
+            (22122223) (42122221) (11222224) (22131313) (42131311) (11231314) (31231312)
+            (12113224) (32113222) (12122314) (32122312) (21222313) (41222311) (22113313)
+            (42113311) (11213314) (31213312) (23131132) (12231133) (32231131) (21331132)
+            (13122133) (33122131) (13131223) (33131221) (11322133) (22231222) (11331223)
+            (31331221) (23113132) (12213133) (23122222) (12222223) (23131312) (12231313)
+            (32231311) (21331312) (13113223) (33113221) (13122313) (33122311) (11313223)
+            (22222312) (11322313) (31322311) (23113312) (12213313) (32213311) (21313312)
+            (24131131) (13231132) (22331131) (11431132) (14122132) (14131222) (12322132)
+            (23231221) (12331222) (21431221) (24113131) (13213132) (24122221) (13222222)
+            (24131311) (11413132) (13231312) (11422222) (22331311) (11431312) (14113222)
+            (14122312) (12313222) (23222311) (12322312) (21422311) (24113311) (13213312)
+            (22313311) (11413312) (14231131) (12431131) (15122131) (15131221) (13322131)
+            (13331221) (11522131) (14213131) (14222221) (12413131) (14231311) (12422221)
+            (12431311) (15113221) (15122311) (13313221) (13322311) (11513221) (11522311)
+            (14213311) (12413311) (21141133) (41141131) (11132134) (31132132) (11141224)
+            (31141222) (21123133) (41123131) (21132223) (41132221) (21141313) (41141311)
+            (11114134) (31114132) (11123224) (31123222) (11132314) (31132312) (21114223)
+            (41114221) (21123313) (41123311) (11114314) (31114312) (22141132) (11241133)
+            (31241131) (12132133) (32132131) (12141223) (32141221) (21241222) (22123132)
+            (11223133) (22132222) (11232223) (22141312) (11241313) (31241311) (12114133)
+            (32114131) (12123223) (32123221) (12132313) (32132311) (21232312) (22114222)
+            (11214223) (22123312) (11223313) (31223311) (12114313) (32114311) (21214312)
+            (23141131) (12241132) (21341131) (13132132) (13141222) (11332132) (22241221)
+            (11341222) (23123131) (12223132) (23132221) (12232222) (23141311) (12241312)
+            (21341311) (13114132) (13123222) (11314132) (13132312) (11323222) (22232311)
+            (11332312) (23114221) (12214222) (23123311) (12223312) (21323311) (13114312)
+            (22214311) (11314312) (13241131) (14132131) (14141221) (12332131) (12341221)
+            (13223131) (13232221) (11423131) (13241311) (11432221) (14114131) (14123221)
+            (12314131) (14132311) (12323221) (12332311) (13214221) (13223311) (11414221)
+            (11423311) (14114311) (12314311) (21151132) (11142133) (31142131) (11151223)
+            (31151221) (21133132) (21142222) (21151312) (11124133) (31124131) (11133223)
+            (31133221) (11142313) (31142311) (21115132) (21124222) (21133312) (11115223)
+            (31115221) (11124313) (31124311) (22151131) (11251132) (12142132) (12151222)
+            (21251221) (22133131) (11233132) (22142221) (11242222) (22151311) (11251312)
+            (12124132) (12133222) (12142312) (21242311) (22115131) (11215132) (22124221)
+            (11224222) (22133311) (11233312) (12115222) (12124312) (21224311) (12251131)
+            (13142131) (13151221) (11342131) (12233131) (12242221) (12251311) (13124131)
+            (13133221) (11324131) (13142311) (11333221) (11342311) (12215131) (12224221)
+            (12233311) (13115221) (13124311) (11315221) (11324311) (21161131) (11152132)
+            (11161222) (21143131) (21152221) (21161311) (11134132) (11143222) (11152312)
+            (21125131) (21134221) (21143311) (11116132) (11125222) (11134312) (12152131)
+            (12161221) (11243131) (11252221) (12134131) (12143221) (12152311) (11225131)
+            (11234221) (11243311) (12116131) (12125221) (12134311) (21111235) (41111233)
+            (61111231) (11111326) (31111324) (51111322) (21111415) (41111413) (61111411)
+            (21211144) (41211142) (22111234) (42111232) (11211235) (31211233) (51211231)
+            (12111325) (32111323) (52111321) (21211324) (41211322) (22111414) (42111412)
+            (11211415) (31211413) (51211411) (22211143) (42211141) (11311144) (31311142)
+            (23111233) (43111231) (12211234) (32211232) (21311233) (41311231) (13111324)
+            (33111322) (22211323) (42211321) (11311324) (31311322) (23111413) (43111411)
+            (12211414) (32211412) (21311413) (41311411) (23211142) (12311143) (32311141)
+            (21411142) (24111232) (13211233) (33211231) (22311232) (11411233) (31411231)
+            (14111323) (34111321) (23211322) (12311323) (32311321) (21411322) (24111412)
+            (13211413) (33211411) (22311412) (11411413) (31411411) (24211141) (13311142)
+            (22411141) (11511142) (25111231) (14211232) (23311231) (12411232) (21511231)
+            (15111322) (24211321) (13311322) (22411321) (11511322) (25111411) (14211412)
+            (23311411) (12411412) (21511411) (14311141) (12511141) (15211231) (13411231)
+            (11611231) (16111321) (14311321) (12511321) (15211411) (13411411) (11611411)
+            (31121143) (51121141) (21112144) (41112142) (21121234) (41121232) (11112235)
+            (31112233) (51112231) (11121325) (31121323) (51121321) (21112324) (41112322)
+            (21121414) (41121412) (11112415) (31112413) (51112411) (12121144) (32121142)
+            (21221143) (41221141) (22112143) (42112141) (11212144) (22121233) (42121231)
+            (11221234) (31221232) (12112234) (32112232) (12121324) (32121322) (21221323)
+            (41221321) (22112323) (42112321) (11212324) (22121413) (42121411) (11221414)
+            (31221412) (12112414) (32112412) (21212413) (41212411) (13121143) (33121141)
+            (22221142) (11321143) (31321141) (23112142) (12212143) (23121232) (12221233)
+            (32221231) (21321232) (13112233) (33112231) (13121323) (33121321) (11312233)
+            (22221322) (11321323) (31321321) (23112322) (12212323) (23121412) (12221413)
+            (32221411) (21321412) (13112413) (33112411) (22212412) (11312413) (31312411)
+            (14121142) (23221141) (12321142) (21421141) (24112141) (13212142) (24121231)
+            (13221232) (11412142) (22321231) (11421232) (14112232) (14121322) (12312232)
+            (23221321) (12321322) (21421321) (24112321) (13212322) (24121411) (13221412)
+            (11412322) (22321411) (11421412) (14112412) (23212411) (12312412) (21412411)
+            (15121141) (13321141) (11521141) (14212141) (14221231) (12412141) (12421231)
+            (15112231) (15121321) (13312231) (13321321) (11512231) (11521321) (14212321)
+            (14221411) (12412321) (12421411) (15112411) (13312411) (11512411) (11131144)
+            (31131142) (21122143) (41122141) (21131233) (41131231) (11113144) (31113142)
+            (11122234) (31122232) (11131324) (31131322) (21113233) (41113231) (21122323)
+            (41122321) (21131413) (41131411) (11113324) (31113322) (11122414) (31122412)
+            (21113413) (41113411) (12131143) (32131141) (21231142) (22122142) (11222143)
+            (22131232) (11231233) (31231231) (12113143) (32113141) (12122233) (32122231)
+            (12131323) (32131321) (21231322) (22113232) (11213233) (22122322) (11222323)
+            (22131412) (11231413) (31231411) (12113323) (32113321) (12122413) (32122411)
+            (21222412) (22113412) (11213413) (31213411) (13131142) (22231141) (11331142)
+            (23122141) (12222142) (23131231) (12231232) (21331231) (13113142) (13122232)
+            (11313142) (13131322) (11322232) (22231321) (11331322) (23113231) (12213232)
+            (23122321) (12222322) (23131411) (12231412) (21331411) (13113322) (13122412)
+            (11313322) (22222411) (11322412) (23113411) (12213412) (21313411) (14131141)
+            (12331141) (13222141) (13231231) (11422141) (11431231) (14113141) (14122231)
+            (12313141) (14131321) (12322231) (12331321) (13213231) (13222321) (11413231)
+            (13231411) (11422321) (11431411) (14113321) (14122411) (12313321) (12322411)
+            (13213411) (11413411) (11141143) (31141141) (21132142) (21141232) (11123143)
+            (31123141) (11132233) (31132231) (11141323) (31141321) (21114142) (21123232)
+            (21132322) (21141412) (11114233) (31114231) (11123323) (31123321) (11132413)
+            (31132411) (21114322) (21123412) (12141142) (21241141) (22132141) (11232142)
+            (22141231) (11241232) (12123142) (12132232) (12141322) (21241321) (22114141)
+            (11214142) (22123231) (11223232) (22132321) (11232322) (22141411) (11241412)
+            (12114232) (12123322) (12132412) (21232411) (22114321) (11214322) (22123411)
+            (11223412) (13141141) (11341141) (12232141) (12241231) (13123141) (13132231)
+            (11323141) (13141321) (11332231) (11341321) (12214141) (12223231) (12232321)
+            (12241411) (13114231) (13123321) (11314231) (13132411) (11323321) (11332411)
+            (12214321) (12223411) (11151142) (21142141) (21151231) (11133142) (11142232)
+            (11151322) (21124141) (21133231) (21142321) (21151411) (11115142) (11124232)
+            (11133322) (11142412) (21115231) (21124321) (21133411) (12151141) (11242141)
+            (11251231) (12133141) (12142231) (12151321) (11224141) (11233231) (11242321)
+            (11251411) (12115141) (12124231) (12133321) (12142411) (11215231) (11224321)
+            (11233411) (11161141) (11143141) (11152231) (11161321) (11125141) (11134231)
+            (11143321) (11152411) (11111245) (31111243) (51111241) (21111334) (41111332)
+            (11111425) (31111423) (51111421) (21111514) (41111512) (31211152) (12111244)
+            (32111242) (21211243) (41211241) (22111333) (42111331) (11211334) (31211332)
+            (12111424) (32111422) (21211423) (41211421) (22111513) (42111511) (11211514)
+            (31211512) (12211153) (32211151) (21311152) (13111243) (33111241) (22211242)
+            (11311243) (31311241) (23111332) (12211333) (32211331) (21311332) (13111423)
+            (33111421) (22211422) (11311423) (31311421) (23111512) (12211513) (32211511)
+            (21311512) (13211152) (22311151) (11411152) (14111242) (23211241) (12311242)
+            (21411241) (24111331) (13211332) (22311331) (11411332) (14111422) (23211421)
+            (12311422) (21411421) (24111511) (13211512) (22311511) (11411512) (14211151)
+            (12411151) (15111241) (13311241) (11511241) (14211331) (12411331) (15111421)
+            (13311421) (11511421) (14211511) (12411511) (21121153) (41121151) (11112154)
+            (31112152) (11121244) (31121242) (21112243) (41112241) (21121333) (41121331)
+            (11112334) (31112332) (11121424) (31121422) (21112423) (41112421) (21121513)
+            (41121511) (11112514) (31112512) (22121152) (11221153) (31221151) (12112153)
+            (32112151) (12121243) (32121241) (21221242) (22112242) (11212243) (22121332)
+            (11221333) (31221331) (12112333) (32112331) (12121423) (32121421) (21221422)
+            (22112422) (11212423) (22121512) (11221513) (31221511) (12112513) (32112511)
+            (21212512) (23121151) (12221152) (21321151) (13112152) (13121242) (11312152)
+            (22221241) (11321242) (23112241) (12212242) (23121331) (12221332) (21321331)
+            (13112332) (13121422) (11312332) (22221421) (11321422) (23112421) (12212422)
+            (23121511) (12221512) (21321511) (13112512) (22212511) (11312512) (13221151)
+            (11421151) (14112151) (14121241) (12312151) (12321241) (13212241) (13221331)
+            (11412241) (11421331) (14112331) (14121421) (12312331) (12321421) (13212421)
+            (13221511) (11412421) (11421511) (14112511) (12312511) (21131152) (11122153)
+            (31122151) (11131243) (31131241) (21113152) (21122242) (21131332) (11113243)
+            (31113241) (11122333) (31122331) (11131423) (31131421) (21113332) (21122422)
+            (21131512) (11113423) (31113421) (11122513) (31122511) (22131151) (11231152)
+            (12122152) (12131242) (21231241) (22113151) (11213152) (22122241) (11222242)
+            (22131331) (11231332) (12113242) (12122332) (12131422) (21231421) (22113331)
+            (11213332) (22122421) (11222422) (22131511) (11231512) (12113422) (12122512)
+            (21222511) (12231151) (13122151) (13131241) (11322151) (11331241) (12213151)
+            (12222241) (12231331) (13113241) (13122331) (11313241) (13131421) (11322331)
+            (11331421) (12213331) (12222421) (12231511) (13113421) (13122511) (11313421)
+            (11322511) (21141151) (11132152) (11141242) (21123151) (21132241) (21141331)
+            (11114152) (11123242) (11132332) (11141422) (21114241) (21123331) (21132421)
+            (21141511) (11114332) (11123422) (11132512) (11241151) (12132151) (12141241)
+            (11223151) (11232241) (11241331) (12114151) (12123241) (12132331) (12141421)
+            (11214241) (11223331) (11232421) (11241511) (12114331) (12123421) (12132511)
+            (11142151) (11151241) (11124151) (11133241) (11142331) (11151421) (11115241)
+            (11124331) (11133421) (11142511) (21111253) (41111251) (11111344) (31111342)
+            (21111433) (41111431) (11111524) (31111522) (21111613) (41111611) (21211162)
+            (22111252) (11211253) (31211251) (12111343) (32111341) (21211342) (22111432)
+            (11211433) (31211431) (12111523) (32111521) (21211522) (22111612) (11211613)
+            (31211611) (22211161) (11311162) (23111251) (12211252) (21311251) (13111342)
+            (22211341) (11311342) (23111431) (12211432) (21311431) (13111522) (22211521)
+            (11311522) (23111611) (12211612) (21311611) (12311161) (13211251) (11411251)
+            (14111341) (12311341) (13211431) (11411431) (14111521) (12311521) (13211611)
+            (11411611) (31121161) (21112162) (21121252) (11112253) (31112251) (11121343)
+            (31121341) (21112342) (21121432) (11112433) (31112431) (11121523) (31121521)
+            (21112522) (21121612) (12121162) (21221161) (22112161) (11212162) (22121251)
+            (11221252) (12112252) (12121342) (21221341) (22112341) (11212342) (22121431)
+            (11221432) (12112432) (12121522) (21221521) (22112521) (11212522) (22121611)
+            (11221612) (13121161) (11321161) (12212161) (12221251) (13112251) (13121341)
+            (11312251) (11321341) (12212341) (12221431) (13112431) (13121521) (11312431)
+            (11321521) (12212521) (12221611) (11131162) (21122161) (21131251) (11113162)
+        ]
+    ] def
+
+    /parity [
+        (1001) (0101) (1100) (0011) (1010) (0110) (1111) (0000)
+    ] def
+
+    % Derive the bits for each row
+    /rowbits r array def
+    0 1 r 1 sub {
+        /i exch def
+        /p i r 1 sub ne {parity i get} {(0000)} ifelse def
+        /ccrow ccs i 8 mul 8 getinterval def
+        /scrow [
+            0 2 7 {ccrow exch 2 getinterval aload pop exch 49 mul add} for
+        ] def
+        /sbs [
+            10 1 1
+            0 1 3 {
+                /j exch def
+                patterns p j get 48 sub get scrow j get get {48 sub} forall
+            } for
+            4 1
+        ] def
+        mark
+        1 sbs {1 index 0 eq {{1}} {{0}} ifelse repeat} forall
+        counttomark 1 sub array astore exch pop exch pop
+        rowbits i 3 -1 roll put
+    } for
+
+    % Populate the bitmap
+    /pixs [
+        81 sepheight mul {1} repeat
+        0 1 r 2 sub {
+            /i exch def
+            rowheight {rowbits i get aload pop} repeat
+            sepheight {10 {0} repeat 70 {1} repeat 0} repeat
+        } for
+        rowheight {rowbits r 1 sub get aload pop} repeat
+        81 sepheight mul {1} repeat
+    ] def
+
+    % Return the arguments
+    <<
+    /ren //renmatrix
+    /pixs pixs
+    /pixx 81
+    /pixy pixs length 81 idiv
+    /height pixs length 81 idiv 72 div
+    /width 81 72 div
+    /opt options
+    >>
+
+    dontdraw not //renmatrix if
+
+    end
+
+} bind def
+/code49 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER code49--
+
 % --BEGIN ENCODER channelcode--
 % --DESC: Channel Code
 % --EXAM: 3493
@@ -8713,6 +11071,17 @@
     /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
 
     barcode (fima) eq {
         /sbs [2.25 2.25 2.25 11.25 2.25 11.25 2.25 2.25 2.25] def
@@ -9460,8 +11829,8 @@
     /i 0 def
     { % loop
         /m metrics i get def
-        /c    m 0 get def        % Rows in symbol
-        /r    m 1 get def        % Columns in symbol
+        /c    m 0 get def        % Columns in symbol
+        /r    m 1 get def        % Rows in symbol
         /k    m 2 get def        % Error correction codewords
         /rapl m 3 get def        % Left row address pattern
         /rapc m 4 get def        % Centre row address pattern
@@ -9878,9 +12247,10 @@
     /dontdraw false def
     /columns 0 def
     /rows 0 def
-    /encoding (byte) def
+    /encoding (ascii) def
     /raw false def
     /parse false def
+    /parsefnc false def
 
     % Parse the input options
     options type /stringtype eq {
@@ -9934,29 +12304,44 @@
         /cws cws 0 j getinterval def
     } if
 
-    encoding (byte) eq {
-        barlen 250 lt {
-            /cws [231 barlen barcode {} forall] def
-        } {
-            /cws [231 barlen 250 idiv 249 add barlen 250 mod barcode {} forall] def
-        } ifelse 
-        1 1 cws length 1 sub {
-            /i exch def
-            i 1 add 149 mul 255 mod 1 add cws i get add
-            dup 256 ge {256 sub} if
-            cws exch i exch put
-        } for
-    } if
+    % Special function characters
+    /fn1 -1 def
 
     encoding (ascii) eq {
-        /cws barlen 2 mul array def
+        /fncvals <<
+            (FNC1) fn1
+        >> 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
+
+        /cws msglen 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 msglen eq {exit} if
+            /char msg i get def
+            char fn1 eq {  % FNC1
+                cws j 232 put
+                /i i 1 add def
+                /j j 1 add def
+            } { char 48 ge char 57 le and i msglen 1 sub lt and {
+                msg i 1 add get dup 48 ge exch 57 le and {  % Digit pair
+                    cws j msg i get 48 sub 10 mul msg i 1 add get 48 sub add 130 add put
                     /i i 2 add def
                     /j j 1 add def
                 } {  % Singular digit
@@ -9973,144 +12358,9 @@
                 cws j 1 add char 127 sub put
                 /i i 1 add def
                 /j j 2 add def
-            } ifelse } ifelse
+            } ifelse } ifelse } ifelse
         } loop
         /cws cws 0 j getinterval def
-    } if
-
-    encoding (edifact) eq {
-        /cws 1558 array def
-        /i 0 def /j 1 def /k 0 def
-        cws 0 240 put
-        { % loop
-            i barlen gt {exit} if
-            /k 0 def /v 0 def
-            { % loop until triplet is full or beyond end of data
-                k 4 eq i barlen gt or {exit} if
-                /cval (unset) def
-                i barlen lt {
-                    /char barcode i get def
-                    char 32 ge char 94 le and {
-                        /cval char 63 and def
-                    } if
-                } {  % Unlatch at end of data
-                    /cval 31 def
-                } ifelse
-                /v v cval 3 k sub 6 mul bitshift or def
-                /k k 1 add def
-                /i i 1 add def
-            } loop
-            cws j [ v -16 bitshift v -8 bitshift 255 and v 255 and ] putinterval
-            /j j 3 add def
-        } loop
-        /cws cws 0 j getinterval def
-    } if
-
-    encoding (c40) eq encoding (text) eq or encoding (x12) eq or {
-
-        /s1 0 def /s2 1 def /s3 2 def /us 30 def
-
-        encoding (c40) eq {
-            /latch 230 def
-            /charmap [
-                0 1 31  { [ exch s1 exch ]            } for  % 0-31
-                          [ 3 ]                              % 32
-                0 1 14  { [ exch s2 exch ]            } for  % 33-47
-                4 1 13  { [ exch ]                    } for  % 48-57
-                15 1 21 { [ exch s2 exch ]            } for  % 58-64
-                14 1 39 { [ exch ]                    } for  % 65-90
-                22 1 26 { [ exch s2 exch ]            } for  % 91-95
-                          [ s3 0 ]                           % 96 
-                1 1 26  { [ exch s3 exch ]            } for  % 97-122
-                27 1 31 { [ exch s3 exch ]            } for  % 123-127
-                0 1 31  { [ s2 us 4 -1 roll s1 exch ] } for  % 128-159
-                          [ s2 us 3 ]                        % 160
-                0 1 14  { [ s2 us 4 -1 roll s2 exch ] } for  % 161-175
-                4 1 13  { [ s2 us 4 -1 roll ]         } for  % 176-185
-                15 1 21 { [ s2 us 4 -1 roll s2 exch ] } for  % 186-192
-                14 1 39 { [ s2 us 4 -1 roll ]         } for  % 193-218
-                22 1 26 { [ s2 us 4 -1 roll s2 exch ] } for  % 219-223
-                          [ s2 us s3 0 ]                     % 224
-                1 1 26  { [ s2 us 4 -1 roll s3 exch ] } for  % 225-250
-                27 1 31 { [ s2 us 4 -1 roll s3 exch ] } for  % 251-255
-            ] def
-        } if
-
-        encoding (text) eq {
-            /latch 239 def
-            /charmap [
-                0 1 31  { [ exch s1 exch ]            } for  % 0-31
-                          [ 3 ]                              % 32
-                0 1 14  { [ exch s2 exch ]            } for  % 33-47
-                4 1 13  { [ exch ]                    } for  % 48-57
-                15 1 21 { [ exch s2 exch ]            } for  % 58-64
-                1 1 26  { [ exch s3 exch ]            } for  % 65-90
-                22 1 26 { [ exch s2 exch ]            } for  % 91-95
-                          [ s3 0 ]                           % 96 
-                14 1 39 { [ exch ]                    } for  % 97-122
-                27 1 31 { [ exch s3 exch ]            } for  % 123-127
-                0 1 31  { [ s2 us 4 -1 roll s1 exch ] } for  % 128-159
-                          [ s2 us 3 ]                        % 160
-                0 1 14  { [ s2 us 4 -1 roll s2 exch ] } for  % 161-175
-                4 1 13  { [ s2 us 4 -1 roll ]         } for  % 176-185
-                15 1 21 { [ s2 us 4 -1 roll s2 exch ] } for  % 186-192
-                1 1 26  { [ s2 us 4 -1 roll s3 exch ] } for  % 193-218
-                22 1 26 { [ s2 us 4 -1 roll s2 exch ] } for  % 219-223
-                          [ s2 us s3 0 ]                     % 224
-                14 1 39 { [ s2 us 4 -1 roll ]         } for  % 225-250
-                27 1 31 { [ s2 us 4 -1 roll s3 exch ] } for  % 251-255
-            ] def
-         } if
-
-         encoding (x12) eq {
-             /latch 238 def
-             /charmap [
-                 13      { [ () ]   } repeat  % 0-12
-                           [ 0 ]              % 13
-                 18      { [ () ]   } repeat  % 14-31
-                           [ 3 ]              % 32
-                 9       { [ () ]   } repeat  % 33-41
-                           [ 1 ]              % 42
-                 5       { [ () ]   } repeat  % 43-47
-                 4 1 13  { [ exch ] } for     % 48-57
-                 4       { [ () ]   } repeat  % 58-61
-                           [ 2 ]              % 62
-                 2       { [ () ]   } repeat  % 63-64
-                 14 1 39 { [ exch ] } for     % 65-90
-                 165     { [ () ]   } repeat  % 91-255 
-             ] def
-         } if
-
-         % Derive the encoded character stream
-         /encstr barlen 4 mul array def
-         /j 0 def
-         0 1 barlen 1 sub {
-             barcode exch get charmap exch get
-             dup encstr exch j exch putinterval
-             length j add /j exch def
-         } for
-         /encstr encstr 0 j getinterval def
-         /enclen j def
-
-         % Compress triples into doubles
-         /cws 1558 array def
-         /i 0 def /j 1 def /k 0 def
-         cws 0 latch put
-         { % loop
-            i enclen ge {exit} if
-            /k 0 def /v 1 def
-            { % loop until triple is full or end of data
-                k 3 eq i enclen ge or {exit} if
-                /v v encstr i get 40 2 k sub exp cvi mul add def
-                /k k 1 add def
-                /i i 1 add def
-            } loop
-            cws j [ v -8 bitshift v 255 and ] putinterval
-            /j j 2 add def
-        } loop
-        cws j 254 put
-        /cws cws 0 j 1 add getinterval def
-
     } if
 
     % Basic metrics for the each symbol
@@ -10396,8 +12646,8 @@
     /pixs pixs
     /pixx cols
     /pixy rows
-    /height rows 72 div 1.5 mul
-    /width cols 72 div 1.5 mul
+    /height rows 2 mul 72 div
+    /width cols 2 mul 72 div
     /opt options
     >>
 
@@ -10431,6 +12681,7 @@
     /format (full) def     % full or micro
     /version (unset) def
     /eclevel (unset) def   % L, M, Q or H
+    /encoding (unset) def
     /raw false def
     /parse false def
 
@@ -10466,75 +12717,293 @@
         } loop
     } if
 
-    % Force raw mode for micro format symbols
-    format (micro) eq {/raw true def} if
-
-    % Default to error correction level M
-    eclevel (unset) eq {/eclevel (M) def} if
+    /barlen barcode length def
+
+    % Default error correction level
+    eclevel (unset) eq {/eclevel format (full) eq {(M)} {(L)} ifelse def} if
 
     % Convert from input into message bitstream
-    raw {
+    raw {/encoding (raw) def} if
+    encoding (raw) eq {
         /msgbits barcode def 
-    } {  % Simple autoencoder from input to bitstream using byte mode only for full format symbols
-
-        /barlen barcode length def
-        eclevel (unset) eq {/eclevel (M) def} if
-
-        % Determine smallest symbol version to hold given amount of byte-encoded data
+    } {
+
+        % Symbol capacities
+        /fullcaps <<
+            /numeric <<
+                /L [   41    77   127   187   255   322   370   461   552   652    %  1-L - 10-L
+                      772   883  1022  1101  1250  1408  1548  1725  1903  2061    % 11-L - 20-L
+                     2232  2409  2620  2812  3057  3283  3517  3669  3909  4158    % 21-L - 30-L
+                     4417  4686  4965  5253  5529  5836  6153  6479  6743  7089 ]  % 31-L - 40-L
+                /M [   34    63   101   149   202   255   293   365   432   513    %  1-M - 10-M
+                      604   691   796   871   991  1082  1212  1346  1500  1600    % 11-M - 20-M
+                     1708  1872  2059  2188  2395  2544  2701  2857  3035  3289    % 21-M - 30-M
+                     3486  3693  3909  4134  4343  4588  4775  5039  5313  5596 ]  % 31-M - 40-M
+                /Q [   27    48    77   111   144   178   207   259   312   364    %  1-Q - 10-Q
+                      427   489   580   621   703   775   876   948  1063  1159    % 11-Q - 20-Q
+                     1224  1358  1468  1588  1718  1804  1933  2085  2181  2358    % 21-Q - 30-Q
+                     2473  2670  2805  2949  3081  3244  3417  3599  3791  3993 ]  % 31-Q - 40-Q
+                /H [   17    34    58    82   106   139   154   202   235   288    %  1-H - 10-H
+                      331   374   427   468   530   602   674   746   813   919    % 11-H - 20-H
+                      969  1056  1108  1228  1286  1425  1501  1581  1677  1782    % 21-H - 30-H
+                     1897  2022  2157  2301  2361  2524  2625  2735  2927  3057 ]  % 31-H - 40-H
+            >>
+            /alphanumeric <<
+                /L [   25    47    77   114   154   195   224   279   335   395    %  1-L - 10-L
+                      468   535   619   667   758   854   938  1046  1153  1249    % 11-L - 20-L
+                     1352  1460  1588  1704  1853  1990  2132  2223  2369  2520    % 21-L - 30-L
+                     2677  2840  3009  3183  3351  3537  3729  3927  4087  4296 ]  % 31-L - 40-L
+                /M [   20    38    61    90   122   154   178   221   262   311    %  1-M - 10-M
+                      366   419   483   528   600   656   734   816   909   970    % 11-M - 20-M
+                     1035  1134  1248  1326  1451  1542  1637  1732  1839  1994    % 21-M - 30-M
+                     2113  2238  2369  2506  2632  2780  2894  3054  3220  3391 ]  % 31-M - 40-M
+                /Q [   16    29    47    67    87   108   125   157   189   221    %  1-Q - 10-Q
+                      259   296   352   376   426   470   531   574   644   702    % 11-Q - 20-Q
+                      742   823   890   963  1041  1094  1172  1263  1322  1429    % 21-Q - 30-Q
+                     1499  1618  1700  1787  1867  1966  2071  2181  2298  2420 ]  % 31-Q - 40-Q
+                /H [   10    20    35    50    64    84    93   122   143   174    %  1-H - 10-H
+                      200   227   259   283   321   365   408   452   493   557    % 11-H - 20-H
+                      587   640   672   744   779   864   910   958  1016  1080    % 21-H - 30-H
+                     1150  1226  1307  1394  1431  1530  1591  1658  1774  1852 ]  % 31-H - 40-H
+            >>
+            /byte <<
+                /L [   17    32    53    78   106   134   154   192   230   271    %  1-L - 10-L
+                      321   367   425   458   520   586   644   718   792   858    % 11-L - 20-L
+                      929  1003  1091  1171  1273  1367  1465  1528  1628  1732    % 21-L - 30-L
+                     1840  1952  2068  2188  2303  2431  2563  2699  2809  2953 ]  % 31-L - 40-L
+                /M [   14    26    42    62    84   106   122   152   180   213    %  1-M - 10-M
+                      251   287   331   362   412   450   504   560   624   666    % 11-M - 20-M
+                      711   779   857   911   997  1059  1125  1190  1264  1370    % 21-M - 30-M
+                     1452  1538  1628  1722  1809  1911  1989  2099  2213  2331 ]  % 31-M - 40-M
+                /Q [   11    20    32    46    60    74    86   108   130   151    %  1-Q - 10-Q
+                      177   203   241   258   292   322   364   394   442   482    % 11-Q - 20-Q
+                      509   565   611   661   715   751   805   868   908   982    % 21-Q - 30-Q
+                     1030  1112  1168  1228  1283  1351  1423  1499  1579  1663 ]  % 31-Q - 40-Q
+                /H [    7    14    24    34    44    58    64    84    98   119    %  1-H - 10-H
+                      137   155   177   194   220   250   280   310   338   382    % 11-H - 20-H
+                      403   439   461   511   535   593   625   658   698   742    % 21-H - 30-H
+                      790   842   898   958   983  1051  1093  1139  1219  1273 ]  % 31-H - 40-H
+            >>
+            /kanji <<
+                /L [   10    20    32    48    65    82    95   118   141   167    %  1-L - 10-L
+                      198   226   262   282   320   361   397   442   488   528    % 11-L - 20-L
+                      572   618   672   721   784   842   902   940  1002  1066    % 21-L - 30-L
+                     1132  1201  1273  1347  1417  1496  1577  1661  1729  1817 ]  % 31-L - 40-L
+                /M [    8    16    26    38    52    65    75    93   111   131    %  1-M - 10-M
+                      155   177   204   223   254   277   310   345   384   410    % 11-M - 20-M
+                      438   480   528   561   614   652   692   732   778   843    % 21-M - 30-M
+                      894   947  1002  1060  1113  1176  1224  1292  1362  1435 ]  % 31-M - 40-M
+                /Q [    7    12    20    28    37    45    53    66    80    93    %  1-Q - 10-Q
+                      109   125   149   159   180   198   224   243   272   297    % 11-Q - 20-Q
+                      314   348   376   407   440   462   496   534   559   604    % 21-Q - 30-Q
+                      634   684   719   756   790   832   876   923   972  1024 ]  % 31-Q - 40-Q
+                /H [    4     8    15    21    27    36    39    52    60    74    %  1-H - 10-H
+                       85    96   109   120   136   154   173   191   208   235    % 11-H - 20-H
+                      248   270   284   315   330   365   385   405   430   457    % 21-H - 30-H
+                      486   518   553   590   605   647   673   701   750   784 ]  % 31-H - 40-H 
+            >> 
+        >> def 
+
+        %            M1 M2 M3 M4         M1 M2 M3 M4         M1 M2 M3 M4         M1 M2 M3 M4
+        /microcaps <<
+            /numeric <<
+                /L [  5 10 23 35 ]  /M [ -1  8 18 30 ]  /Q [ -1 -1 -1 21 ]  /H [ -1 -1 -1 -1 ]
+            >>
+            /alphanumeric <<
+                /L [ -1  6 14 21 ]  /M [ -1  5 11 18 ]  /Q [ -1 -1 -1 13 ]  /H [ -1 -1 -1 -1 ]
+            >>
+            /byte <<
+                /L [ -1 -1  9 15 ]  /M [ -1 -1  7 13 ]  /Q [ -1 -1 -1  9 ]  /H [ -1 -1 -1 -1 ]
+            >> 
+            /kanji <<
+                /L [ -1 -1  6  9 ]  /M [ -1 -1  4  8 ]  /Q [ -1 -1 -1  5 ]  /H [ -1 -1 -1 -1 ]
+            >>
+        >> def
+
+        /encvals <<
+            /numeric      0
+            /alphanumeric 1
+            /byte         2
+            /kanji        3
+        >> def
+
+        /encs <<
+            /numeric      /encnumeric
+            /alphanumeric /encalphanumeric
+            /byte         /encbyte
+            /kanji        /enckanji
+        >> def
+
+        %           N      A      B      K
+        /mids  [ (0001) (0010) (0100) (1000) ] def
+        /mids <<
+           /M1 [     ()     -1     -1     -1 ]
+           /M2 [    (0)    (1)     -1     -1 ]
+           /M3 [   (00)   (01)   (10)   (11) ]
+           /M4 [  (000)  (001)  (010)  (011) ]
+           1 1 40 {2 string 10 exch cvrs mids} for
+        >> def
+
+        %            N  A  B  K
+        /cc1to9   [ 10  9  8  8 ] def
+        /cc10to26 [ 12 11 16 10 ] def
+        /cc27to40 [ 14 13 16 12 ] def
+        /cclens <<
+            /M1   [  3 -1 -1 -1 ]
+            /M2   [  4  3 -1 -1 ]
+            /M3   [  5  4  4  3 ]
+            /M4   [  6  5  5  4 ]
+             1 1  9 { 2 string 10 exch cvrs cc1to9 } for
+            10 1 26 { 2 string 10 exch cvrs cc10to26 } for            
+            27 1 40 { 2 string 10 exch cvrs cc27to40 } for
+        >> def
+
+        % Alphanumeric character to value map
+        /charmap (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:) def
+        /charvals 44 dict def
+        0 1 44 {dup charmap exch get exch charvals 3 1 roll put} for
+
+        /encnumeric {
+            /in exch def
+            /out in length 10 mul 3 idiv 1 add string def
+            /i 0 def /j 0 def {
+                i in length eq {exit} if
+                i in length 2 sub lt {
+                    (0000000000) 10 string copy
+                    dup in i 3 getinterval cvi
+                    2 10 string cvrs dup length 10 exch sub exch putinterval
+                    /i i 3 add def
+                } {
+                    i in length 2 sub eq {  % Two final digits
+                        (0000000) 7 string copy
+                        dup in i 2 getinterval cvi
+                        2 7 string cvrs dup length 7 exch sub exch putinterval
+                        /i i 2 add def
+                    } {  % One final digit
+                        (0000) 4 string copy
+                        dup in i 1 getinterval cvi
+                        2 4 string cvrs dup length 4 exch sub exch putinterval
+                        /i i 1 add def
+                    } ifelse
+                } ifelse
+                dup out exch j exch putinterval
+                length j add /j exch def
+            } loop
+            out 0 j getinterval
+        } bind def
+
+        /encalphanumeric {
+            /in exch def
+            /out in length 11 mul 2 idiv 1 add string def
+            /i 0 def /j 0 def {
+                i in length eq {exit} if
+                i in length 1 sub lt {
+                    (00000000000) 11 string copy
+                    dup charvals in i get get 45 mul charvals in i 1 add get get add
+                    2 11 string cvrs dup length 11 exch sub exch putinterval
+                    /i i 2 add def
+                } {
+                    (000000) 6 string copy
+                    dup charvals in i get get
+                    2 6 string cvrs dup length 6 exch sub exch putinterval
+                    /i i 1 add def
+                } ifelse
+                dup out exch j exch putinterval
+                length j add /j exch def
+            } loop
+            out 0 j getinterval
+        } bind def
+
+        /encbyte {
+            /in exch def
+            /out in length 8 mul string def
+            0 1 in length 1 sub {
+                /i exch def
+                (00000000) 8 string copy
+                dup in i get cvi
+                2 8 string cvrs dup length 8 exch sub exch putinterval 
+                out i 8 mul 3 -1 roll putinterval
+            } for
+            out
+        } bind def
+
+        /enckanji {
+            /in exch def
+            /out in length 2 idiv 13 mul string def
+            /i 0 def /j 0 def {
+                i in length eq {exit} if
+                in i get 256 mul in i 1 add get add
+                dup 16#E040 lt {16#8140} {16#C140} ifelse sub
+                dup -8 bitshift 16#C0 mul exch 16#00FF and add
+                (0000000000000) 13 string copy
+                dup 3 -1 roll 2 13 string cvrs dup length 13 exch sub exch putinterval
+                dup out exch j exch putinterval
+                length j add /j exch def
+                /i i 2 add def
+            } loop
+            out
+        } bind def
+
+        % Determine a compact encoding for the data
+        encoding (unset) eq {
+            /numericokay true def
+            /alphanumericokay true def
+            /kanjiokay true def
+            /byteokay true def
+            barlen 2 mod 0 ne {/kanjiokay false def} if
+            0 1 barlen 1 sub {
+                /i exch def
+                /barchar barcode i get def
+                barchar 48 lt barchar 57 gt or {/numericokay false def} if
+                charvals barchar known not {/alphanumericokay false def} if
+                i 2 mod 0 eq {
+                    barchar 16#81 lt barchar 16#9F gt or
+                    barchar 16#E0 lt barchar 16#EB gt or and {
+                        /kanjiokay false def
+                    } if
+                } if
+            } for
+            byteokay         {/encoding (byte) def} if
+            kanjiokay        {/encoding (kanji) def} if
+            alphanumericokay {/encoding (alphanumeric) def} if
+            numericokay      {/encoding (numeric) def} if
+        } if
+
+        % Determine smallest symbol version to hold given amount of data
+        /numchars barlen encoding (kanji) eq {2 idiv} if def
         version (unset) eq {
-            /caps [
-                [
-                      17    32    53    78   106   134   154   192   230   271   % 1-L  - 10-L
-                     321   367   425   458   520   586   644   718   792   858   % 11-L - 20-L
-                     929  1003  1091  1171  1273  1367  1465  1528  1628  1732   % 21-L - 30-L
-                    1840  1952  2068  2188  2303  2431  2563  2699  2809  2953   % 31-L - 40-L
-                ] [
-                      14    26    42    62    84   106   122   152   180   213   % 1-M  - 10-M
-                     251   287   331   362   412   450   504   560   624   666   % 11-M - 20-M
-                     711   779   857   911   997  1059  1125  1190  1264  1370   % 21-M - 30-M
-                    1452  1538  1628  1722  1809  1911  1989  2099  2213  2331   % 31-M - 40-M
-                ] [
-                      11    20    32    46    60    74    86   108   130   151   % 1-Q  - 10-Q
-                     177   203   241   258   292   322   364   394   442   482   % 11-Q - 20-Q
-                     509   565   611   661   715   751   805   868   908   982   % 21-Q - 30-Q
-                    1030  1112  1168  1228  1283  1351  1423  1499  1579  1663   % 31-Q - 40-Q
-                ] [
-                       7    14    24    34    44    58    64    84    98   119   % 1-H  - 10-H
-                     137   155   177   194   220   250   280   310   338   382   % 11-H - 20-H
-                     403   439   461   511   535   593   625   658   698   742   % 21-H - 30-H
-                     790   842   898   958   983  1051  1093  1139  1219  1273   % 31-H - 40-H
-                ]
-            ] def
-            /caps caps (LMQH) eclevel search pop length exch pop exch pop get def
-            /i 1 def
-            {
-                barlen caps i 1 sub get le {exit} if 
+            /caps format (full) eq {fullcaps} {microcaps} ifelse encoding get eclevel get def
+            /i 1 def {
+                numchars caps i 1 sub get le {exit} if
                 /i i 1 add def
             } loop
             /version i 10 2 string cvrs def
+            format (micro) eq {
+                /version (M ) 2 string copy dup version 1 exch putinterval def
+            } if
         } if
 
+        % Opportunistically raise the error correction level for a fit to the same symbol
+        /caps format (full) eq {fullcaps} {microcaps} ifelse encoding get def
+        /verval format (full) eq {version cvi 1 sub} {version 1 get 49 sub} ifelse def
+        eclevel (L) eq {numchars caps /M get verval get le {/eclevel (M) def} if} if
+        eclevel (M) eq {numchars caps /Q get verval get le {/eclevel (Q) def} if} if
+        eclevel (Q) eq {numchars caps /H get verval get le {/eclevel (H) def} if} if
+
         % Set the control character data for the version
-        /mid (0100) def /term (0000) def /cclen 8 def
-        version 0 1 getinterval (M) ne {  % Version 10 and above
-            version cvi 10 ge {/cclen 16 def} if
-        } if
-        /midlen mid length def
-        /termlen term length def
-
-        % Create the bitstream as byte_mode_id character_count data_bytes term
-        /msgbits midlen cclen add barlen 8 mul add termlen add string def
+        /mid mids version get encvals encoding get get def
+        /cclen cclens version get encvals encoding get get def
+ 
+        % Create the bitstream as mode_id character_count encoded_data
+        /enc barcode encs encoding get load exec def
+        (0000000000000000) 0 cclen getinterval cclen string copy 
+        dup barlen encoding (kanji) eq {2 idiv} if cvi
+        2 cclen string cvrs dup length cclen exch sub exch putinterval 
+        /cc exch def
+        /msgbits mid length cclen add enc length add string def
         msgbits 0 mid putinterval
-        (0000000000000000) 0 cclen getinterval cclen string copy 
-        dup barlen cvi 2 cclen string cvrs dup length cclen exch sub exch putinterval 
-        /cc exch def
-        msgbits midlen cc putinterval
-        0 1 barlen 1 sub {
-            /i exch def
-            (00000000) 8 string copy dup barcode i get cvi 2 8 string cvrs dup length 8 exch sub exch putinterval 
-            msgbits midlen cclen add i 8 mul add 3 -1 roll putinterval
-        } for
-        msgbits midlen cclen add barlen 8 mul add term putinterval
+        msgbits mid length cc putinterval
+        msgbits mid length cclen add enc putinterval
 
     } ifelse
 
@@ -10618,14 +13087,29 @@
         okay {exit} if
         /i i 1 add def
     } loop
+
     /format frmt def
     /version vers def
     /dcpb dcws ecb1 ecb2 add idiv def                 % Base data codewords per block
     /ecpb ncws ecb1 ecb2 add idiv dcpb sub def        % Error correction codewords per block
 
+    % Complete the message bits by adding the terminator, truncated if neccessary
+    /terms <<
+        /M1 (000)
+        /M2 (00000)
+        /M3 (0000000)
+        /M4 (000000000)
+    >> def
+    /term terms version known {terms version get} {(0000)} ifelse def
+    /term term 0 dmod msgbits length sub term length 2 copy gt {exch} if pop getinterval def
+    msgbits length term length add string
+    dup 0 msgbits putinterval
+    dup msgbits length term putinterval
+    /msgbits exch def
+    
     % Expand the message bits by adding padding as necessary
     /pad dmod string def
-    0 4 dmod 1 sub {pad exch (0000) putinterval} for
+    0 1 pad length 1 sub {pad exch 48 put} for
     pad 0 msgbits putinterval
     /padstrs [ (11101100) (00010001) ] def
     /padnum 0 def
@@ -11119,7 +13603,7 @@
 
 % --BEGIN ENCODER maxicode--
 % --DESC: MaxiCode
-% --EXAM: [\)>^03001^02996152382802^029840^029001^0291Z00004951^029UPSN^02906X610^029159^0291234567^0291/1^029^029Y^029634 ALPHA DR^029PITTSBURGH^029PA^029^004
+% --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
 /setpacking where {pop currentpacking true setpacking} if
@@ -11533,84 +14017,73 @@
 
     } if
 
-    % Create the 64x64 Reed-Solomon table
-    /rstable 64 64 mul array def
-    rstable 0 [ 64 {0} repeat ] putinterval
-    rstable 64 [ 0 1 63 {} for ] putinterval
-    /prev 1 def
-    64 {       
-        /next prev 1 bitshift def
-        next 64 and 0 ne {
-            /next next 67 xor def
-        } if        
-        0 1 63 {
-            /j exch def
-            /nextcell {rstable 64 next mul j add} def
-            nextcell rstable 64 prev mul j add get 1 bitshift put
-            nextcell get 64 and 0 ne {
-                nextcell nextcell get 67 xor put
-            } if
+    % Calculate the log and anti-log tables
+    /rsalog [ 1 63 { dup 2 mul dup 64 ge {67 xor} if } repeat ] def
+    /rslog 64 array def
+    1 1 63 {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 63 mod rsalog exch get
+        } {
+            pop pop 0
+        } ifelse
+    } bind def
+
+    % Generate error correction codewords
+    /rscodes {
+
+        /rsnum exch def
+        /cwb exch def
+
+        % Generate the coefficients
+        /coeffs [ 1 rsnum {0} repeat ] def
+        1 1 rsnum {
+            /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
-        /prev next def
-    } repeat
-
-    % Calculate the parity codewords for primary codewords 
-    /pgen [46 44 49 3 2 57 42 39 28 31 1] def
-    /rscodes [ 10 {0} repeat 9 -1 0 { pri exch get } for ] def
-    rscodes length 11 sub -1 0 {
-        /i exch def
-        0 1 10 {
-            /j exch def
-            rscodes i j add rscodes i j add get
-            rstable 64 pgen j get mul rscodes i 10 add get add get
-            xor put
+        /coeffs coeffs 0 coeffs length 1 sub getinterval def
+
+        % Calculate the error correction codewords
+        /ecb [ rsnum {0} repeat ] def
+        0 1 cwb length 1 sub {
+            /t exch cwb exch get ecb 0 get xor def
+            ecb length 1 sub -1 0 {
+                /i exch def
+                /p ecb length i sub 1 sub def
+                ecb p t coeffs i get rsprod put
+                i 0 gt { ecb p ecb p 1 add get ecb p get xor put } if
+            } for
         } for
-    } for
-    /prichk [ 9 -1 0 { rscodes exch get } for ] def
+
+        ecb
+
+    } bind def
 
     % Split secondary codeword into odd and even elements
     /seco [ 0 2 sec length 1 sub { sec exch get } for ] def
     /sece [ 1 2 sec length 1 sub { sec exch get } for ] def
 
     % Calculate the parity codewords for secondary codeword parts based on mode
-    sec length 84 eq {  % SEC mode
-        /sgen [ 59 23 19 31 33 38 17 22 48 15 36 57 37 22 8 27 33 11 44 23 1 ] def
-    } {  % EEC mode
-        /sgen [ 28 11 20 7 43 9 41 34 49 46 37 40 55 34 45 61 13 23 29 22 10 35 55 41 10 53 45 22 1 ] def
-    } ifelse
-    /scodes sgen length 1 sub def
-    /rscodes [ scodes {0} repeat seco length 1 sub -1 0 { seco exch get } for ] def
-    rscodes length scodes sub 1 sub -1 0 {
-        /i exch def
-        0 1 scodes {
-            /j exch def
-            rscodes i j add rscodes i j add get
-            rstable 64 sgen j get mul rscodes i scodes add get add get
-            xor put
-        } for
-    } for
-    /secochk [ scodes 1 sub -1 0 { rscodes exch get } for ] def
-    /rscodes [ scodes {0} repeat sece length 1 sub -1 0 { sece exch get } for ] def
-    rscodes length scodes sub 1 sub -1 0 {
-        /i exch def
-        0 1 scodes {
-            /j exch def
-            rscodes i j add rscodes i j add get
-            rstable 64 sgen j get mul rscodes i scodes add get add get
-            xor put
-        } for
-    } for
-    /secechk [ scodes 1 sub -1 0 { rscodes exch get } for ] def
+    /scodes sec length 84 eq {20} {28} ifelse def  % SEC/EEC mode
+    /secochk seco scodes rscodes def
+    /secechk sece scodes rscodes def
 
     % Recompose the secondary parity codewords
     /secchk [ 0 1 scodes 1 sub { dup secochk exch get exch secechk exch get } for ] def
 
     % Concatinate the data into final codewords
     /codewords [
-        pri {} forall 
-        prichk {} forall
-        sec {} forall 
-        secchk {} forall
+        pri aload pop 
+        pri 10 rscodes aload pop
+        sec aload pop 
+        secchk aload pop
     ] def
 
     % Convert the codewords into module bits
@@ -11915,7 +14388,7 @@
     % Create the codewords and bit string for the mode
     format (full) eq {
         /mode layers 1 sub 11 bitshift cws length 1 sub add def
-        readerinit {/mode mode 2#1000000000000000 or def} if
+        readerinit {/mode mode 2#0000010000000000 or def} if
         /mode [
             mode 2#1111000000000000 and -12 bitshift
             mode 2#0000111100000000 and -8 bitshift
@@ -11926,7 +14399,7 @@
     } if
     format (compact) eq {
         /mode layers 1 sub 6 bitshift cws length 1 sub add def
-        readerinit {/mode mode 2#10000000 or def} if 
+        readerinit {/mode mode 2#00100000 or def} if 
         /mode [
             mode 2#11110000 and -4 bitshift
             mode 2#00001111 and
@@ -12112,6 +14585,340 @@
 /setpacking where {pop setpacking} if
 % --END ENCODER azteccode--
 
+% --BEGIN ENCODER codeone--
+% --DESC: Code One
+% --EXAM: Code One
+% --EXOP: version=B
+% --RNDR: renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/codeone {
+
+    20 dict begin
+
+    /options exch def
+    /barcode exch def
+
+    /dontdraw false def
+    /version (unset) def
+    /encoding (ascii) def
+    /raw false def
+    /parse 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
+
+    /stype version 0 1 getinterval (S) eq def
+    stype {/raw true def} if
+
+    % 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
+
+    raw {/encoding (raw) 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
+
+    % 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
+    } if
+
+    % 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
+
+    % Generate the coefficients for the Reed-Solomon algorithm
+    /coeffs [ 1 ecpb {0} repeat ] def
+    0 1 ecpb 1 sub {
+        /i exch def 
+        coeffs i 1 add coeffs i get put
+        i -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
+    /coeffs coeffs 0 coeffs length 1 sub getinterval def
+
+    % Reed-Solomon algorithm to derive the error correction codewords
+    0 1 cwbs length 1 sub {
+        /i exch def
+        /rscws [ cwbs i get aload pop ecpb {0} repeat ] def
+        0 1 dcpb 1 sub {
+            /m exch def
+            /k rscws m get def
+            0 1 ecpb 1 sub {
+                /j exch def
+                rscws m j add 1 add coeffs ecpb j sub 1 sub get k rsprod rscws m j add 1 add get xor put
+            } for
+        } for
+        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
+
+    % 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
+% --END ENCODER codeone--
+
 % --BEGIN ENCODER gs1-cc--
 % --REQUIRES micropdf417 pdf417--
 % --DESC: GS1 Composite 2D Component
@@ -12125,14 +14932,13 @@
 dup /micropdf417 dup /uk.co.terryburton.bwipp findresource put
 begin
 /gs1-cc {
-
+    
     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
-    /height 34 72 div def
     /ccversion (a) def
     /cccolumns -1 def
     /lintype () def
@@ -12149,7 +14955,6 @@
     } if
     options {def} forall
  
-    /height height cvr def
     /cccolumns cccolumns cvi def
     /linwidth linwidth cvi def
 
@@ -12160,10 +14965,12 @@
             /upca                   4
             /ean8                   3
             /upce                   2
-            /gs1-128                4
+            /gs1-128
+                ccversion (c) ne {4} {linwidth 52 sub 17 idiv} ifelse
             /databaromni            4
             /databarstacked         2
             /databarstackedomni     2
+            /databartruncated       4
             /databarlimited         3
             /databarexpanded        4
             /databarexpandedstacked 4
@@ -12313,7 +15120,7 @@
         lalphanumeric (00100)
     >> def
 
-    method (10) eq {
+    method (10) eq {  % TODO: fixme
         ais 0 get (11) eq ais 0 get (17) eq or {
             aival ais 0 get get
             dup 0 2 getinterval cvi 384 mul exch
@@ -12332,13 +15139,14 @@
         ais length 0 ne {
             ais 0 get (10) eq {
                 /gpf [ aival (10) get {} forall ] def
-                ais length 1 gt {/gpf [ gpf aload pop fnc1 ] def} if
+                ais length 1 gt {/gpf [ gpf aload pop fnc1 ] def} if  % TODO: check
                 /ais ais 1 ais length 1 sub getinterval def
             } {
-                /gpf [fnc1] def
+                /gpf [fnc1] def  % TODO: check
             } ifelse
         } {
-            /gpf [fnc1] def
+            /cdf [ cdf aload pop 0 0 0 0 0 1 1 1 1 ] def
+            /gpf [] def
         } ifelse
         /mode (numeric) def
     } if
@@ -12502,7 +15310,7 @@
             m  321 ge               {64} if
             /eccws exch def
             /m m eccws add 3 add def
-            /c linwidth 62 sub 17 idiv def
+            /c linwidth 52 sub 17 idiv def
             m c idiv 90 gt {/c c 1 add def} if
             /r m c div ceiling cvi def
             /tgt c r mul eccws sub 3 sub dup 5 idiv 6 mul exch 5 mod add 8 mul def
@@ -12511,11 +15319,15 @@
         dup -1 eq {  % Upgrade CC-A to CC-B or CC-B to CC-C to fit
             pop
             ccversion (a) eq {
-                (b)
+                /ccversion (b) def
             } {
-                ccversion (b) eq lintype (gs1-128) eq and {(c)} {-1} ifelse
+                ccversion (b) eq lintype (gs1-128) eq and {
+                    /ccversion (c) def
+                    /cccolumns linwidth 52 sub 17 idiv def
+                } {
+                    /ccversion -1 def
+                } ifelse
             } ifelse 
-            /ccversion exch def
             used rembits
         } if
     } bind def
@@ -12600,6 +15412,7 @@
             mode (alphanumeric) eq {
                 gpf i get fnc1 eq {
                     fnc1 alphanumeric encode
+                    /mode (numeric) def
                     /i i 1 add def
                     exit
                 } if
@@ -12626,6 +15439,7 @@
             mode (iso646) eq {
                 gpf i get fnc1 eq {
                     fnc1 iso646 encode
+                    /mode (numeric) def
                     /i i 1 add def
                     exit
                 } if
@@ -12766,13 +15580,14 @@
 % --REQUIRES ean13 micropdf417 pdf417 gs1-cc--
 % --SUGGESTS ean5 ean2--
 % --DESC: EAN-13 Composite
-% --EXAM: 331234567890|(99)1234-abcd
+% --EXAM: 2112345678900|(99)1234-abcd
 % --EXOP: includetext
 % --RNDR: renlinear renmatrix
 /setpacking where {pop currentpacking true setpacking} if
 2 dict
 dup /ean13 dup /uk.co.terryburton.bwipp findresource put
 dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
 dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
 begin
 /ean13composite {
@@ -12804,27 +15619,34 @@
         pop
     } ifelse
 
-    % Define the separator
-    /sep <<
+    gsave
+
+    options (lintype) (ean13) put
+    options (inkspread) (0) put
+    options (dontdraw) true put
+
+    % Plot the linear part
+    linear options //ean13 exec //renlinear exec
+
+    % Plot the separator
+    -1 72 rmoveto <<
         /ren //renmatrix
         /pixs [
             0 1  93 {0} repeat  1 0
             1 0  93 {0} repeat  0 1
             0 1  93 {0} repeat  1 0
-        ] 
+        ]
         /pixx 97
         /pixy 3
         /height 6 72 div
         /width 97 72 div
         /opt options
-    >> def
-
-    % Get the result of encoding with ean13 and gs1-cc
-    options (lintype) (ean13) put
-    options (inkspread) (0) put
-    linear options //ean13 exec
-    -1 72 rmoveto sep //renmatrix exec
-    -2 6 rmoveto comp options //gs1-cc exec
+    >> //renmatrix exec
+
+    % Plot the 2D part
+    -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
+
+    grestore
 
     end
 
@@ -12833,6 +15655,1225 @@
 end
 /setpacking where {pop setpacking} if
 % --END ENCODER ean13composite--
+
+% --BEGIN ENCODER ean8composite--
+% --REQUIRES ean8 micropdf417 pdf417 gs1-cc--
+% --SUGGESTS ean5 ean2--
+% --DESC: EAN-8 Composite
+% --EXAM: 02345673|(21)A12345678
+% --EXOP: includetext
+% --RNDR: renlinear renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+2 dict
+dup /ean8 dup /uk.co.terryburton.bwipp findresource put
+dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/ean8composite {
+
+    20 dict begin            % Confine variables to local scope
+
+    /options exch def
+    /barcode exch def
+
+    /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
+
+    % Split the linear and composite parts
+    barcode (|) search {
+        /linear exch def
+        pop
+        /comp exch def
+    } {
+        pop
+    } ifelse
+
+    gsave
+
+    % Get the result of encoding with ean8 and gs1-cc
+    options (lintype) (ean8) put
+    options (inkspread) (0) put
+    options (dontdraw) true put
+
+    % Plot the linear part
+    linear options //ean8 exec //renlinear exec
+
+    % Plot the separator
+    -1 72 rmoveto <<
+        /ren //renmatrix
+        /pixs [
+            0 1  65 {0} repeat  1 0
+            1 0  65 {0} repeat  0 1
+            0 1  65 {0} repeat  1 0
+        ]
+        /pixx 69
+        /pixy 3
+        /height 6 72 div
+        /width 69 72 div
+        /opt options
+    >> //renmatrix exec
+
+    % Plot the 2D part
+    comp options //gs1-cc exec
+    dup (pixx) get 69 exch sub 6 rmoveto
+    //renmatrix exec
+
+    grestore
+
+    end
+
+} bind def
+/ean8composite dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER ean8composite--
+
+% --BEGIN ENCODER upcacomposite--
+% --REQUIRES upca micropdf417 pdf417 gs1-cc--
+% --SUGGESTS ean5 ean2--
+% --DESC: UPC-A Composite
+% --EXAM: 416000336108|(99)1234-abcd
+% --EXOP: includetext
+% --RNDR: renlinear renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+2 dict
+dup /upca dup /uk.co.terryburton.bwipp findresource put
+dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/upcacomposite {
+
+    20 dict begin            % Confine variables to local scope
+
+    /options exch def
+    /barcode exch def
+
+    /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
+
+    % Split the linear and composite parts
+    barcode (|) search {
+        /linear exch def
+        pop
+        /comp exch def
+    } {
+        pop
+    } ifelse
+
+    gsave
+
+    options (lintype) (ean13) put
+    options (inkspread) (0) put
+    options (dontdraw) true put
+
+    % Plot the linear part
+    linear options //upca exec //renlinear exec
+
+    % Plot the separator
+    -1 72 rmoveto <<
+        /ren //renmatrix
+        /pixs [
+            0 1  93 {0} repeat  1 0
+            1 0  93 {0} repeat  0 1
+            0 1  93 {0} repeat  1 0
+        ]
+        /pixx 97
+        /pixy 3
+        /height 6 72 div
+        /width 97 72 div
+        /opt options
+    >> //renmatrix exec
+
+    % Plot the 2D part
+    -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
+
+    grestore
+
+    end
+
+} bind def
+/upcacomposite dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER upcacomposite--
+
+% --BEGIN ENCODER upcecomposite--
+% --REQUIRES upce micropdf417 pdf417 gs1-cc--
+% --SUGGESTS ean5 ean2--
+% --DESC: UPC-E Composite
+% --EXAM: 00123457|(15)021231
+% --EXOP: includetext
+% --RNDR: renlinear renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+2 dict
+dup /upce dup /uk.co.terryburton.bwipp findresource put
+dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/upcecomposite {
+
+    20 dict begin            % Confine variables to local scope
+
+    /options exch def
+    /barcode exch def
+
+    /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
+
+    % Split the linear and composite parts
+    barcode (|) search {
+        /linear exch def
+        pop
+        /comp exch def
+    } {
+        pop
+    } ifelse
+
+    % Define the separator
+    /sep <<
+        /ren //renmatrix
+        /pixs [
+            0 1  49 {0} repeat  1 0
+            1 0  49 {0} repeat  0 1
+            0 1  49 {0} repeat  1 0
+        ] 
+        /pixx 53
+        /pixy 3
+        /height 6 72 div
+        /width 53 72 div
+        /opt options
+    >> def
+
+    gsave
+
+    options (lintype) (upce) put
+    options (inkspread) (0) put
+    options (dontdraw) true put
+
+    % Plot the linear part
+    linear options //upce exec //renlinear exec
+
+    % Plot the separator
+    -1 72 rmoveto <<
+        /ren //renmatrix
+        /pixs [
+            0 1  49 {0} repeat  1 0
+            1 0  49 {0} repeat  0 1
+            0 1  49 {0} repeat  1 0
+        ]
+        /pixx 53
+        /pixy 3
+        /height 6 72 div
+        /width 53 72 div
+        /opt options
+    >> //renmatrix exec
+
+    % Plot the 2D part
+    -2 6 rmoveto comp options //gs1-cc exec //renmatrix exec
+
+    grestore
+
+    end
+
+} bind def
+/upcecomposite dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER upcecomposite--
+
+% --BEGIN ENCODER databaromnicomposite--
+% --REQUIRES databaromni micropdf417 pdf417 gs1-cc--
+% --DESC: GS1 DataBar Omnidirectional Composite
+% --EXAM: (01)03612345678904|(11)990102
+% --EXOP:
+% --RNDR: renlinear renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+2 dict
+dup /databaromni dup /uk.co.terryburton.bwipp findresource put
+dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/databaromnicomposite {
+
+    20 dict begin            % Confine variables to local scope
+
+    /options exch def
+    /barcode exch def
+
+    /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
+
+    % Split the linear and composite parts
+    barcode (|) search {
+        /linear exch def
+        pop
+        /comp exch def
+    } {
+        pop
+    } ifelse
+
+    gsave
+
+    options (lintype) (databaromni) put
+    options (linkage) true put
+    options (inkspread) (0) put
+    options (dontdraw) true put
+
+    % Plot the linear part
+    linear options //databaromni exec
+    dup (sbs) get /linsbs exch def
+    dup (bhs) get 0 get 72 mul /linheight exch def
+    //renlinear exec
+
+    % Plot the separator
+    /sepfinder {
+        /fp exch def
+        fp 1 fp 12 add {
+            /i exch def
+            bot i get 0 eq {
+                bot i 1 sub get 1 eq {
+                    1
+                } {
+                    sep i 1 sub get 0 eq {1} {0} ifelse
+                } ifelse
+            } {
+                0
+            } ifelse
+            sep exch i exch put
+        } for
+        /f3 [1 1 1 1 1 1 1 1 1 0 1 1 1] def
+        true 0 1 12 {dup bot exch fp add get exch f3 exch get eq and} for {
+            % Right shifted module for value 3 finder
+            sep fp [ 0 0 0 0 0 0 0 0 0 0 1 0 0 ] putinterval
+        } if
+    } bind def
+    mark
+    0 linsbs {1 index 1 eq {{0}} {{1}} ifelse repeat} forall
+    counttomark 1 sub array astore /bot exch def pop pop
+    /sep [ bot {1 exch sub} forall ] def
+    sep 0 [0 0 0] putinterval
+    sep sep length 4 sub [0 0 0 0] putinterval
+    18 sepfinder 64 sepfinder
+    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
+    -5 1 rmoveto comp options //gs1-cc exec //renmatrix exec
+
+    grestore
+
+    end
+
+} bind def
+/databaromnicomposite dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER databaromnicomposite--
+
+% --BEGIN ENCODER databarstackedcomposite--
+% --REQUIRES databaromni databarstacked micropdf417 pdf417 gs1-cc--
+% --DESC: GS1 DataBar Stacked Composite
+% --EXAM: (01)03412345678900|(17)010200
+% --EXOP:
+% --RNDR: renlinear renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+2 dict
+dup /databarstacked dup /uk.co.terryburton.bwipp findresource put
+dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/databarstackedcomposite {
+
+    20 dict begin            % Confine variables to local scope
+
+    /options exch def
+    /barcode exch def
+
+    /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
+
+    % Split the linear and composite parts
+    barcode (|) search {
+        /linear exch def
+        pop
+        /comp exch def
+    } {
+        pop
+    } ifelse
+
+    gsave
+
+    options (lintype) (databarstacked) put
+    options (linkage) true put
+    options (inkspread) (0) put
+    options (dontdraw) true put
+
+    % Plot the linear part
+    linear options //databarstacked exec
+    dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
+    dup (pixy) get /linheight exch def
+    //renmatrix exec
+
+    % Plot the separator
+    /sepfinder {
+        /fp exch def
+        fp 1 fp 12 add {
+            /i exch def
+            bot i get 0 eq {
+                bot i 1 sub get 1 eq {
+                    1
+                } {
+                    sep i 1 sub get 0 eq {1} {0} ifelse
+                } ifelse
+            } {
+                0
+            } ifelse
+            sep exch i exch put
+        } for
+        /f3 [1 1 1 1 1 1 1 1 1 0 1 1 1] def
+        true 0 1 12 {dup bot exch fp add get exch f3 exch get eq and} for {
+            % Right shifted module for value 3 finder
+            sep fp [ 0 0 0 0 0 0 0 0 0 0 1 0 0 ] putinterval
+        } if
+    } bind def
+    /sep [ bot {1 exch sub} forall ] def
+    sep 0 [ 0 0 0 0 ] putinterval
+    sep sep length 4 sub [ 0 0 0 0 ] putinterval
+    18 sepfinder
+    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
+    1 1 rmoveto comp options //gs1-cc exec //renmatrix exec
+
+    grestore
+
+    end
+
+} bind def
+/databarstackedcomposite dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER databarstackedcomposite--
+
+% --BEGIN ENCODER databarstackedomnicomposite--
+% --REQUIRES databaromni databarstackedomni micropdf417 pdf417 gs1-cc--
+% --DESC: GS1 DataBar Stacked Omnidirectional Composite
+% --EXAM: (01)03612345678904|(11)990102
+% --EXOP:
+% --RNDR: renlinear renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+2 dict
+dup /databarstackedomni dup /uk.co.terryburton.bwipp findresource put
+dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/databarstackedomnicomposite {
+
+    20 dict begin            % Confine variables to local scope
+
+    /options exch def
+    /barcode exch def
+
+    /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
+
+    % Split the linear and composite parts
+    barcode (|) search {
+        /linear exch def
+        pop
+        /comp exch def
+    } {
+        pop
+    } ifelse
+
+    gsave
+
+    options (lintype) (databarstackedomni) put
+    options (linkage) true put
+    options (inkspread) (0) put
+    options (dontdraw) true put
+
+    % Plot the linear part
+    linear options //databarstackedomni exec
+    dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
+    dup (pixy) get /linheight exch def
+    //renmatrix exec
+
+    % Plot the separator
+    /sepfinder {
+        /fp exch def
+        fp 1 fp 12 add {
+            /i exch def
+            bot i get 0 eq {
+                bot i 1 sub get 1 eq {
+                    1
+                } {
+                    sep i 1 sub get 0 eq {1} {0} ifelse
+                } ifelse
+            } {
+                0
+            } ifelse
+            sep exch i exch put
+        } for
+        /f3 [1 1 1 1 1 1 1 1 1 0 1 1 1] def
+        true 0 1 12 {dup bot exch fp add get exch f3 exch get eq and} for {
+            % Right shifted module for value 3 finder
+            sep fp [ 0 0 0 0 0 0 0 0 0 0 1 0 0 ] putinterval
+        } if
+    } bind def
+    /sep [ bot {1 exch sub} forall ] def
+    sep 0 [ 0 0 0 ] putinterval
+    sep sep length 4 sub [ 0 0 0 0 ] putinterval
+    18 sepfinder
+    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
+    1 1 rmoveto comp options //gs1-cc exec //renmatrix exec
+
+    grestore
+
+    end
+
+} bind def
+/databarstackedomnicomposite dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER databarstackedomnicomposite--
+
+% --BEGIN ENCODER databartruncatedcomposite--
+% --REQUIRES databaromni databartruncated micropdf417 pdf417 gs1-cc--
+% --DESC: GS1 DataBar Truncated Composite
+% --EXAM: (01)03612345678904|(11)990102
+% --EXOP:
+% --RNDR: renlinear renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+2 dict
+dup /databartruncated dup /uk.co.terryburton.bwipp findresource put
+dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/databartruncatedcomposite {
+
+    20 dict begin            % Confine variables to local scope
+
+    /options exch def
+    /barcode exch def
+
+    /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
+
+    % Split the linear and composite parts
+    barcode (|) search {
+        /linear exch def
+        pop
+        /comp exch def
+    } {
+        pop
+    } ifelse
+
+    gsave
+
+    options (lintype) (databartruncated) put
+    options (linkage) true put
+    options (inkspread) (0) put
+    options (dontdraw) true put
+
+    % Plot the linear part
+    linear options //databartruncated exec
+    dup (sbs) get /linsbs exch def
+    dup (bhs) get 0 get 72 mul /linheight exch def
+    //renlinear exec
+
+    % Plot the separator
+    /sepfinder {
+        /fp exch def
+        fp 1 fp 12 add {
+            /i exch def
+            bot i get 0 eq {
+                bot i 1 sub get 1 eq {
+                    1
+                } {
+                    sep i 1 sub get 0 eq {1} {0} ifelse
+                } ifelse
+            } {
+                0
+            } ifelse
+            sep exch i exch put
+        } for
+        /f3 [1 1 1 1 1 1 1 1 1 0 1 1 1] def
+        true 0 1 12 {dup bot exch fp add get exch f3 exch get eq and} for {
+            % Right shifted module for value 3 finder
+            sep fp [ 0 0 0 0 0 0 0 0 0 0 1 0 0 ] putinterval
+        } if
+    } bind def
+    mark
+    0 linsbs {1 index 1 eq {{0}} {{1}} ifelse repeat} forall
+    counttomark 1 sub array astore /bot exch def pop pop
+    /sep [ bot {1 exch sub} forall ] def
+    sep 0 [0 0 0] putinterval
+    sep sep length 4 sub [0 0 0 0] putinterval
+    18 sepfinder 64 sepfinder
+    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
+    -5 1 rmoveto comp options //gs1-cc exec //renmatrix exec
+
+    grestore
+
+    end
+
+} bind def
+/databartruncatedcomposite dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER databartruncatedcomposite--
+
+% --BEGIN ENCODER databarlimitedcomposite--
+% --REQUIRES databarlimited micropdf417 pdf417 gs1-cc--
+% --DESC: GS1 DataBar Limited Composite
+% --EXAM: (01)03512345678907|(21)abcdefghijklmnopqrstuv
+% --EXOP:
+% --RNDR: renlinear renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+2 dict
+dup /databarlimited dup /uk.co.terryburton.bwipp findresource put
+dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/databarlimitedcomposite {
+
+    20 dict begin            % Confine variables to local scope
+
+    /options exch def
+    /barcode exch def
+
+    /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
+
+    % Split the linear and composite parts
+    barcode (|) search {
+        /linear exch def
+        pop
+        /comp exch def
+    } {
+        pop
+    } ifelse
+
+    gsave
+
+    options (lintype) (databarlimited) put
+    options (linkage) true put
+    options (inkspread) (0) put
+    options (dontdraw) true put
+
+    % Plot the linear part
+    linear options //databarlimited exec
+    dup (sbs) get /linsbs exch def
+    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
+    sep 0 [0 0 0] putinterval
+    sep sep length 4 sub [0 0 0 0] putinterval
+    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
+    comp options //gs1-cc exec 
+    dup (pixx) get 72 exch sub 1 rmoveto 
+    //renmatrix exec
+
+    grestore
+
+    end
+
+} bind def
+/databarlimitedcomposite dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER databarlimitedcomposite--
+
+% --BEGIN ENCODER databarexpandedcomposite--
+% --REQUIRES databarexpanded micropdf417 pdf417 gs1-cc--
+% --DESC: GS1 DataBar Expanded Composite
+% --EXAM: (01)93712345678904(3103)001234|(91)1A2B3C4D5E
+% --EXOP:
+% --RNDR: renlinear renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+2 dict
+dup /databarexpanded dup /uk.co.terryburton.bwipp findresource put
+dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/databarexpandedcomposite {
+
+    20 dict begin            % Confine variables to local scope
+
+    /options exch def
+    /barcode exch def
+
+    /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
+
+    % Split the linear and composite parts
+    barcode (|) search {
+        /linear exch def
+        pop
+        /comp exch def
+    } {
+        pop
+    } ifelse
+
+    gsave
+
+    options (lintype) (databarexpanded) put
+    options (linkage) true put
+    options (inkspread) (0) put
+    options (dontdraw) true put
+
+    % Plot the linear part
+    linear options //databarexpanded exec
+    dup (sbs) get /linsbs exch def
+    dup (bhs) get 0 get 72 mul /linheight exch def
+    //renlinear exec
+
+    % Plot the separator
+    /sepfinder {
+        /fp exch def
+        fp 1 fp 12 add {
+            /i exch def
+            bot i get 0 eq {
+                bot i 1 sub get 1 eq {
+                    1
+                } {
+                    sep i 1 sub get 0 eq {1} {0} ifelse
+                } ifelse
+            } {
+                0
+            } ifelse
+            sep exch i exch put
+        } for
+    } bind def
+    mark
+    0 linsbs {1 index 1 eq {{0}} {{1}} ifelse repeat} forall
+    counttomark 1 sub array astore /bot exch def pop pop
+    /sep [ bot {1 exch sub} forall ] def
+    sep 0 [0 0 0] putinterval
+    sep sep length 4 sub [0 0 0 0] putinterval
+    [  % Finder pattern module positions
+        18 98 bot length 13 sub {} for
+        69 98 bot length 13 sub {} for
+    ] {sepfinder} forall 
+    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
+    1 1 rmoveto comp options //gs1-cc exec //renmatrix exec
+
+    grestore
+
+    end
+
+} bind def
+/databarexpandedcomposite dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER databarexpandedcomposite--
+
+% --BEGIN ENCODER databarexpandedstackedcomposite--
+% --REQUIRES databarexpanded databarexpandedstacked micropdf417 pdf417 gs1-cc--
+% --DESC: GS1 DataBar Expanded Stacked Composite
+% --EXAM: (01)00012345678905(10)ABCDEF|(21)12345678
+% --EXOP: segments=4 
+% --RNDR: renmatrix renlinear
+/setpacking where {pop currentpacking true setpacking} if
+2 dict
+dup /databarexpandedstacked dup /uk.co.terryburton.bwipp findresource put
+dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/databarexpandedstackedcomposite {
+
+    20 dict begin            % Confine variables to local scope
+
+    /options exch def
+    /barcode exch def
+
+    /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
+
+    % Split the linear and composite parts
+    barcode (|) search {
+        /linear exch def
+        pop
+        /comp exch def
+    } {
+        pop
+    } ifelse
+
+    gsave
+
+    options (lintype) (databarexpandedstacked) put
+    options (linkage) true put
+    options (inkspread) (0) put
+    options (dontdraw) true put
+
+    % Plot the linear part
+    linear options //databarexpandedstacked exec
+    dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
+    dup (pixy) get /linheight exch def
+    //renmatrix exec
+
+    % Plot the separator
+    /sepfinder {
+        /fp exch def
+        fp 1 fp 12 add {
+            /i exch def
+            bot i get 0 eq {
+                bot i 1 sub get 1 eq {
+                    1
+                } {
+                    sep i 1 sub get 0 eq {1} {0} ifelse
+                } ifelse
+            } {
+                0
+            } ifelse
+            sep exch i exch put
+        } for
+    } bind def
+    /sep [ bot {1 exch sub} forall ] def
+    sep 0 [ 0 0 0 ] putinterval
+    sep sep length 4 sub [ 0 0 0 0 ] putinterval
+    [  % Finder pattern module positions
+        19 98 bot length 13 sub {} for
+        70 98 bot length 13 sub {} for
+    ] {sepfinder} forall 
+    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
+    bot 0 get 0 eq {2} {0} ifelse 1 rmoveto
+    comp options //gs1-cc exec //renmatrix exec
+
+    grestore
+
+    end
+
+} bind def
+/databarexpandedstackedcomposite dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER databarexpandedstackedcomposite--
+
+% --BEGIN ENCODER gs1-128composite--
+% --REQUIRES code128 gs1-128 micropdf417 pdf417 gs1-cc--
+% --DESC: GS1-128 Composite
+% --EXAM: (00)030123456789012340|(02)13012345678909(37)24(10)1234567ABCDEFG
+% --EXOP: ccversion=c
+% --RNDR: renlinear renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+2 dict
+dup /gs1-128 dup /uk.co.terryburton.bwipp findresource put
+dup /gs1-cc dup /uk.co.terryburton.bwipp findresource put
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/gs1-128composite {
+
+    20 dict begin            % Confine variables to local scope
+
+    /options exch def
+    /barcode exch def
+
+    /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
+
+    % Split the linear and composite parts
+    barcode (|) search {
+        /linear exch def
+        pop
+        /comp exch def
+    } {
+        pop
+    } ifelse
+
+    gsave
+
+    options (inkspread) (0) put
+    options (dontdraw) true put
+
+    % Dummy plot of linear part with CC-A to get width
+    options (linkagea) true put
+    linear << options {} forall >> //gs1-128 exec
+    (sbs) get 0 exch {add} forall /linwidth exch def
+
+    % Create 2D part and determine type
+    options (lintype) (gs1-128) put
+    options (linwidth) linwidth put
+    comp options //gs1-cc exec /compsym exch def
+    compsym (pixx) get 99 eq {(a)} {(c)} ifelse /linktype exch def 
+
+    % Plot linear part
+    linktype (a) eq {
+        options (linkagea) true put
+        options (linkagec) false put
+    } {
+        options (linkagea) false put
+        options (linkagec) true put
+    } ifelse
+    linear << options {} forall >> //gs1-128 exec
+    dup (sbs) get /linsbs exch def
+    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 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
+% --END ENCODER gs1-128composite--
+
+% --BEGIN ENCODER gs1datamatrix--
+% --REQUIRES datamatrix--
+% --DESC: GS1 Data Matrix
+% --EXAM: (01)03453120000011(17)120508(10)ABCD1234(410)9501101020917
+% --EXOP:
+% --RNDR: renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+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
+
+    % 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
+
+    % 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
+
+    % Get the result of encoding with code128
+    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
+/gs1datamatrix dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER gs1datamatrix--
 
 % --BEGIN ENCODER hibccode39--
 % --REQUIRES code39--
@@ -13279,4 +17320,71 @@
 /setpacking where {pop setpacking} if
 % --END ENCODER hibcqrcode--
 
+% --BEGIN ENCODER hibccodablockf--
+% --REQUIRES codablockf--
+% --DESC: HIBC Codablock F
+% --EXAM: A123BJC5D6E71
+% --EXOP:
+% --RNDR: renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+dup /codablockf dup /uk.co.terryburton.bwipp findresource put
+begin
+/hibccodablockf {
+
+    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
+
+    /barlen barcode length def
+
+    /barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%) def
+
+    /barcode barlen 2 add string dup 1 barcode putinterval def
+    barcode 0 43 put
+
+    /checksum 0 def
+    0 1 barlen {
+        /i exch def
+        % Lookup the encoding for the each barcode character
+        barcode i 1 getinterval barchars exch search
+        pop                                  % Discard true leaving pre
+        length /indx exch def                % indx is the length of pre
+        pop pop                              % Discard seek and post
+        /checksum checksum indx add def
+    } for
+    barcode barlen 1 add barchars checksum 43 mod get put
+
+    % Get the result of encoding with codablockf
+    options (dontdraw) true put
+    /args barcode options //codablockf exec def
+
+    args (opt) options put
+    args
+ 
+    dontdraw not //renmatrix if
+
+    end
+
+} bind def
+/hibccodablockf dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER hibccodablockf--
+
 % --END TEMPLATE--

Modified: trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18224&path=/trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp (original)
+++ trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp Mon Mar 25 23:00:41 2013
@@ -98,6 +98,10 @@
 								 tr("Variable number of hexadecimal characters"),
 								 "[0-9A-F]*",
 								false, true);
+	map["QR Code"] = BarcodeType("qrcode", "http://www.scribus.net",
+								 tr("Variable number of characters, digits and any symbols."),
+								 ".*",
+								false, false);
 	//    "Symbol"] = "symbol"
 
 	useSamples = true;




More information about the scribus-commit mailing list