r16257 by jghali - merge trunk revisions up to r16256

scribus-commit scribus-commit at lists.scribus.net
Sat Jan 15 17:45:22 CET 2011


Author: jghali
Date: Sat Jan 15 16:45:22 2011
New Revision: 16257

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16257
Log:
merge trunk revisions up to r16256

Removed:
    branches/ScribusOIF/scribus/annotation.cpp
    branches/ScribusOIF/scribus/canvasmode_legacy.cpp
    branches/ScribusOIF/scribus/canvasmode_legacy.h
    branches/ScribusOIF/scribus/pageitem_desaxe.cpp
    branches/ScribusOIF/scribus/stencilreader.cpp
    branches/ScribusOIF/scribus/stencilreader.h
    branches/ScribusOIF/scribus/ui/docitemattrprefs.cpp
    branches/ScribusOIF/scribus/ui/docitemattrprefs.h
    branches/ScribusOIF/scribus/ui/docitemattrprefs.ui
    branches/ScribusOIF/scribus/ui/docsections.cpp
    branches/ScribusOIF/scribus/ui/docsections.h
    branches/ScribusOIF/scribus/ui/docsections.ui
    branches/ScribusOIF/scribus/ui/fontprefs.cpp
    branches/ScribusOIF/scribus/ui/fontprefs.h
    branches/ScribusOIF/scribus/ui/hysettings.cpp
    branches/ScribusOIF/scribus/ui/hysettings.h
    branches/ScribusOIF/scribus/ui/hysettingsBase.ui
    branches/ScribusOIF/scribus/ui/prefs.cpp
    branches/ScribusOIF/scribus/ui/prefs.h
    branches/ScribusOIF/scribus/ui/prefsdialogbase.cpp
    branches/ScribusOIF/scribus/ui/prefsdialogbase.h
    branches/ScribusOIF/scribus/ui/reformdoc.cpp
    branches/ScribusOIF/scribus/ui/reformdoc.h
    branches/ScribusOIF/scribus/ui/tabcheckdoc.cpp
    branches/ScribusOIF/scribus/ui/tabcheckdoc.h
    branches/ScribusOIF/scribus/ui/tabdisplay.cpp
    branches/ScribusOIF/scribus/ui/tabdisplay.h
    branches/ScribusOIF/scribus/ui/tabdisplay.ui
    branches/ScribusOIF/scribus/ui/tabdocument.cpp
    branches/ScribusOIF/scribus/ui/tabdocument.h
    branches/ScribusOIF/scribus/ui/tabexternaltoolswidget.cpp
    branches/ScribusOIF/scribus/ui/tabexternaltoolswidget.h
    branches/ScribusOIF/scribus/ui/tabexternaltoolswidget.ui
    branches/ScribusOIF/scribus/ui/tabgeneral.cpp
    branches/ScribusOIF/scribus/ui/tabgeneral.h
    branches/ScribusOIF/scribus/ui/tabgeneral.ui
    branches/ScribusOIF/scribus/ui/tabguides.cpp
    branches/ScribusOIF/scribus/ui/tabguides.h
    branches/ScribusOIF/scribus/ui/tabkeyboardshortcutswidget.cpp
    branches/ScribusOIF/scribus/ui/tabkeyboardshortcutswidget.h
    branches/ScribusOIF/scribus/ui/tabkeyboardshortcutswidget.ui
    branches/ScribusOIF/scribus/ui/tabmiscellaneous.cpp
    branches/ScribusOIF/scribus/ui/tabmiscellaneous.h
    branches/ScribusOIF/scribus/ui/tabmiscellaneous.ui
    branches/ScribusOIF/scribus/ui/tabprinter.cpp
    branches/ScribusOIF/scribus/ui/tabprinter.h
    branches/ScribusOIF/scribus/ui/tabprinter.ui
    branches/ScribusOIF/scribus/ui/tabscrapbook.cpp
    branches/ScribusOIF/scribus/ui/tabscrapbook.h
    branches/ScribusOIF/scribus/ui/tabscrapbook.ui
    branches/ScribusOIF/scribus/ui/tabtools.cpp
    branches/ScribusOIF/scribus/ui/tabtools.h
    branches/ScribusOIF/scribus/ui/tabtypography.cpp
    branches/ScribusOIF/scribus/ui/tabtypography.h
    branches/ScribusOIF/scribus/ui/tocindexprefs.cpp
    branches/ScribusOIF/scribus/ui/tocindexprefs.h
    branches/ScribusOIF/scribus/ui/tocindexprefs.ui
Modified:
    branches/ScribusOIF/scribus/CMakeLists.txt
    branches/ScribusOIF/scribus/canvasmode_editarc.cpp
    branches/ScribusOIF/scribus/canvasmode_editpolygon.cpp
    branches/ScribusOIF/scribus/canvasmode_editpolygon.h
    branches/ScribusOIF/scribus/fpointarray.cpp
    branches/ScribusOIF/scribus/fpointarray.h
    branches/ScribusOIF/scribus/plugins/barcodegenerator/barcode.ps
    branches/ScribusOIF/scribus/plugins/barcodegenerator/barcodegenerator.cpp
    branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
    branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
    branches/ScribusOIF/scribus/plugins/import/ps/importps.cpp
    branches/ScribusOIF/scribus/scribus.cpp
    branches/ScribusOIF/scribus/ui/contextmenu.cpp
    branches/ScribusOIF/scribus/ui/modetoolbar.cpp
    branches/ScribusOIF/win32/vc8/Scribus.vcproj

Modified: branches/ScribusOIF/scribus/CMakeLists.txt
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16257&path=/branches/ScribusOIF/scribus/CMakeLists.txt
==============================================================================
--- branches/ScribusOIF/scribus/CMakeLists.txt (original)
+++ branches/ScribusOIF/scribus/CMakeLists.txt Sat Jan 15 16:45:22 2011
@@ -71,14 +71,11 @@
   ui/charselectenhanced.ui
   ui/cmsprefsbase.ui
   ui/colorpalette.ui
-#  ui/docitemattrprefs.ui
-#  ui/docsections.ui
   ui/gradientaddedit.ui
   ui/gradienteditor.ui
   ui/gradientvectorbase.ui
   ui/gtfiledialog.ui
   ui/guidemanager.ui
-#  ui/hysettingsBase.ui
   ui/insertaframe.ui
   ui/latexeditor.ui
   ui/newmarginwidgetbase.ui
@@ -89,7 +86,6 @@
   ui/nftwidget.ui
   ui/pageitemattributes.ui
   ui/paintmanagerbase.ui
-#  ui/patterndialog.ui
   ui/picsearch.ui
   ui/picsearchoptions.ui
   ui/picstatus.ui
@@ -150,14 +146,6 @@
   ui/smreplacedia.ui
   ui/smstyleimport.ui
   ui/stylemanager.ui
-#  ui/tabdisplay.ui
-#  ui/tabexternaltoolswidget.ui
-#  ui/tabgeneral.ui
-#  ui/tabkeyboardshortcutswidget.ui
-#  ui/tabmiscellaneous.ui
-#  ui/tabprinter.ui
-#  ui/tabscrapbook.ui
-#  ui/tocindexprefs.ui
   ui/transformdialogbase.ui
   ui/transparencypalette.ui
   ui/copypagetomasterpage.ui
@@ -176,7 +164,6 @@
   canvasgesture_rulermove.h
   canvasmode.h
   canvasmode_edit.h
-#  canvasmode_legacy.h
   canvasmode_measurements.h
   canvasmode_normal.h
   chartablemodel.h
@@ -273,14 +260,11 @@
   ui/dasheditor.h
   ui/dcolor.h
   ui/delpages.h
-#  ui/docitemattrprefs.h
-#  ui/docsections.h
   ui/editor.h
   ui/effectsdialog.h
   ui/extimageprops.h
   ui/fontcombo.h
   ui/fontlistview.h
-#  ui/fontprefs.h
   ui/fontreplacedialog.h
   ui/gradientaddedit.h
   ui/gradienteditor.h
@@ -292,7 +276,6 @@
   ui/helpbrowser.h
   ui/hruler.h
   ui/hyask.h
-#  ui/hysettings.h
   ui/imageinfodialog.h
   ui/insertTable.h
   ui/insertaframe.h
@@ -324,7 +307,6 @@
   ui/pagepalette.h
   ui/pageselector.h
   ui/paintmanager.h
-#  ui/patterndialog.h
   ui/patternpropsdialog.h
   ui/pdfopts.h
   ui/picsearch.h
@@ -333,8 +315,6 @@
   ui/pluginmanagerprefsgui.h
   ui/polygonwidget.h
   ui/polyprops.h
-#  ui/prefs.h
-#  ui/prefsdialogbase.h
   ui/preferencesdialog.h
   ui/prefs_colormanagement.h
   ui/prefs_display.h
@@ -387,7 +367,6 @@
   ui/propertywidget_textcolor.h
   ui/propertywidget_transparency.h
   ui/query.h
-#  ui/reformdoc.h
   ui/replacecolors.h
   ui/replaceonecolor.h
   ui/rulermover.h
@@ -433,22 +412,9 @@
   ui/styleview.h
   ui/swatchcombo.h
   ui/symbolpalette.h
-#  ui/tabcheckdoc.h
-#  ui/tabdisplay.h
-#  ui/tabdocument.h
-#  ui/tabexternaltoolswidget.h
-#  ui/tabgeneral.h
-#  ui/tabguides.h
-#  ui/tabkeyboardshortcutswidget.h
   ui/tabmanager.h
-#  ui/tabmiscellaneous.h
   ui/tabpdfoptions.h
-#  ui/tabprinter.h
   ui/tabruler.h
-#  ui/tabscrapbook.h
-#  ui/tabtools.h
-#  ui/tabtypography.h
-#  ui/tocindexprefs.h
   ui/transformdialog.h
   ui/transparencypalette.h
   tt/simpletreemodel/treemodel.h
@@ -467,7 +433,6 @@
 
 SET(SCRIBUS_SOURCES
   actionmanager.cpp
-#  annotation.cpp
   canvas.cpp
   canvasgesture_linemove.cpp
   canvasgesture_pan.cpp
@@ -487,7 +452,6 @@
   canvasmode_editgradient.cpp
   canvasmode_editmeshgradient.cpp
   canvasmode_editpolygon.cpp
-#  canvasmode_legacy.cpp
   canvasmode_magnifier.cpp
   canvasmode_measurements.cpp
   canvasmode_nodeedit.cpp
@@ -548,7 +512,6 @@
   page.cpp
   pageitem.cpp
   pageitem_arc.cpp
-#  pageitem_desaxe.cpp
   pageitem_group.cpp
   pageitem_imageframe.cpp
   pageitem_latexframe.cpp
@@ -636,7 +599,6 @@
   scxmlstreamreader.cpp
   selection.cpp
   serializer.cpp
-#  stencilreader.cpp
   styleitem.cpp
   textwriter.cpp
   tocgenerator.cpp
@@ -696,13 +658,10 @@
   ui/dasheditor.cpp
   ui/dcolor.cpp
   ui/delpages.cpp
-#  ui/docitemattrprefs.cpp
-#  ui/docsections.cpp
   ui/editor.cpp
   ui/effectsdialog.cpp
   ui/extimageprops.cpp
   ui/fontlistview.cpp
-#  ui/fontprefs.cpp
   ui/fontreplacedialog.cpp
   ui/gradientaddedit.cpp
   ui/gradienteditor.cpp
@@ -714,7 +673,6 @@
   ui/helpbrowser.cpp
   ui/hruler.cpp
   ui/hyask.cpp
-#  ui/hysettings.cpp
   ui/imageinfodialog.cpp
   ui/insertTable.cpp
   ui/insertaframe.cpp
@@ -748,7 +706,6 @@
   ui/pagepalette.cpp
   ui/pageselector.cpp
   ui/paintmanager.cpp
-#  ui/patterndialog.cpp
   ui/patternpropsdialog.cpp
   ui/pdfopts.cpp
   ui/picsearch.cpp
@@ -757,7 +714,6 @@
   ui/pluginmanagerprefsgui.cpp
   ui/polygonwidget.cpp
   ui/polyprops.cpp
-#  ui/prefs.cpp
   ui/preferencesdialog.cpp
   ui/prefs_colormanagement.cpp
   ui/prefs_display.cpp
@@ -784,7 +740,6 @@
   ui/prefs_pdfexport.cpp
   ui/prefs_tableofcontents.cpp
   ui/prefs_documentitemattributes.cpp
-#  ui/prefsdialogbase.cpp
   ui/prefspanel.cpp
   ui/preview.cpp
   ui/printdialog.cpp
@@ -811,7 +766,6 @@
   ui/propertywidget_transparency.cpp
   ui/propertywidgetbase.cpp
   ui/query.cpp
-#  ui/reformdoc.cpp
   ui/replacecolors.cpp
   ui/replaceonecolor.cpp
   ui/rulermover.cpp
@@ -861,22 +815,9 @@
   ui/styleview.cpp
   ui/swatchcombo.cpp
   ui/symbolpalette.cpp
-#  ui/tabcheckdoc.cpp
-#  ui/tabdisplay.cpp
-#  ui/tabdocument.cpp
-#  ui/tabexternaltoolswidget.cpp
-#  ui/tabgeneral.cpp
-#  ui/tabguides.cpp
-#  ui/tabkeyboardshortcutswidget.cpp
   ui/tabmanager.cpp
-#  ui/tabmiscellaneous.cpp
   ui/tabpdfoptions.cpp
-#  ui/tabprinter.cpp
   ui/tabruler.cpp
-#  ui/tabscrapbook.cpp
-#  ui/tabtools.cpp
-#  ui/tabtypography.cpp
-#  ui/tocindexprefs.cpp
   ui/transformdialog.cpp
   ui/transparencypalette.cpp
   tt/simpletreemodel/treeitem.cpp

Modified: branches/ScribusOIF/scribus/canvasmode_editarc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16257&path=/branches/ScribusOIF/scribus/canvasmode_editarc.cpp
==============================================================================
--- branches/ScribusOIF/scribus/canvasmode_editarc.cpp (original)
+++ branches/ScribusOIF/scribus/canvasmode_editarc.cpp Sat Jan 15 16:45:22 2011
@@ -256,7 +256,7 @@
 		FPointArray ar;
 		ar.fromQPainterPath(pp);
 		if (m_arcPoint == useControlStart)
-			startPoint = ar.pointQF(3);
+			startPoint = ar.pointQF(2);
 		else if (m_arcPoint == useControlSweep)
 			endPoint = ar.pointQF(ar.size() - 4);
 		currItem->update();
@@ -347,7 +347,7 @@
 		m_doc->AdjustItemSize(currItem);
 		item->arcStartAngle = startAngle;
 		item->arcSweepAngle = endAngle - startAngle;
-		startPoint = currItem->PoLine.pointQF(3);
+		startPoint = currItem->PoLine.pointQF(2);
 		endPoint = currItem->PoLine.pointQF(currItem->PoLine.size() - 4);
 		centerPoint = currItem->PoLine.pointQF(0);
 		widthPoint = QPointF(centerPoint.x() - item->arcWidth / 2.0, centerPoint.y());

Modified: branches/ScribusOIF/scribus/canvasmode_editpolygon.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16257&path=/branches/ScribusOIF/scribus/canvasmode_editpolygon.cpp
==============================================================================
--- branches/ScribusOIF/scribus/canvasmode_editpolygon.cpp (original)
+++ branches/ScribusOIF/scribus/canvasmode_editpolygon.cpp Sat Jan 15 16:45:22 2011
@@ -75,17 +75,11 @@
 {
 	p->save();
 	if (m_canvas->m_viewMode.operItemMoving)
-	{
 		drawOutline(p);
-	}
-	else
-	{
+	else
 		drawSelection(p, false);
-	}
 	if (m_doc->appMode == modeEditPolygon)
-	{
 		drawControlsPolygon(p, m_doc->m_Selection->itemAt(0));
-	}
 	p->restore();
 }
 
@@ -104,6 +98,11 @@
 	psx->drawPath(path);
 	psx->setPen(p1bd);
 	psx->drawLine(startPoint, endPoint);
+	if (polyUseFactor)
+	{
+		psx->drawLine(endPoint, innerCPoint);
+		psx->drawLine(startPoint, outerCPoint);
+	}
 	psx->setPen(p8b);
 	if (m_polygonPoint == useControlOuter)
 		psx->setPen(p8r);
@@ -115,24 +114,25 @@
 	else
 		psx->setPen(p8b);
 	psx->drawPoint(endPoint);
-/*	if (m_arcPoint == useControlWidth)
-		psx->setPen(p8r);
-	else
-		psx->setPen(p8b);
-	psx->drawPoint(widthPoint);
-	if (m_arcPoint == useControlHeight)
-		psx->setPen(p8r);
-	else
-		psx->setPen(p8b);
-	psx->drawPoint(heightPoint); */
+	if (polyUseFactor)
+	{
+		if (m_polygonPoint == useControlInnerCurve)
+			psx->setPen(p8r);
+		else
+			psx->setPen(p8b);
+		psx->drawPoint(innerCPoint);
+		if (m_polygonPoint == useControlOuterCurve)
+			psx->setPen(p8r);
+		else
+			psx->setPen(p8b);
+		psx->drawPoint(outerCPoint);
+	}
 }
 
 void CanvasMode_EditPolygon::enterEvent(QEvent *)
 {
 	if (!m_canvas->m_viewMode.m_MouseButtonPressed)
-	{
 		setModeCursor();
-	}
 }
 
 void CanvasMode_EditPolygon::leaveEvent(QEvent *e)
@@ -157,7 +157,7 @@
 	PageItem_RegularPolygon* item = currItem->asRegularPolygon();
 	centerPoint = QPointF(currItem->width() / 2.0, currItem->height() / 2.0);
 	startPoint = currItem->PoLine.pointQF(0);
-	endPoint = currItem->PoLine.pointQF(3);
+	endPoint = currItem->PoLine.pointQF(2);
 	polyCorners = item->polyCorners;
 	polyUseFactor = item->polyUseFactor;
 	polyFactor = item->polyFactor;
@@ -165,13 +165,19 @@
 	polyCurvature = item->polyCurvature;
 	polyInnerRot = item->polyInnerRot;
 	polyOuterCurvature = item->polyOuterCurvature;
-//	widthPoint = QPointF(centerPoint.x() - item->arcWidth / 2.0, centerPoint.y());
-//	heightPoint = QPointF(centerPoint.x(), centerPoint.y() - item->arcHeight / 2.0);
+	uint cx = polyUseFactor ? polyCorners * 2 : polyCorners;
+	double seg = 360.0 / cx;
+	double trueLength = sqrt(pow(sin(seg / 180.0 * M_PI) * (item->width() / 2.0), 2) + pow(cos(seg / 180.0 * M_PI) * (item->height() / 2.0) + (item->height()/2.0) - item->height(), 2));
+	QLineF innerLine = QLineF(endPoint, centerPoint);
+	innerLine.setAngle(innerLine.angle() + 90);
+	innerLine.setLength(trueLength * polyCurvature);
+	innerCPoint = innerLine.p2();
+	QLineF outerLine = QLineF(startPoint, currItem->PoLine.pointQF(6));
+	outerLine.setLength(outerLine.length() * polyOuterCurvature);
+	outerCPoint = outerLine.p2();
 	setModeCursor();
 	if (fromGesture)
-	{
 		m_view->update();
-	}
 }
 
 void CanvasMode_EditPolygon::deactivate(bool forGesture)
@@ -213,37 +219,6 @@
 	m->accept();
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
-	PageItem *currItem = 0;
-	if ((m_doc->m_Selection->isMultipleSelection()) || (m_doc->appMode != modeNormal))
-	{
-		if ((m_doc->m_Selection->isMultipleSelection()) && (m_doc->appMode == modeNormal))
-		{
-			if (GetItem(&currItem))
-			{
-				/* CB: old code, removing this as shift-alt select on an unselected table selects a cell now.
-				//#6789 is closed by sorting this.
-				if (currItem->isTableItem)
-				{
-					m_view->Deselect(false);
-					m_doc->m_Selection->addItem(currItem);
-					currItem->isSingleSel = true;
-					//CB FIXME dont call this if the added item is item 0
-					if (!m_doc->m_Selection->primarySelectionIs(currItem))
-						currItem->emitAllToGUI();
-					m_view->updateContents(currItem->getRedrawBounding(m_canvas->scale()));
-				}*/
-			}
-			return;
-		}
-		else
-		{
-			if (!(GetItem(&currItem) && (m_doc->appMode == modeEdit) && currItem->asTextFrame()))
-			{
-				mousePressEvent(m);
-				return;
-			}
-		}
-	}
 }
 
 void CanvasMode_EditPolygon::mouseMoveEvent(QMouseEvent *m)
@@ -263,6 +238,7 @@
 		
 		uint cx = polyUseFactor ? polyCorners * 2 : polyCorners;
 		double seg = 360.0 / cx;
+		double trueLength = sqrt(pow(sin(seg / 180.0 * M_PI) * (currItem->width() / 2.0), 2) + pow(cos(seg / 180.0 * M_PI) * (currItem->height() / 2.0) + (currItem->height()/2.0) - currItem->height(), 2));
 		
 		if (m_polygonPoint == useControlInner)
 		{
@@ -272,32 +248,34 @@
 			if (maxF <= 100)
 				polyFactor = factor;
 		}
+		if (m_polygonPoint == useControlOuter)
+			polyRotation = stLinA.angle() - 90;
+		if (m_polygonPoint == useControlInnerCurve)
+		{
+			QPointF ePoint = itemMatrix.map(endPoint);
+			QLineF stLinC = QLineF(ePoint, QPointF(newX, newY));
+			polyCurvature = stLinC.length() / trueLength;
+		}
+		if (m_polygonPoint == useControlOuterCurve)
+		{
+			QPointF sPoint = itemMatrix.map(startPoint);
+			QPointF sPoint2 = itemMatrix.map(currItem->PoLine.pointQF(6));
+			QLineF stLinCo = QLineF(sPoint, QPointF(newX, newY));
+			QLineF stLinCo2 = QLineF(sPoint, sPoint2);
+			polyOuterCurvature = stLinCo.length() / stLinCo2.length();
+		}
 		QPainterPath path = RegularPolygonPath(currItem->width(), currItem->height(), polyCorners, polyUseFactor, polyFactor, polyRotation, polyCurvature, polyInnerRot, polyOuterCurvature);
 		FPointArray ar;
 		ar.fromQPainterPath(path);
-		if (m_polygonPoint == useControlInner)
-			endPoint = ar.pointQF(3);
-/*		QPainterPath pp;
-		if (m_arcPoint == useControlStart)
-			startAngle += deltaAngle;
-		else if (m_arcPoint == useControlSweep)
-			endAngle += deltaAngle;
-		else if (m_arcPoint == useControlHeight)
-			heightPoint = QPointF(heightPoint.x(), heightPoint.y() + (newY - Myp));
-		else if (m_arcPoint == useControlWidth)
-			widthPoint = QPointF(widthPoint.x() + (newX - Mxp), widthPoint.y());
-		double nSweep = endAngle - startAngle;
-		double nWidth = sPoint.x() - widthPoint.x();
-		double nHeight = sPoint.y() - heightPoint.y();
-		pp.moveTo(sPoint);
-		pp.arcTo(QRectF(sPoint.x() - nWidth, sPoint.y() - nHeight, nWidth * 2, nHeight * 2), startAngle, nSweep);
-		pp.closeSubpath();
-		FPointArray ar;
-		ar.fromQPainterPath(pp);
-		if (m_arcPoint == useControlStart)
-			startPoint = ar.pointQF(3);
-		else if (m_arcPoint == useControlSweep)
-			endPoint = ar.pointQF(ar.size() - 4); */
+		endPoint = ar.pointQF(2);
+		startPoint = ar.pointQF(0);
+		QLineF innerLine = QLineF(endPoint, centerPoint);
+		innerLine.setAngle(innerLine.angle() + 90);
+		innerLine.setLength(trueLength * polyCurvature);
+		innerCPoint = innerLine.p2();
+		QLineF outerLine = QLineF(startPoint, ar.pointQF(6));
+		outerLine.setLength(outerLine.length() * polyOuterCurvature);
+		outerCPoint = outerLine.p2();
 		currItem->update();
 		QRectF upRect;
 		upRect = QRectF(QPointF(0, 0), QPointF(currItem->width(), currItem->height())).normalized();
@@ -337,18 +315,42 @@
 	stPoint = itemMatrix.map(stPoint);
 	QPointF swPoint = endPoint;
 	swPoint = itemMatrix.map(swPoint);
-/*	QPointF shPoint = heightPoint;
+	QPointF shPoint = innerCPoint;
 	shPoint = itemMatrix.map(shPoint);
-	QPointF sPoint = widthPoint;
-	sPoint = itemMatrix.map(sPoint); */
-	if (m_canvas->hitsCanvasPoint(m->globalPos(), stPoint))
-		m_polygonPoint = useControlOuter;
-	else if (m_canvas->hitsCanvasPoint(m->globalPos(), swPoint))
-		m_polygonPoint = useControlInner;
-/*	else if (m_canvas->hitsCanvasPoint(m->globalPos(), shPoint))
-		m_arcPoint = useControlHeight;
-	else if (m_canvas->hitsCanvasPoint(m->globalPos(), sPoint))
-		m_arcPoint = useControlWidth; */
+	QPointF sPoint = outerCPoint;
+	sPoint = itemMatrix.map(sPoint);
+	bool useOuter = m_canvas->hitsCanvasPoint(m->globalPos(), stPoint);
+	bool useInner = m_canvas->hitsCanvasPoint(m->globalPos(), swPoint);
+	bool useInnerC = m_canvas->hitsCanvasPoint(m->globalPos(), shPoint);
+	bool useOuterC = m_canvas->hitsCanvasPoint(m->globalPos(), sPoint);
+	if (useOuter && useOuterC)
+	{
+		if (m->modifiers() == Qt::ShiftModifier)
+			m_polygonPoint = useControlOuterCurve;
+		else
+			m_polygonPoint = useControlOuter;
+	}
+	else if (useOuter || useOuterC)
+	{
+		if (useOuterC)
+			m_polygonPoint = useControlOuterCurve;
+		else
+			m_polygonPoint = useControlOuter;
+	}
+	else if (useInner && useInnerC)
+	{
+		if (m->modifiers() == Qt::ShiftModifier)
+			m_polygonPoint = useControlInnerCurve;
+		else
+			m_polygonPoint = useControlInner;
+	}
+	else if (useInner || useInnerC)
+	{
+		if (useInnerC)
+			m_polygonPoint = useControlInnerCurve;
+		else
+			m_polygonPoint = useControlInner;
+	}
 	else
 		m_polygonPoint = noPointDefined;
 	qApp->changeOverrideCursor(QCursor(Qt::CrossCursor));
@@ -366,7 +368,7 @@
 	m->accept();
 	PageItem *currItem = m_doc->m_Selection->itemAt(0);
 	PageItem_RegularPolygon* item = currItem->asRegularPolygon();
-	if ((m_polygonPoint == useControlInner) || (m_polygonPoint == useControlOuter))
+	if ((m_polygonPoint == useControlInner) || (m_polygonPoint == useControlOuter) || (m_polygonPoint == useControlInnerCurve) || (m_polygonPoint == useControlOuterCurve))
 	{
 		double newX = mousePointDoc.x();
 		double newY = mousePointDoc.y();
@@ -377,10 +379,27 @@
 		QLineF stLinA = QLineF(cPoint, QPointF(newX, newY));
 		uint cx = polyUseFactor ? polyCorners * 2 : polyCorners;
 		double seg = 360.0 / cx;
+		double trueLength = sqrt(pow(sin(seg / 180.0 * M_PI) * (currItem->width() / 2.0), 2) + pow(cos(seg / 180.0 * M_PI) * (currItem->height() / 2.0) + (currItem->height()/2.0) - currItem->height(), 2));
 		if (m_polygonPoint == useControlInner)
 		{
 			polyInnerRot = stLinA.angle() - 90 - polyRotation - seg;
 			polyFactor = stLinA.length() / sqrt(pow(sin(stLinA.angle() * M_PI / 180.0) * currItem->height() / 2.0, 2) + pow(cos(stLinA.angle() * M_PI / 180.0) * currItem->width() / 2.0, 2));
+		}
+		if (m_polygonPoint == useControlOuter)
+			polyRotation = stLinA.angle() - 90;
+		if (m_polygonPoint == useControlInnerCurve)
+		{
+			QPointF ePoint = itemMatrix.map(endPoint);
+			QLineF stLinC = QLineF(ePoint, QPointF(newX, newY));
+			polyCurvature = stLinC.length() / trueLength;
+		}
+		if (m_polygonPoint == useControlOuterCurve)
+		{
+			QPointF sPoint = itemMatrix.map(startPoint);
+			QPointF sPoint2 = itemMatrix.map(currItem->PoLine.pointQF(6));
+			QLineF stLinCo = QLineF(sPoint, QPointF(newX, newY));
+			QLineF stLinCo2 = QLineF(sPoint, sPoint2);
+			polyOuterCurvature = stLinCo.length() / stLinCo2.length();
 		}
 		item->polyFactor = polyFactor;
 		item->polyRotation = polyRotation;

Modified: branches/ScribusOIF/scribus/canvasmode_editpolygon.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16257&path=/branches/ScribusOIF/scribus/canvasmode_editpolygon.h
==============================================================================
--- branches/ScribusOIF/scribus/canvasmode_editpolygon.h (original)
+++ branches/ScribusOIF/scribus/canvasmode_editpolygon.h Sat Jan 15 16:45:22 2011
@@ -60,8 +60,8 @@
 		noPointDefined,
 		useControlOuter,
 		useControlInner,
-		useControlHeight,
-		useControlWidth
+		useControlInnerCurve,
+		useControlOuterCurve
 	} ePolygonPoint;
 
 	inline bool GetItem(PageItem** pi);
@@ -76,8 +76,8 @@
 	QPointF startPoint;
 	QPointF endPoint;
 	QPointF centerPoint;
-	QPointF widthPoint;
-	QPointF heightPoint;
+	QPointF innerCPoint;
+	QPointF outerCPoint;
 	int polyCorners;
 	bool polyUseFactor;
 	double polyFactor;

Modified: branches/ScribusOIF/scribus/fpointarray.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16257&path=/branches/ScribusOIF/scribus/fpointarray.cpp
==============================================================================
--- branches/ScribusOIF/scribus/fpointarray.cpp (original)
+++ branches/ScribusOIF/scribus/fpointarray.cpp Sat Jan 15 16:45:22 2011
@@ -519,11 +519,12 @@
 };
 
 
-QString FPointArray::svgPath() const
+QString FPointArray::svgPath(bool closed) const
 {
 	QString tmp = "";
-	FPoint np, np1, np2;
+	FPoint np, np1, np2, np3;
 	bool nPath = true;
+	bool first = true;
 	if (size() > 3)
 	{
 		for (uint poi=0; poi < size()-3; poi += 4)
@@ -537,58 +538,25 @@
 			if (nPath)
 			{
 				np = point(poi);
+				if ((!first) && (closed))
+					tmp += "Z ";
 				tmp += "M"+QString::number(np.x())+" "+QString::number(np.y())+" ";
 				nPath = false;
+				first = false;
 			}
-			np = point(poi+1);
-			tmp += "C"+QString::number(np.x())+" "+QString::number(np.y())+" ";
-			np1 = point(poi+3);
-			tmp += QString::number(np1.x())+" "+QString::number(np1.y())+" ";
-			np2 = point(poi+2);
-			tmp += QString::number(np2.x())+" "+QString::number(np2.y())+" ";
-		}
+			np = point(poi);
+			np1 = point(poi+1);
+			np2 = point(poi+3);
+			np3 = point(poi+2);
+			if ((np == np1) && (np2 == np3))
+				tmp += QString("L%1 %2 ").arg(np3.x()).arg(np3.y());
+			else
+				tmp += QString("C%1 %2 %3 %4 %5 %6 ").arg(np1.x()).arg(np1.y()).arg(np2.x()).arg(np2.y()).arg(np3.x()).arg(np3.y());
+		}
+		if (closed)
+			tmp += "Z";
 	}
 	return tmp;
-/*	Xml_string result;
-	bool hasPoint = false;
-	double x, y, x1, y1, x2, y2, xe=0, ye=0; 
-	uint i=0;
-	while (i < size())
-	{
-		point(i++, &x, &y);
-		if (x > 900000 && y > 900000)  // marker for closepath
-		{
-			hasPoint = false;
-			continue;
-		}
-		if (!hasPoint || x != xe || y != ye) // start a subpath
-		{
-			result += "M";
-			result += QString::number(x);
-			result += " ";
-			result += QString::number(y);
-			result += "C";
-			hasPoint = true;
-		}
-		else 
-			result += " ";
-		
-		point(i++, &x1, &y1);
-		point(i++, &x2, &y2);
-		point(i++, &xe, &ye);
-		result += QString::number(x1);
-		result += " ";
-		result += QString::number(y1);
-		result += " ";
-		result += QString::number(x2);
-		result += " ";
-		result += QString::number(y2);
-		result += " ";
-		result += QString::number(xe);
-		result += " ";
-		result += QString::number(ye);
-	}
-	return result;	*/
 }
 
 QPainterPath FPointArray::toQPainterPath(bool closed)

Modified: branches/ScribusOIF/scribus/fpointarray.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16257&path=/branches/ScribusOIF/scribus/fpointarray.h
==============================================================================
--- branches/ScribusOIF/scribus/fpointarray.h (original)
+++ branches/ScribusOIF/scribus/fpointarray.h Sat Jan 15 16:45:22 2011
@@ -86,7 +86,7 @@
 	void svgClosePath();
 	void calculateArc(bool relative, double &curx, double &cury, double angle, double x, double y, double r1, double r2, bool largeArcFlag, bool sweepFlag);
 	bool parseSVG(const QString& svgPath);
-	QString svgPath() const;
+	QString svgPath(bool closed = false) const;
 	QPainterPath toQPainterPath(bool closed);
 	void fromQPainterPath(QPainterPath &path);
 private:

Modified: branches/ScribusOIF/scribus/plugins/barcodegenerator/barcode.ps
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16257&path=/branches/ScribusOIF/scribus/plugins/barcodegenerator/barcode.ps
==============================================================================
--- branches/ScribusOIF/scribus/plugins/barcodegenerator/barcode.ps (original)
+++ branches/ScribusOIF/scribus/plugins/barcodegenerator/barcode.ps Sat Jan 15 16:45:22 2011
@@ -3,10 +3,10 @@
 %%DocumentPaperSizes: a4
 %%EndComments
 
-% Barcode Writer in Pure PostScript - Version 2009-03-06
+% Barcode Writer in Pure PostScript - Version 2011-01-15
 % http://www.terryburton.co.uk/barcodewriter/
 %
-% Copyright (c) 2004-2009 Terry Burton
+% Copyright (c) 2004-2010 Terry Burton
 %
 % Permission is hereby granted, free of charge, to any
 % person obtaining a copy of this software and associated
@@ -32,18 +32,32 @@
 % CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 % IN THE SOFTWARE.
 
-% Uncomment this next line to allow these procedure definitions to 
-% remain resident within a printer's PostScript virtual machine 
-% so that the barcode generation capability persists between jobs.
+% Uncomment this next line to allow these named resource
+% definitions to remain resident within a printer's
+% PostScript virtual machine so that the barcode generation
+% capability persists between jobs.
 
 % serverdict begin 0 exitserver 
 
 % --BEGIN TEMPLATE--
 
+% --BEGIN PREAMBLE--
+currentglobal
+true setglobal
+/Generic /Category findresource
+dup length 1 add dict copy
+dup /InstanceType /packedarraytype put
+/uk.co.terryburton.bwipp exch /Category defineresource pop
+setglobal
+% --END PREAMBLE--
+
 % --BEGIN RENDERER renlinear--
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+begin
 /renlinear {
 
-    1 dict begin          % Confine variables to local scope
+    20 dict begin          % Confine variables to local scope
 
     /args exch def   % We are given some arguments
 
@@ -61,6 +75,7 @@
     /textsize 10 def
     /textxoffset 0 def
     /textyoffset 0 def
+    /textgaps 0 def
     /alttext () def
     /bordercolor (unset) def
     /backgroundcolor (unset) def
@@ -94,6 +109,7 @@
     /textsize textsize cvr def
     /textxoffset textxoffset cvr def
     /textyoffset textyoffset cvr def
+    /textgaps textgaps cvr def
     /alttext alttext cvlit def
     /bordercolor bordercolor cvlit def
     /backgroundcolor backgroundcolor cvlit def
@@ -119,13 +135,17 @@
     0 1 sbs length 1 add 2 idiv 2 mul 2 sub {
         /i exch def
         i 2 mod 0 eq {           % i is even
-            /d sbs i get barratio mul barratio sub 1 add def  % d=digit*r-r+1 
-            /h bhs i 2 idiv get 72 mul def  % Height from bhs
-            /c d 2 div x add def            % Centre of the bar = x + d/2
-            /y bbs i 2 idiv get 72 mul def  % Baseline from bbs
-            /w d inkspread sub def          % bar width = digit - inkspread
-            bars i 2 idiv [h c y w] put     % Add the bar entry
-            h maxh gt {/maxh h def} if
+            /d sbs i get barratio mul barratio sub 1 add def  % d=digit*r-r+1
+            sbs i get 0 ne {
+                /h bhs i 2 idiv get 72 mul def  % Height from bhs
+                /c d 2 div x add def            % Centre of the bar = x + d/2
+                /y bbs i 2 idiv get 72 mul def  % Baseline from bbs
+                /w d inkspread sub def          % bar width = digit - inkspread
+                bars i 2 idiv [h c y w] put     % Add the bar entry
+                h y add maxh gt {/maxh h y add def} if
+            } {
+                bars i 2 idiv -1 put            % Dummy entry
+            } ifelse
         } {
             /d sbs i get spaceratio mul spaceratio sub 1 add def  % d=digit*r-r+1 
         } ifelse
@@ -173,8 +193,11 @@
     0 setlinecap
     barcolor (unset) ne { barcolor setanycolor } if
     bars {
-        {} forall
-        newpath setlinewidth moveto 0 exch rlineto stroke
+        dup -1 ne {
+            aload pop newpath setlinewidth moveto 0 exch rlineto stroke
+        } {
+            pop
+        } ifelse
     } forall
     grestore
     
@@ -202,15 +225,39 @@
             } {
                 /tstr alttext def
             } ifelse
-            /textxpos textxoffset x tstr stringwidth pop sub 2 div add def
+
+            % Find true ascent of font
+            tstr length 0 eq {
+                0
+            } {
+                gsave
+                newpath 0 0 moveto (0) false charpath pathbbox
+                4 1 roll pop pop pop
+                grestore
+                currentfont /PaintType known {currentfont /PaintType get 2 eq} {false} ifelse
+                currentfont /StrokeWidth known and {
+                    currentfont /StrokeWidth get 2 div 0 exch
+                    currentfont /FontMatrix get dtransform
+                    dup mul exch dup mul add sqrt
+                    add
+                } if
+            } ifelse
+            /textascent exch def
+            /textwidth tstr stringwidth pop tstr length 1 sub textgaps mul add def
+
+            /textxpos textxoffset x textwidth sub 2 div add def
             textxalign (left) eq { /textxpos textxoffset def } if
-            textxalign (right) eq { /textxpos x textxoffset sub tstr stringwidth pop sub def } if
-            textxalign (offleft) eq { /textxpos tstr stringwidth pop textxoffset add neg def } if
+            textxalign (right) eq { /textxpos x textxoffset sub textwidth sub def } if
+            textxalign (offleft) eq { /textxpos textwidth textxoffset add neg def } if
             textxalign (offright) eq { /textxpos x textxoffset add def } if
-            /textypos textyoffset textsize add 3 sub neg def
+            textxalign (justify) eq textwidth x lt and {
+                /textxpos 0 def
+                /textgaps x textwidth sub tstr length 1 sub div def
+            } if
+            /textypos textyoffset textascent add 1 add neg def
             textyalign (above) eq { /textypos textyoffset maxh add 1 add def } if
-            textyalign (center) eq { /textypos textyoffset maxh textsize 4 sub sub 2 div add def } if
-            textxpos textypos moveto tstr show
+            textyalign (center) eq { /textypos textyoffset maxh textascent sub 2 div add def } if
+            textxpos textypos moveto textgaps 0 tstr ashow
         } ifelse
     } if    
 
@@ -238,12 +285,18 @@
     end
 
 } bind def
+/renlinear dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END RENDERER renlinear--
 
 % --BEGIN RENDERER renmatrix--
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+begin
 /renmatrix {
 
-    1 dict begin
+    20 dict begin
 
     /args exch def
 
@@ -302,12 +355,18 @@
     end
 
 } bind def
+/renmatrix dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END RENDERER renmatrix--
 
 % --BEGIN RENDERER renmaximatrix--
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+begin
 /renmaximatrix {
 
-    1 dict begin
+    20 dict begin
 
     /args exch def   % We are given some arguments
 
@@ -352,6 +411,9 @@
     end
 
 } bind def
+/renmaximatrix dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END RENDERER renmaximatrix--
 
 % --BEGIN ENCODER ean5--
@@ -359,9 +421,13 @@
 % --EXAM: 90200
 % --EXOP: includetext guardwhitespace
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
 /ean5 {
 
-    1 dict begin
+    20 dict begin
 
     /options exch def                   % We are given an option string
     /barcode exch def                   % We are given a barcode string
@@ -458,7 +524,7 @@
 
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /sbs [sbs {48 sub} forall]
     /bhs [16{height}repeat]
     /bbs [16{0}repeat]
@@ -471,11 +537,14 @@
     /bordertop 10
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/ean5 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER ean5--
 
 % --BEGIN ENCODER ean2--
@@ -483,9 +552,13 @@
 % --EXAM: 05
 % --EXOP: includetext guardwhitespace
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
 /ean2 {
 
-    1 dict begin
+    20 dict begin
 
     /options exch def                   % We are given an options string
     /barcode exch def                   % We are given a barcode string
@@ -567,7 +640,7 @@
 
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /sbs [sbs {48 sub} forall]
     /bhs [12{height}repeat]
     /bbs [12{0}repeat]
@@ -580,11 +653,14 @@
     /bordertop 10
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/ean2 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER ean2--
 
 % --BEGIN ENCODER ean13--
@@ -593,9 +669,15 @@
 % --EXAM: 977147396801
 % --EXOP: includetext guardwhitespace
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /ean2 dup /uk.co.terryburton.bwipp findresource put
+dup /ean5 dup /uk.co.terryburton.bwipp findresource put
+begin
 /ean13 {
 
-    1 dict begin
+    20 dict begin
 
     /options exch def                  % We are given an option string
     /barcode exch def                  % We are given a barcode string
@@ -738,6 +820,8 @@
             /includetext true
             /height height 0.15 sub
             /textxoffset 95 addongap add
+            /textsize textsize
+            /textfont textfont
         >> def
         addon length 2 eq {addon addopts //ean2 exec} if
         addon length 5 eq {addon addopts //ean5 exec} if
@@ -751,7 +835,7 @@
    
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /sbs sbs
     /bhs bhs
     /bbs bbs
@@ -762,11 +846,14 @@
     /borderbottom 5
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/ean13 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER ean13--
 
 % --BEGIN ENCODER ean8--
@@ -775,9 +862,15 @@
 % --EXAM: 01335583
 % --EXOP: includetext guardwhitespace height=0.5
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /ean2 dup /uk.co.terryburton.bwipp findresource put
+dup /ean5 dup /uk.co.terryburton.bwipp findresource put
+begin
 /ean8 {
 
-    1 dict begin
+    20 dict begin
 
     /options exch def                  % We are given an option string
     /barcode exch def                  % We are given a barcode string
@@ -816,6 +909,23 @@
         pop
         /addon () def
     } ifelse
+
+    % Add checksum digit
+    /pad 8 string def
+    /checksum 0 def
+    0 1 6 {
+        /i exch def
+        /barchar barcode i get 48 sub def
+        i 2 mod 0 ne {
+            /checksum barchar checksum add def
+        } {
+            /checksum barchar 3 mul checksum add def
+        } ifelse
+    } for
+    /checksum 10 checksum 10 mod sub 10 mod def
+    pad 0 barcode putinterval      % Add barcode to the start of the pad
+    pad 7 checksum 48 add put      % Put ascii for checksum at end of pad
+    /barcode pad def
  
     % Create an array containing the character mappings
     /encs
@@ -870,8 +980,8 @@
         /bhs [height height 8{height .075 sub}repeat height height 8{height .075 sub}repeat height height] def
         /bbs [0 0 8{.075}repeat 0 0 8{.075}repeat 0 0] def
     } {
-        /bhs [22{height}repeat]
-        /bbs [22{0}repeat]
+        /bhs [22{height}repeat] def
+        /bbs [22{0}repeat] def
         /txt [] def
     } ifelse
     /guardrightypos 0 def
@@ -883,6 +993,8 @@
             /includetext true
             /height height 0.15 sub
             /textxoffset 67 addongap add
+            /textsize textsize
+            /textfont textfont
         >> def
         addon length 2 eq {addon addopts //ean2 exec} if
         addon length 5 eq {addon addopts //ean5 exec} if
@@ -896,7 +1008,7 @@
 
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /sbs sbs
     /bhs bhs
     /bbs bbs
@@ -908,11 +1020,14 @@
     /borderbottom 5
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/ean8 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER ean8--
 
 % --BEGIN ENCODER upca--
@@ -921,9 +1036,15 @@
 % --EXAM: 78858101497
 % --EXOP: includetext
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /ean2 dup /uk.co.terryburton.bwipp findresource put
+dup /ean5 dup /uk.co.terryburton.bwipp findresource put
+begin
 /upca {
 
-    1 dict begin
+    20 dict begin
 
     /options exch def
     /barcode exch def             % We are given a barcode string
@@ -1054,6 +1175,8 @@
             /includetext true
             /height height 0.15 sub
             /textxoffset 95 addongap add
+            /textsize textsize
+            /textfont textfont
         >> def
         addon length 2 eq {addon addopts //ean2 exec} if
         addon length 5 eq {addon addopts //ean5 exec} if
@@ -1067,7 +1190,7 @@
 
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /sbs sbs
     /bhs bhs
     /bbs bbs
@@ -1078,11 +1201,14 @@
     /borderbottom 5
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/upca dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER upca--
 
 % --BEGIN ENCODER upce--
@@ -1091,9 +1217,15 @@
 % --EXAM: 0123456
 % --EXOP: includetext height=0.4
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /ean2 dup /uk.co.terryburton.bwipp findresource put
+dup /ean5 dup /uk.co.terryburton.bwipp findresource put
+begin
 /upce {
 
-    1 dict begin
+    20 dict begin
 
     /options exch def                   % We are given an option string
     /barcode exch def                   % We are given a barcode string
@@ -1123,6 +1255,11 @@
     /height height cvr def
     /addongap addongap cvr def    
 
+    % Ensure 0 or 1 number systems
+    barcode 0 get dup 48 ne exch 49 ne and {
+        /barcode () def
+    } if
+
     % Split off the addon
     barcode ( ) search {
         /barcode exch def
@@ -1150,6 +1287,7 @@
 
     % Derive the equivalent UPC-A for its checksum
     /upcacode (00000000000) 11 string copy def
+    upcacode 0 barcode 0 get put
     barcode 6 get 48 sub 2 le {
         upcacode 1 barcode 1 2 getinterval putinterval
         upcacode 3 barcode 6 1 getinterval putinterval
@@ -1252,6 +1390,8 @@
             /includetext true
             /height height 0.15 sub
             /textxoffset 51 addongap add
+            /textsize textsize
+            /textfont textfont
         >> def
         addon length 2 eq {addon addopts //ean2 exec} if
         addon length 5 eq {addon addopts //ean5 exec} if
@@ -1265,7 +1405,7 @@
 
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /sbs sbs
     /bhs bhs
     /bbs bbs
@@ -1276,11 +1416,14 @@
     /borderbottom 5
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/upce dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER upce--
 
 % --BEGIN ENCODER isbn--
@@ -1290,9 +1433,14 @@
 % --EXAM: 978-1-56592-479 54495
 % --EXOP: includetext guardwhitespace
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /ean13 dup /uk.co.terryburton.bwipp findresource put
+begin
 /isbn {
 
-    1 dict begin
+    20 dict begin
 
     /options exch def      % We are given an options string
     /isbntxt exch def      % We are given the isbn text with dashes
@@ -1304,6 +1452,7 @@
     /isbnpos (unset) def
     /height 1 def
     /addongap 12 def   
+    /legacy false def
  
     % Parse the input options
     options type /stringtype eq {
@@ -1325,7 +1474,7 @@
     } {
         /isbnpos isbnpos cvr def
     } ifelse
-   
+
     % Split off the addon
     isbntxt ( ) search {
         /isbntxt exch def
@@ -1336,6 +1485,14 @@
         /addon () def
     } ifelse
  
+    % Convert ISBN-10 to ISBN-13
+    legacy not isbntxt length 13 le and {
+        /pad isbntxt length 4 add string def
+        pad 0 (978-) putinterval
+        pad 4 isbntxt putinterval
+        /isbntxt pad def
+    } if
+
     % Read the digits from isbntxt and calculate checksums
     /isbn 13 string def
     /checksum10 0 def
@@ -1427,32 +1584,44 @@
     args (opt) options put
     args
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
  
 } bind def
+/isbn dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER isbn--
 
-% --BEGIN ENCODER code128--
-% --DESC: Code 128
-% --EXAM: ^104^102Count^0990123456789^101!
-% --EXOP: includetext
+% --BEGIN ENCODER ismn--
+% --REQUIRES ean13--
+% --SUGGESTS ean5 ean2--
+% --DESC: ISMN
+% --EXAM: 979-0-2600-0043
+% --EXOP: includetext guardwhitespace
 % --RNDR: renlinear
-/code128 {
-
-    1 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
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /ean13 dup /uk.co.terryburton.bwipp findresource put
+begin
+/ismn {
+
+    20 dict begin
+
+    /options exch def      % We are given an options string
+    /ismntxt exch def      % We are given the ismn text with dashes
 
     /dontdraw false def
-    /includetext false def    % Enable/disable text
-    /textfont /Courier def
-    /textsize 10 def
-    /textyoffset -7 def
+    /includetext false def  % Enable/disable ISMN text
+    /ismnfont /Courier def
+    /ismnsize 9 def
+    /ismnpos (unset) def
     /height 1 def
-    
+    /addongap 12 def   
+    /legacy false def
+
     % Parse the input options
     options type /stringtype eq {
         1 dict begin
@@ -1463,12 +1632,648 @@
         currentdict end /options exch def
     } if
     options {def} forall
+    
+    /ismnfont ismnfont cvlit def
+    /ismnsize ismnsize cvr def
+    /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 {
+        /ismntxt exch def
+        pop
+        /addon exch def
+    } {
+        pop
+        /addon () def
+    } ifelse
+
+    % Convert old ISMN to ISMN-13
+    /legacytxt () def
+    ismntxt 0 1 getinterval (M) eq ismntxt length 13 le and {
+        /legacytxt ismntxt def
+        /pad ismntxt length 4 add string def
+        pad 0 (979-0-) putinterval
+        pad 6 ismntxt 2 ismntxt length 2 sub getinterval putinterval
+        /ismntxt pad def
+    } if
+
+    % Read the digits from ismntxt and calculate checksums
+    /ismn 13 string def
+    /checksum 0 def
+    /i 0 def /n 0 def
+    { % loop
+        /ismnchar ismntxt i get 48 sub def
+        ismnchar -3 ne {           % Ignore dashes
+            ismn n ismnchar 48 add put
+            n 12 lt {
+                n 2 mod 0 eq {
+                    /checksum ismnchar checksum add def
+                } {
+                    /checksum ismnchar 3 mul checksum add def
+                } ifelse
+            } if
+            /n n 1 add def
+        } if
+        /i i 1 add def
+        i ismntxt length eq {exit} if
+    } loop
+    /checksum 10 checksum 10 mod sub 10 mod def
+
+    % Add the ISMN header to the ismntxt
+    legacy legacytxt () ne and {
+        /ismntxt legacytxt def
+        /pad 18 string def
+    } {
+        /pad 22 string def
+    } ifelse
+    pad 0 (ISMN ) putinterval
+    pad 5 ismntxt putinterval  % Add ismntxt to the pad
+
+    % Add checksum digit
+    pad pad length 2 sub 45 put  % Put a dash
+    pad pad length 1 sub checksum 48 add put  % Put check digit
+    /ismntxt pad def
+
+    % Convert ISMN digits to EAN-13
+    /barcode ismn 0 12 getinterval def 
+
+    % Append the addon
+    addon () ne {
+        12 addon length add 1 add string 
+        dup 0 barcode putinterval
+        dup 12 ( ) putinterval
+        dup 13 addon putinterval
+        /barcode exch def
+    } if
+
+    % Get the result of encoding with ean13
+    options (dontdraw) true put
+    options (addongap) addongap put 
+    /args barcode options //ean13 exec def
+
+    % Add the ISMN text
+    includetext {
+        ismntxt length 18 eq {
+            /ismnxpos -1 def
+        } {
+            /ismnxpos -12 def
+        } ifelse
+        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
+            args (txt) newtxt put
+        } {
+            args (txt) [ [ismntxt ismnxpos ismnpos ismnfont ismnsize] ] put
+        } ifelse
+    } if
+
+    args (opt) options put
+    args
+
+    dontdraw not //renlinear if
+
+    end
  
+} bind def
+/ismn dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER ismn--
+
+% --BEGIN ENCODER issn--
+% --REQUIRES ean13--
+% --SUGGESTS ean2 ean5--
+% --DESC: ISSN
+% --EXAM: 0317-8471 00 05
+% --EXOP: includetext guardwhitespace
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /ean13 dup /uk.co.terryburton.bwipp findresource put
+begin
+/issn {
+
+    20 dict begin
+
+    /options exch def      % We are given an options string
+    /issntxt exch def      % We are given the issn text with dashes
+
+    /dontdraw false def
+    /includetext false def  % Enable/disable ISSN text
+    /issnfont /Courier def
+    /issnsize 9 def
+    /issnpos (unset) def
+    /height 1 def
+    /addongap 12 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
+    
+    /issnfont issnfont cvlit def
+    /issnsize issnsize cvr def
+    /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 {
+        /issntxt exch def
+        pop
+        /seqvar exch def
+    } if
+
+    % Split off the sequence variant and 2 digit addon
+    seqvar ( ) search {
+        /seqvar exch def
+        pop
+        2 string dup exch 0 4 -1 roll putinterval /addon exch def
+    } {
+        pop
+        /addon () def
+    } ifelse
+
+    % Read the digits from issntxt and calculate checksums
+    /issn 8 string def
+    /checksum 0 def
+    /i 0 def /n 0 def
+    { % loop
+        /issnchar issntxt i get 48 sub def
+        issnchar -3 ne {           % Ignore dashes
+            issn n issnchar 48 add put
+            n 7 lt {
+                /checksum checksum issnchar 8 n sub mul add def
+            } if
+            /n n 1 add def
+        } if
+        /i i 1 add def
+        i issntxt length eq {exit} if
+    } loop
+    /checksum 11 checksum 11 mod sub 11 mod def
+
+    % Add the ISSN header to the issntxt
+    /pad 14 string def
+    pad 0 (ISSN ) putinterval
+    pad 5 issntxt putinterval  % Add issntxt to the pad
+
+    % Add checksum digit
+    pad 13 checksum 48 add dup 58 eq {pop 88} if put  % Put check digit
+    /issntxt pad def
+
+    % Convert ISSN digits to EAN-13
+    /barcode issn 0 7 getinterval def 
+
+    % Append the sequence variant
+    /barcode 12 string def
+    barcode 0 (977) putinterval
+    barcode 3 issn putinterval
+    barcode 10 seqvar putinterval
+
+    % Append the addon
+    addon () ne {
+        12 addon length add 1 add string 
+        dup 0 barcode putinterval
+        dup 12 ( ) putinterval
+        dup 13 addon putinterval
+        /barcode exch def
+    } if
+
+    % Get the result of encoding with ean13
+    options (dontdraw) true put
+    options (addongap) addongap put 
+    /args barcode options //ean13 exec def
+
+    % Add the ISSN text
+    includetext {
+        /issnxpos 10 def
+        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
+            args (txt) newtxt put
+        } {
+            args (txt) [ [issntxt issnxpos issnpos issnfont issnsize] ] put
+        } ifelse
+    } if
+
+    args (opt) options put
+    args
+
+    dontdraw not //renlinear if
+
+    end
+ 
+} bind def
+/issn dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER issn--
+
+% --BEGIN ENCODER code128--
+% --DESC: Code 128
+% --EXAM: Count01234567^FNC2!
+% --EXOP: includetext parsefnc
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
+/code128 {
+
+    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
+    /includetext false def    % Enable/disable text
+    /textfont /Courier def
+    /textsize 10 def
+    /textxoffset 0 def
+    /textyoffset -7 def
+    /height 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
+
     /textfont textfont cvlit def
     /textsize textsize cvr def
+    /textxoffset textxoffset cvr def
     /textyoffset textyoffset cvr def
     /height height cvr 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
+
+    % Special function characters
+    /sta  -1 def  /stb  -2 def  /stc  -3 def 
+    /swa  -4 def  /swb  -5 def  /swc  -6 def 
+    /fn1  -7 def  /fn2  -8 def  /fn3  -9 def 
+    /fn4 -10 def  /sft -11 def  /stp -12 def
+    /lka -13 def  /lkc -14 def  % CC-A/B and CC-C linkage
+
+    % 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  ]  [ stb  stb  stb  ]  % 102-104
+      [ stc  stc  stc  ]  [ stp  stp  stp  ]                      % 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
+
+    % Include pseudo characters for GS1-128 Composite linkage identifiers
+    seta lka seta swb get put  seta lkc seta swc get put
+    setb lka setb swc get put  setb lkc setb swa get put
+    setc lka setc swa get put  setc lkc setc swb get put
+
+    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
+            (LNKA) lka
+            (LNKC) lkc
+        >> def
+
+        % Convert input into bytes accounting for FNC and LNK characters 
+        /msg barlen array def
+        /text barlen string def
+        /i 0 def /j 0 def {
+            i barlen eq {exit} if
+            /char barcode i get def
+            text j char put
+            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
+                    text j ( ) putinterval
+                    /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
+        /text text 0 j getinterval 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
+                dup 48 lt exch 57 gt or {
+                    % Non-digit 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 cws exch j exch put
+                /j j 1 add def
+            } {
+                /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
+            } ifelse
+        } 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
+        
+        /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
+        {  % common exit
+            msglen 0 eq {
+                stb enca
+                /cset (setb) def
+                exit
+            } if
+            msglen 2 eq nums 2 eq and {
+                stc enca
+                /cset (setc) def
+                exit
+            } if
+            nums 4 ge {
+                stc enca
+                /cset (setc) def
+                exit
+            } if
+            nchars msglen lt {
+                msg nchars get anotb {
+                    sta enca
+                    /cset (seta) def
+                    exit
+                } if
+            } 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
+            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
+                } if
+                cset (setb) eq msg i get anotb and {
+                    i msglen 1 sub lt {
+                        msg i 1 add get bnota {
+                            sft encb
+                            msg i get enca
+                            /i i 1 add def
+                            exit
+                        } if
+                    } if
+                    swa encb
+                    /cset (seta) def
+                    exit
+                } if
+                cset (seta) eq msg i get bnota and {
+                    i msglen 1 sub lt {
+                        msg i 1 add get anotb {
+                            sft enca
+                            msg i get encb
+                            /i i 1 add def
+                            exit
+                        } if
+                    } if
+                    swb enca
+                    /cset (setb) def
+                    exit
+                } if
+                cset (setc) eq nums 2 lt and {
+                    msg i get anotb {
+                        swa encc
+                        /cset (seta) def
+                    } {
+                        swb encc
+                        /cset (setb) def
+                    } ifelse
+                    exit
+                } if
+        
+                % No switches or latches so encode
+                cset (seta) eq {
+                    msg i get enca
+                    /i i 1 add def
+                } if
+                cset (setb) eq {
+                    msg i get encb
+                    /i i 1 add def
+                } 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
+                    } ifelse
+                } if
+         
+                exit
+            } loop
+        
+        } 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
+    1 1 j 1 sub {
+        /i exch def
+        /csum csum cws i get i mul add def
+    } for
+    /csum csum 103 mod def
+    cws j csum put
+    cws j 1 add seta stp get put
+
     % Create an array containing the character mappings
     /encs
     [ (212222) (222122) (222221) (121223) (121322) (131222) (122213)
@@ -1489,88 +2294,379 @@
       (211232) (2331112)
     ] def
 
-    % Create a string of the available characters for alphabets A and B
-    /barchars ( !"#$%&'\(\)*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~) def
-    /barlen barcode length def    % Length of the code
-    /sbs barlen 6 mul string def  % sbs is 6 times length of barcode
-    /txt barlen array def
-
-    /mode -1 def         % A=0, B=1, C=2
-    /checksum barcode 1 3 getinterval cvi def  % Initialise the checksum
-
-    /i 0 def /j 0 def
-    { % loop
-        i barlen eq {exit} if
-        barcode i 1 getinterval (^) eq {
-            % indx is given by the next three characters
-            /indx barcode i 1 add 3 getinterval cvi def
-            txt j [( ) j 11 mul textyoffset textfont textsize] put
-            /i i 4 add def
-        } {
-            % indx depends on the mode
-            mode 2 eq {
-                /indx barcode i 2 getinterval cvi def
-                txt j [barcode i 2 getinterval j 11 mul textyoffset textfont textsize] put
-                /i i 2 add def
-            } {
-                barchars barcode i 1 getinterval search
-                pop                    % Discard true leaving pre
-                length /indx exch def  % indx is the length of pre
-                pop pop                % Discard seek and post
-                txt j [barchars indx 1 getinterval j 11 mul textyoffset textfont textsize] put
-                /i i 1 add def
-            } ifelse
-        } ifelse
-        /enc encs indx get def         % Get the indxth encoding
-        sbs j 6 mul enc putinterval    % Put encoded digit into sbs
-
-        % Update the mode
-        indx 101 eq indx 103 eq or {/mode 0 def} if
-        indx 100 eq indx 104 eq or {/mode 1 def} if
-        indx 99 eq indx 105 eq or {/mode 2 def} if
-
-        /checksum indx j mul checksum add def  % checksum+=indx*j
-        /j j 1 add def
-    } loop
-
-    % Put the checksum character
-    /checksum checksum 103 mod def
-    sbs j 6 mul encs checksum get putinterval
-
-    % Put the end character
-    sbs j 6 mul 6 add encs 106 get putinterval
-
-    % Shrink sbs and txt to fit exactly
-    /sbs sbs 0 j 6 mul 13 add getinterval def
-    /txt txt 0 j getinterval def
+    % Derive space bar succession
+    /sbs cws length 6 mul 1 add string def
+    0 1 cws length 1 sub {
+        /i exch def
+        sbs i 6 mul encs cws i get get putinterval
+    } for
 
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /sbs [sbs {48 sub} forall]
     /bhs [sbs length 1 add 2 idiv {height} repeat]
     /bbs [sbs length 1 add 2 idiv {0} repeat]
-    includetext {
-        /txt txt
-    } if
+    /txt [ [text textxoffset textyoffset textfont textsize] ]
+    /textxalign (center)
     /opt options
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/code128 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER code128--
+
+% --BEGIN ENCODER gs1-128--
+% --REQUIRES code128--
+% --DESC: GS1-128
+% --EXAM: (01)95012345678903(3103)000123
+% --EXOP: includetext
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /code128 dup /uk.co.terryburton.bwipp findresource put
+begin
+/gs1-128 {
+
+    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
+    /includetext false def    % Enable/disable text
+    /textfont /Courier def
+    /textsize 10 def
+    /textxoffset 0 def
+    /textyoffset -7 def
+    /height 1 def
+    /linkagea false def
+    /linkagec 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
+
+    /textfont textfont cvlit def
+    /textsize textsize cvr def
+    /textxoffset textxoffset cvr def
+    /textyoffset textyoffset cvr def
+    /height height cvr def 
+   
+    /text barcode def
+ 
+    % 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 code128 data 
+    /fnc1 -1 def
+    /c128 [ fnc1 ] def
+    0 1 ais length 1 sub {
+        /i exch def
+        /ai ais i get def
+        /val aival ai get def
+        c128 length ai length add val length add array
+        dup 0 c128 putinterval
+        dup c128 length ai [ exch {} forall ] putinterval
+        dup c128 length ai length add val [ exch {} forall ] putinterval
+        /c128 exch def
+        i ais length 1 sub ne aifixed ai 0 2 getinterval known not and {  % Append FNC1
+            c128 length 1 add array
+            dup 0 c128 putinterval
+            dup c128 length fnc1 put
+            /c128 exch def
+        } if
+    } for
+
+    % Compose input to code128
+    /barcode c128 length 1 add 5 mul string def
+    /i 0 def /j 0 def {
+        i c128 length eq {exit} if
+        c128 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
+    linkagea linkagec or {
+        barcode j linkagea {(^LNKA)} {(^LNKC)} ifelse putinterval
+        /j j 5 add def
+    } if
+    /barcode barcode 0 j getinterval def
+
+    % Get the result of encoding with code128
+    options (dontdraw) true put
+    options (parsefnc) true put
+    /args barcode options //code128 exec def
+
+    args (txt) [ [text textxoffset textyoffset textfont textsize] ] put
+    args (textxalign) (center) put
+    args (opt) options put
+    args
+ 
+    dontdraw not //renlinear if
+ 
+    end
+
+} bind def
+/gs1-128 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER gs1-128--
+
+% --BEGIN ENCODER ean14--
+% --REQUIRES code128--
+% --DESC: GS1-14
+% --EXAM: (01)04601234567893
+% --EXOP: includetext
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /code128 dup /uk.co.terryburton.bwipp findresource put
+begin
+/ean14 {
+
+    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
+    /includetext false def    % Enable/disable text
+    /textfont /Courier def
+    /textsize 10 def
+    /textxoffset 0 def
+    /textyoffset -7 def
+    /height 1 def
+ 
+    % Parse the input options
+    options type /stringtype eq {
+        1 dict begin
+        options {
+            token false eq {exit} if dup length string cvs (=) search
+            true eq {cvlit exch pop exch def} {cvlit true def} ifelse
+        } loop
+        currentdict end /options exch def
+    } if
+    options {def} forall
+
+    /textfont textfont cvlit def
+    /textsize textsize cvr def
+    /textxoffset textxoffset cvr def
+    /textyoffset textyoffset cvr def
+    /height height cvr def 
+
+    % Calculate EAN checksum and add to end of barcode
+    barcode length dup 17 eq exch 18 eq or 
+    barcode 0 4 getinterval (\(01\)) eq and {
+        /checksum 0 def
+        0 1 12 {
+            /i exch def
+            /checksum checksum barcode i 4 add get 48 sub i 2 mod 0 eq {3 mul} if add def
+        } for 
+        /checksum 10 checksum 10 mod sub 10 mod def
+        18 string
+        dup 0 barcode 0 17 getinterval putinterval
+        dup 17 checksum 48 add put
+        /barcode exch def
+        /gtin barcode 4 14 getinterval def
+    } if
+
+    % Compose input to code128
+    /text barcode def
+    /barcode 21 string def
+    barcode 0 (^FNC101) putinterval
+    barcode 7 gtin putinterval
+
+    % Get the result of encoding with code128
+    options (dontdraw) true put
+    options (parsefnc) true put
+    /args barcode options //code128 exec def
+
+    args (txt) [ [text textxoffset textyoffset textfont textsize] ] put
+    args (textxalign) (center) put
+    args (opt) options put
+    args
+ 
+    dontdraw not //renlinear if
+ 
+    end
+
+} bind def
+/ean14 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER ean14--
+
+% --BEGIN ENCODER sscc18--
+% --REQUIRES code128--
+% --DESC: SSCC-18
+% --EXAM: (00)006141411234567890
+% --EXOP: includetext
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /code128 dup /uk.co.terryburton.bwipp findresource put
+begin
+/sscc18 {
+
+    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
+    /includetext false def    % Enable/disable text
+    /textfont /Courier def
+    /textsize 10 def
+    /textxoffset 0 def
+    /textyoffset -7 def
+    /height 1 def
+ 
+    % Parse the input options
+    options type /stringtype eq {
+        1 dict begin
+        options {
+            token false eq {exit} if dup length string cvs (=) search
+            true eq {cvlit exch pop exch def} {cvlit true def} ifelse
+        } loop
+        currentdict end /options exch def
+    } if
+    options {def} forall
+
+    /textfont textfont cvlit def
+    /textsize textsize cvr def
+    /textxoffset textxoffset cvr def
+    /textyoffset textyoffset cvr def
+    /height height cvr def 
+
+    % Calculate EAN checksum and add to end of barcode
+    barcode length dup 21 eq exch 22 eq or 
+    barcode 0 4 getinterval (\(00\)) eq and {
+        /checksum 0 def
+        0 1 16 {
+            /i exch def
+            /checksum checksum barcode i 4 add get 48 sub i 2 mod 0 eq {3 mul} if add def
+        } for 
+        /checksum 10 checksum 10 mod sub 10 mod def
+        22 string
+        dup 0 barcode 0 21 getinterval putinterval
+        dup 21 checksum 48 add put
+        /barcode exch def
+        /sscc barcode 4 18 getinterval def
+    } if
+
+    % Compose input to code128
+    /text barcode def
+    /barcode 25 string def
+    barcode 0 (^FNC100) putinterval
+    barcode 7 sscc putinterval
+
+    % Get the result of encoding with code128
+    options (dontdraw) true put
+    options (parsefnc) true put
+    /args barcode options //code128 exec def
+
+    args (txt) [ [text textxoffset textyoffset textfont textsize] ] put
+    args (textxalign) (center) put
+    args (opt) options put
+    args
+ 
+    dontdraw not //renlinear if
+ 
+    end
+
+} bind def
+/sscc18 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER sscc18--
 
 % --BEGIN ENCODER code39--
 % --DESC: Code 39
 % --EXAM: THIS IS CODE 39
 % --EXOP: includetext includecheck includecheckintext
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
 /code39 {
 
-    1 dict begin                 % Confine variables to local scope
+    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
@@ -1676,7 +2772,7 @@
     
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /sbs [sbs {48 sub} forall]
     /bhs [sbs length 1 add 2 idiv {height} repeat]
     /bbs [sbs length 1 add 2 idiv {0} repeat]
@@ -1686,21 +2782,306 @@
     /opt options
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/code39 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER code39--
+
+% --BEGIN ENCODER code39ext--
+% --REQUIRES code39--
+% --DESC: Code 39 Extended
+% --EXAM: Code39 Ext!
+% --EXOP: includetext includecheck includecheckintext
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /code39 dup /uk.co.terryburton.bwipp findresource put
+begin
+/code39ext {
+
+    20 dict begin
+
+    /options exch def      % We are given an options string
+    /barcode exch def      % We are given the code39extended text
+
+    /dontdraw false def
+    /includetext 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
+
+    % 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
+
+    % Extended alphabet to non-extended alphabet
+    /extencs
+    [ (%U) ($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) (%A) (%B) (%C) (%D) (%E)
+      ( )  (/A) (/B) (/C) (/D) (/E) (/F) (/G) (/H) (/I) (/J) (/K) (/L) (-)  (.)  (/O)
+      (0)  (1)  (2)  (3)  (4)  (5)  (6)  (7)  (8)  (9)  (/Z) (%F) (%G) (%H) (%I) (%J)
+      (%V) (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)  (%K) (%L) (%M) (%N) (%O)
+      (%W) (+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) (%P) (%Q) (%R) (%S) (%T)
+    ] def
+
+    /newcode barlen 2 mul string def
+    /newtext barlen 2 mul string def
+    /j 0 def
+    0 1 barlen 1 sub {
+        /i exch def
+        /extchar extencs barcode i get get def
+        newcode j extchar putinterval
+        newtext j barcode i get put
+        extchar length 1 ne {newtext j 1 add ( ) putinterval} if
+        /j j extchar length add def
+    } for
+    /newcode newcode 0 j getinterval def
+    /newtext newtext 0 j getinterval def
+
+    % Get the result of encoding with code39
+    options (dontdraw) true put
+    /args newcode options //code39 exec def
+
+    % Replace chars in /txt with chars in newtext
+    includetext {
+        /txt args (txt) get def
+        0 1 newtext length 1 sub {
+            /i exch def
+            /txtentry txt i 1 add get def
+            txtentry 0 newtext i 1 getinterval put
+            txt i 1 add txtentry put
+        } for
+        args (txt) txt put
+    } if
+    args (opt) options put
+    args
+
+    dontdraw not //renlinear if
+
+    end
+
+} bind def
+/code39ext dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER code39ext--
+
+% --BEGIN ENCODER code32--
+% --REQUIRES code39--
+% --DESC: Italian PharmaCode
+% --EXAM: 01234567
+% --EXOP: includetext
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /code39 dup /uk.co.terryburton.bwipp findresource put
+begin
+/code32 {
+
+    20 dict begin
+
+    /options exch def      % We are given an options string
+    /barcode exch def      % We are given a barcode string
+
+    /dontdraw false def
+    /includetext false def  % Enable/disable code32 text
+    /textfont /Courier def
+    /textsize 10 def
+    /textyoffset -7 def
+    /textxoffset 0 def
+    /height 1 def
+
+    % Parse the input options
+    options type /stringtype eq {
+        1 dict begin
+        options {
+            token false eq {exit} if dup length string cvs (=) search
+            true eq {cvlit exch pop exch def} {cvlit true def} ifelse
+        } loop
+        currentdict end /options exch def
+    } if
+    options {def} forall
+
+    /textfont textfont cvlit def
+    /textsize textsize cvr def
+    /textyoffset textyoffset cvr def
+    /height height cvr def
+
+    /text 10 string def
+    text 0 barcode 0 8 getinterval putinterval
+
+    % calculate check digit
+    text 8 0
+    0 1 7 {
+        dup text exch get 48 sub exch 1 and 1 add mul dup 9 gt {9 sub} if add
+    } for
+    10 mod 48 add put
+
+    % convert number from base10 to base32
+    /val text cvi 32 barcode cvrs def
+    /barcode 6 string def
+    0 1 5 {barcode exch 48 put} for
+    barcode 6 val length sub val putinterval
+
+    % convert base32 number to specified character set
+    0 1 5 {
+        dup barcode exch get
+        dup (AEIO) {ge {1 add} if dup} forall pop
+        barcode 3 1 roll put
+    } for
+
+    % format HRI
+    text 1 text 0 9 getinterval putinterval
+    text 0 65 put
+
+    % Get the result of encoding with code39
+    options (dontdraw) true put
+    /args barcode options //code39 exec def
+
+    args (txt) [ [text textxoffset textyoffset textfont textsize] ] put
+    args (textxalign) (center) put
+    args (opt) options put
+    args
+
+    dontdraw not //renlinear if
+
+    end
+
+} bind def
+/code32 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER code32--
+
+% --BEGIN ENCODER pzn--
+% --REQUIRES code39--
+% --DESC: Pharmazentralnummer (PZN)
+% --EXAM: 123456
+% --EXOP: includetext
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /code39 dup /uk.co.terryburton.bwipp findresource put
+begin
+/pzn {
+
+    20 dict begin
+ 
+    /options exch def      % We are given an options string
+    /barcode exch def      % We are given a barcode string
+ 
+    /dontdraw false def
+    /includetext false def  % Enable/disable code32 text
+    /textfont /Courier def
+    /textsize 10 def
+    /textyoffset -7 def
+    /textxoffset 0 def
+    /height 1 def
+ 
+    % Parse the input options
+    options type /stringtype eq {
+        1 dict begin
+        options {
+            token false eq {exit} if dup length string cvs (=) search
+            true eq {cvlit exch pop exch def} {cvlit true def} ifelse
+        } loop
+        currentdict end /options exch def
+    } if
+    options {def} forall
+ 
+    /textfont textfont cvlit def
+    /textsize textsize cvr def
+    /textyoffset textyoffset cvr def
+    /textxoffset textxoffset cvr def
+    /height height cvr def
+ 
+    /text 13 string def
+    text 0 barcode 0 6 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
+ 
+    % Get the result of encoding with code39
+    options (dontdraw) true put
+    /args barcode options //code39 exec def
+ 
+    % format HRI
+    text 6 text 0 7 getinterval putinterval
+    text 0 (PZN - ) putinterval
+ 
+    args (txt) [ [text textxoffset textyoffset textfont textsize] ] put
+    args (textxalign) (center) put
+    args (opt) options put
+    args
+ 
+    dontdraw not //renlinear if
+ 
+    end
+ 
+} bind def
+/pzn dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER pzn--
 
 % --BEGIN ENCODER code93--
 % --DESC: Code 93
 % --EXAM: THIS IS CODE 93
 % --EXOP: includetext includecheck
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
 /code93 {
 
-    1 dict begin                 % Confine variables to local scope
+    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
@@ -1712,7 +3093,8 @@
     /textsize 10 def
     /textyoffset -7 def
     /height 1 def
-    
+    /parsefnc false def   
+ 
     % Parse the input options
     options type /stringtype eq {
         1 dict begin
@@ -1745,63 +3127,84 @@
     % Create a string of the available characters
     /barchars (0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%) def
 
-    /barlen barcode length def  % Length of the code    
-    barcode {
-        (^) search false eq {pop exit} if
-        pop pop /barlen barlen 3 sub def
+    /barlen barcode length def
+
+    % Special function characters
+    /sft1 -1 def  /sft2 -2 def  /sft3 -3 def  /sft4 -4 def
+    /fncvals <<
+        (SFT$) sft1
+        (SFT%) sft2
+        (SFT/) sft3
+        (SFT+) sft4
+    >> def
+
+    % Convert input into bytes accounting for shift characters 
+    /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
 
     includecheck {
-        /sbs barlen 6 mul 25 add string def
+        /sbs msglen 6 mul 25 add string def
     } {
-        /sbs barlen 6 mul 13 add string def
+        /sbs msglen 6 mul 13 add string def
     } ifelse
-    /txt barlen array def
-    
+    /txt msglen array def
+
     % Put the start character
     sbs 0 encs 47 get putinterval
     
     /checksum1 0 def /checksum2 0 def
-
-    /i 0 def /j 0 def
-    { % loop
-        j barlen eq {exit} if
-        barcode i 1 getinterval (^) eq {
-            % indx is given by the next three characters
-            /indx barcode i 1 add 3 getinterval cvi def
-            txt j [( ) j 9 mul 9 add textyoffset textfont textsize] put
-            /i i 4 add def
+    0 1 msglen 1 sub {
+        /i exch def
+        % Lookup the encoding for the each barcode character
+        msg i get dup 0 lt { 
+            42 exch sub /indx exch def
+            /char ( ) def
         } {
-            barchars barcode i 1 getinterval search
-            pop                         % Discard true leaving pre
-            length /indx exch def       % indx is the length of pre
-            pop pop                     % Discard seek and post
-            txt j [barchars indx 1 getinterval j 9 mul 9 add textyoffset textfont textsize] put
-            /i i 1 add def
+            1 string dup 0 4 -1 roll put /char exch def
+            barchars char search
+            pop                                  % Discard true leaving pre
+            length /indx exch def                % indx is the length of pre
+            pop pop                              % Discard seek and post
         } ifelse
-        /enc encs indx get def             % Get the indxth encoding
-        sbs j 6 mul 6 add enc putinterval  % Put encoded digit into sbs
-        /checksum1 checksum1 barlen j sub 1 sub 20 mod 1 add indx mul add def
-        /checksum2 checksum2 barlen j sub 15 mod 1 add indx mul add def
-        /j j 1 add def
-    } loop
-    
+        /enc encs indx get def                   % Get the indxth encoding
+        sbs i 6 mul 6 add enc putinterval        % Put encoded digit into sbs
+        txt i [char i 9 mul 9 add textyoffset textfont textsize] put
+        /checksum1 checksum1 msglen i sub 1 sub 20 mod 1 add indx mul add def
+        /checksum2 checksum2 msglen i sub 15 mod 1 add indx mul add def
+    } for
+
     includecheck {
         % Put the first checksum character
         /checksum1 checksum1 47 mod def
         /checksum2 checksum2 checksum1 add 47 mod def
-        sbs j 6 mul 6 add encs checksum1 get putinterval
-        sbs j 6 mul 12 add encs checksum2 get putinterval
+        sbs msglen 6 mul 6 add encs checksum1 get putinterval
+        sbs msglen 6 mul 12 add encs checksum2 get putinterval
         % Put the end character
-        sbs j 6 mul 18 add encs 48 get putinterval
+        sbs msglen 6 mul 18 add encs 48 get putinterval
     } {
         % Put the end character
-        sbs j 6 mul 6 add encs 48 get putinterval      
+        sbs msglen 6 mul 6 add encs 48 get putinterval      
     } ifelse
 
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /sbs [sbs {48 sub} forall]
     /bhs [sbs length 1 add 2 idiv {height} repeat]
     /bbs [sbs length 1 add 2 idiv {0} repeat]
@@ -1811,21 +3214,149 @@
     /opt options
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/code93 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER code93--
+
+% --BEGIN ENCODER code93ext--
+% --REQUIRES code93--
+% --DESC: Code 93 Extended
+% --EXAM: Code93 Ext!
+% --EXOP: includetext includecheck
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /code93 dup /uk.co.terryburton.bwipp findresource put
+begin
+/code93ext {
+
+    20 dict begin
+
+    /options exch def      % We are given an options string
+    /barcode exch def      % We are given the code39extended text
+
+    /dontdraw false def
+    /includetext 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
+
+    % 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
+
+    % Extended alphabet to non-extended alphabet
+    /extencs
+    [ (^SFT%U) (^SFT$A) (^SFT$B) (^SFT$C) (^SFT$D) (^SFT$E) (^SFT$F) (^SFT$G) 
+      (^SFT$H) (^SFT$I) (^SFT$J) (^SFT$K) (^SFT$L) (^SFT$M) (^SFT$N) (^SFT$O)
+      (^SFT$P) (^SFT$Q) (^SFT$R) (^SFT$S) (^SFT$T) (^SFT$U) (^SFT$V) (^SFT$W)
+      (^SFT$X) (^SFT$Y) (^SFT$Z) (^SFT%A) (^SFT%B) (^SFT%C) (^SFT%D) (^SFT%E)
+      ( )      (^SFT/A) (^SFT/B) (^SFT/C) (^SFT/D) (^SFT/E) (^SFT/F) (^SFT/G)
+      (^SFT/H) (^SFT/I) (^SFT/J) (^SFT/K) (^SFT/L) (-)      (.)      (^SFT/O)
+      (0)      (1)      (2)      (3)      (4)      (5)      (6)      (7)
+      (8)      (9)      (^SFT/Z) (^SFT%F) (^SFT%G) (^SFT%H) (^SFT%I) (^SFT%J)
+      (^SFT%V) (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)      (^SFT%K) (^SFT%L) (^SFT%M) (^SFT%N) (^SFT%O)
+      (^SFT%W) (^SFT+A) (^SFT+B) (^SFT+C) (^SFT+D) (^SFT+E) (^SFT+F) (^SFT+G)
+      (^SFT+H) (^SFT+I) (^SFT+J) (^SFT+K) (^SFT+L) (^SFT+M) (^SFT+N) (^SFT+O)
+      (^SFT+P) (^SFT+Q) (^SFT+R) (^SFT+S) (^SFT+T) (^SFT+U) (^SFT+V) (^SFT+W)
+      (^SFT+X) (^SFT+Y) (^SFT+Z) (^SFT%P) (^SFT%Q) (^SFT%R) (^SFT%S) (^SFT%T)
+    ] def
+
+    /newcode barlen 6 mul string def
+    /newtext barlen 6 mul string def
+    /j 0 def /k 0 def
+    0 1 barlen 1 sub {
+        /i exch def
+        /extchar extencs barcode i get get def
+        /extlen extchar length def
+        newcode j extchar putinterval
+        newtext k barcode i get put
+        extlen 1 ne {newtext k 1 add ( ) putinterval} if
+        /j j extlen add def
+        /k k extlen 1 eq {1} {2} ifelse add def
+    } for
+    /newcode newcode 0 j getinterval def
+    /newtext newtext 0 k getinterval def
+
+    % Get the result of encoding with code93
+    options (dontdraw) true put
+    options (parsefnc) true put
+    /args newcode options //code93 exec def
+
+    % Replace chars in /txt with chars in newtext
+    includetext {
+        /txt args (txt) get def
+        0 1 newtext length 1 sub {
+            /i exch def
+            /txtentry txt i get def
+            txtentry 0 newtext i 1 getinterval put
+            txt i txtentry put
+        } for
+        args (txt) txt put
+    } if
+    args (opt) options put
+    args
+
+    dontdraw not //renlinear if
+
+    end
+
+} bind def
+/code93ext dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER code93ext--
 
 % --BEGIN ENCODER interleaved2of5--
 % --DESC: Interleaved 2 of 5 (ITF)
-% --EXAM: 24012345678905
-% --EXOP: showborder borderwidth=4 borderleft=15 borderright=15 height=0.5 includecheck includetext includecheckintext textyoffset=-10
+% --EXAM: 2401234567
+% --EXOP: height=0.5 includecheck includetext includecheckintext
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
 /interleaved2of5 {
 
-    1 dict begin         % Confine variables to local scope
+    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
@@ -1889,9 +3420,9 @@
 
     % Create an array containing the character mappings
     /encs
-    [ (11331) (31113) (13113) (33111) (11313)
-      (31311) (13311) (11133) (31131) (13131)
-      (1111)  (3111)
+    [ (11221) (21112) (12112) (22111) (11212)
+      (21211) (12211) (11122) (21121) (12121)
+      (1111)  (2111)
     ] def
 
     % Create a string of the available characters
@@ -1941,39 +3472,54 @@
 
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /sbs [sbs {48 sub} forall]
     /bhs [sbs length 1 add 2 idiv {height} repeat]
     /bbs [sbs length 1 add 2 idiv {0} repeat]
     includetext {
         /txt txt
     } if
+    /barratio 2
+    /spaceratio 2
     /opt options
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/interleaved2of5 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER interleaved2of5--
 
-% --BEGIN ENCODER rss14--
-% --DESC: Reduced Space Symbology 14 (RSS-14)
-% --EXAM: 24012345678905
-% --EXOP: height=0.3
+% --BEGIN ENCODER itf14--
+% --REQUIRES interleaved2of5--
+% --DESC: ITF-14
+% --EXAM: 04601234567893
+% --EXOP: includetext
 % --RNDR: renlinear
-/rss14 {
-
-    1 dict begin            % Confine variables to local scope
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /interleaved2of5 dup /uk.co.terryburton.bwipp findresource put
+begin
+/itf14 {
+
+    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
+    /includetext false def    % Enable/disable text
+    /textfont /Courier def
+    /textsize 10 def
+    /textxoffset 0 def
+    /textyoffset -7 def
     /height 1 def
-    /linkage false def
-    
+ 
     % Parse the input options
     options type /stringtype eq {
         1 dict begin
@@ -1984,15 +3530,279 @@
         currentdict end /options exch def
     } if
     options {def} forall
-   
+
+    /textfont textfont cvlit def
+    /textsize textsize cvr def
+    /textxoffset textxoffset cvr def
+    /textyoffset textyoffset cvr def
+    /height height cvr def 
+
+    % Calculate EAN checksum and add to end of barcode
+    barcode length dup 13 eq exch 14 eq or {
+        /gtin barcode 0 13 getinterval def
+    } if
+
+    % Get the result of encoding with interleaved2of5
+    options (dontdraw) true put
+    options (showborder) true put
+    options (borderwidth) 4 put
+    options (borderleft) 15 put
+    options (borderright) 15 put
+    options (height) 0.5 put
+    options (includecheck) true put
+    options (includecheckintext) true put
+    options (textyoffset) -10 put
+    /args gtin options //interleaved2of5 exec def
+
+    args (opt) options put
+    args
+ 
+    dontdraw not //renlinear if
+ 
+    end
+
+} bind def
+/itf14 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER itf14--
+
+% --BEGIN ENCODER identcode-- 
+% --REQUIRES interleaved2of5--
+% --DESC: Deutsche Post Identcode
+% --EXAM: 563102430313
+% --EXOP: includetext
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /interleaved2of5 dup /uk.co.terryburton.bwipp findresource put
+begin
+/identcode {
+
+    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
+    /includetext false def    % Enable/disable text
+    /textfont /Courier def
+    /textsize 10 def
+    /textxoffset 0 def
+    /textyoffset -7 def
+    /height 1 def
+ 
+    % Parse the input options
+    options type /stringtype eq {
+        1 dict begin
+        options {
+            token false eq {exit} if dup length string cvs (=) search
+            true eq {cvlit exch pop exch def} {cvlit true def} ifelse
+        } loop
+        currentdict end /options exch def
+    } if
+    options {def} forall
+
+    /textfont textfont cvlit def
+    /textsize textsize cvr def
+    /textxoffset textxoffset cvr def
+    /textyoffset textyoffset cvr def
+    /height height cvr def 
+
+    % Calculate checksum and add to end of barcode
+    barcode length dup 11 eq exch 12 eq or {
+        /checksum 0 def
+        0 1 10 {
+            /i exch def
+            /checksum checksum barcode i get 48 sub i 2 mod 0 eq {4 mul} {9 mul} ifelse add def
+        } for 
+        /checksum 10 checksum 10 mod sub 10 mod def
+        12 string
+        dup 0 barcode 0 11 getinterval putinterval
+        dup 11 checksum 48 add put
+        /pad exch def
+    } if
+    /barcode pad def
+
+    % Compose the human readable text
+    /text (  .       .     ) 16 string copy def
+    text  0 barcode  0 2 getinterval putinterval
+    text  3 barcode  2 3 getinterval putinterval
+    text  7 barcode  5 3 getinterval putinterval
+    text 11 barcode  8 3 getinterval putinterval
+    text 15 barcode 11 1 getinterval putinterval
+
+    % Get the result of encoding with interleaved2of5
+    options (dontdraw) true put
+    options (includecheck) false put
+    /args barcode options //interleaved2of5 exec def
+
+    args (txt) [ [text textxoffset textyoffset textfont textsize] ] put
+    args (textxalign) (center) put
+    args (opt) options put
+    args
+ 
+    dontdraw not //renlinear if
+ 
+    end
+
+} bind def
+/identcode dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER identcode--
+
+% --BEGIN ENCODER leitcode-- 
+% --REQUIRES interleaved2of5--
+% --DESC: Deutsche Post Leitcode
+% --EXAM: 21348075016401
+% --EXOP: includetext
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /interleaved2of5 dup /uk.co.terryburton.bwipp findresource put
+begin
+/leitcode {
+
+    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
+    /includetext false def    % Enable/disable text
+    /textfont /Courier def
+    /textsize 10 def
+    /textxoffset 0 def
+    /textyoffset -7 def
+    /height 1 def
+ 
+    % Parse the input options
+    options type /stringtype eq {
+        1 dict begin
+        options {
+            token false eq {exit} if dup length string cvs (=) search
+            true eq {cvlit exch pop exch def} {cvlit true def} ifelse
+        } loop
+        currentdict end /options exch def
+    } if
+    options {def} forall
+
+    /textfont textfont cvlit def
+    /textsize textsize cvr def
+    /textxoffset textxoffset cvr def
+    /textyoffset textyoffset cvr def
+    /height height cvr def 
+
+    % Calculate checksum and add to end of barcode
+    barcode length dup 13 eq exch 14 eq or {
+        /checksum 0 def
+        0 1 12 {
+            /i exch def
+            /checksum checksum barcode i get 48 sub i 2 mod 0 eq {4 mul} {9 mul} ifelse add def
+        } for 
+        /checksum 10 checksum 10 mod sub 10 mod def
+        14 string
+        dup 0 barcode 0 13 getinterval putinterval
+        dup 13 checksum 48 add put
+        /pad exch def
+    } if
+    /barcode pad def
+
+    % Compose the human readable text
+    /text (     .   .   .    ) 18 string copy def
+    text  0 barcode  0 5 getinterval putinterval
+    text  6 barcode  5 3 getinterval putinterval
+    text 10 barcode  8 3 getinterval putinterval
+    text 14 barcode 11 2 getinterval putinterval
+    text 17 barcode 13 1 getinterval putinterval
+
+    % Get the result of encoding with interleaved2of5
+    options (dontdraw) true put
+    options (includecheck) false put
+    /args barcode options //interleaved2of5 exec def
+
+    args (txt) [ [text textxoffset textyoffset textfont textsize] ] put
+    args (textxalign) (center) put
+    args (opt) options put
+    args
+ 
+    dontdraw not //renlinear if
+ 
+    end
+
+} bind def
+/leitcode dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER leitcode--
+
+% --BEGIN ENCODER databaromni--
+% --DESC: GS1 DataBar Omnidirectional
+% --EXAM: (01)24012345678905
+% --EXOP:
+% --RNDR: renlinear renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/databaromni {
+
+    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 33 72 div def
+    /linkage false def
+    /format (omni) 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
+  
+    format (truncated) eq {/height 13 72 div def} if
+    /height height cvr def
+
+    % Strip the AI and optional check digit
+    barcode length dup 17 eq exch 18 eq or {
+        barcode 0 4 getinterval (\(01\)) eq {
+            /binval [ 
+                linkage {1} {0} ifelse
+                barcode 4 13 getinterval {48 sub} forall
+            ] def
+        } if
+    } if
+
+    % Calculate EAN checksum and add to end of barcode
+    /checksum 0 def
+    0 1 12 {
+        /i exch def
+        /checksum checksum barcode i 4 add get 48 sub i 2 mod 0 eq {3 mul} if add def
+    } for 
+    /checksum 10 checksum 10 mod sub 10 mod def
+    18 string
+    dup 0 barcode 0 17 getinterval putinterval
+    dup 17 checksum 48 add put
+    /barcode exch def
+
     % Create the human readable text
     /txt barcode length array def
     0 1 barcode length 1 sub {
         /i exch def
         txt i [barcode i 1 getinterval 0 0 () 0] put
     } for
- 
-    /height height cvr def
 
     /ncr {  % n r
         2 copy sub 2 copy lt {exch} if  % n r maxd mind
@@ -2048,10 +3858,7 @@
         out el 1 sub nm put
         out
     } bind def
-
-    /binval [barcode {48 sub} forall] def
-    /binval [linkage {1} {0} ifelse binval 0 13 getinterval {} forall] def
-    
+   
     0 1 12 {
         /i exch def
         binval i 1 add 2 copy get binval i get 4537077 mod 10 mul add put
@@ -2214,44 +4021,153 @@
         checkrt i checkrtrev 4 i sub get put
     } for
 
-    /sbs [
-        1 d1w {} forall checklt {} forall d2w {}
-        forall d4w {} forall checkrt {} forall d3w {} forall 1 1
-    ] def
-    
-    % Return the arguments
-    <<
-    /ren (renlinear)
-    /sbs sbs
-    /bhs [sbs length 1 add 2 idiv {height} repeat]
-    /bbs [sbs length 1 add 2 idiv {0} repeat]
-    /txt txt
-    /textxalign (center)
-    /opt options
-    >>
-
-    dontdraw not {//renlinear exec} if
-
+    % Stacked format
+    format (omni) eq format (truncated) eq or {  % linear
+
+        /sbs [
+            1 d1w {} forall checklt {} forall d2w {} forall 
+            d4w {} forall checkrt {} forall d3w {} forall 1 1
+        ] def
+        
+        <<
+        /ren //renlinear
+        /sbs sbs
+        /bhs [sbs length 1 add 2 idiv {height} repeat]
+        /bbs [sbs length 1 add 2 idiv {0} repeat]
+        /txt txt
+        /textxalign (center)
+        /opt options
+        >>
+    
+        dontdraw not //renlinear if
+
+    } {  % 2D - stacked or stackedomni
+
+        /top [ 1 1 d1w {} forall checklt {} forall d2w {} forall 1 1 0 ] def
+        /bot [ 1 1 d4w {} forall checkrt {} forall d3w {} forall 1 1 0 ] def 
+        0 2 24 {
+            /i exch def
+            top i get {0} repeat
+            top i 1 add get {1} repeat
+        } for
+        50 array astore /top exch def 
+        0 2 24 {
+            /i exch def
+            bot i get {1} repeat
+            bot i 1 add get {0} repeat
+        } for
+        50 array astore /bot exch def
+
+        % Stacked
+        format (stacked) eq {
+            /sep [ 50 {0} repeat ] def
+            4 1 45 {
+                /i exch def
+                top i get bot i get eq {
+                    sep i 1 top i get sub put
+                } {
+                    sep i 1 sep i 1 sub get sub put
+                } ifelse
+            } for
+            /pixs [
+                5 {top aload pop} repeat
+                sep aload pop
+                7 {bot aload pop} repeat
+            ] def
+            /pixy pixs length 50 idiv def
+        } if
+    
+        % Stacked omnidirectional
+        format (stackedomni) eq {
+            /sep1 [ top {1 exch sub} forall ] def
+            sep1 0  [ 0 0 0 0 ] putinterval
+            sep1 46 [ 0 0 0 0 ] putinterval
+            18 1 30 {
+                /i exch def
+                top i get 0 eq {
+                    top i 1 sub get 1 eq {
+                        1
+                    } {
+                        sep1 i 1 sub get 0 eq {1} {0} ifelse
+                    } ifelse
+                } {
+                    0
+                } ifelse
+                sep1 exch i exch put
+            } for
+            /sep2 [ 0 0 0 0 21 { 0 1 } repeat 0 0 0 0 ] def
+            /sep3 [ bot {1 exch sub} forall ] def
+            sep3 0  [ 0 0 0 0 ] putinterval
+            sep3 46 [ 0 0 0 0 ] putinterval
+            19 1 31 {
+                /i exch def
+                bot i get 0 eq {
+                    bot i 1 sub get 1 eq {
+                        1
+                    } {
+                        sep3 i 1 sub get 0 eq {1} {0} ifelse
+                    } ifelse
+                } {
+                    0
+                } ifelse
+                sep3 exch i exch put
+            } for
+            checksum 9 mod 3 eq {  % 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 [
+                33 {top aload pop} repeat
+                sep1 aload pop
+                sep2 aload pop
+                sep3 aload pop
+                33 {bot aload pop} repeat
+            ] def
+            /pixy pixs length 50 idiv def
+        } if
+    
+        % Return the arguments
+        <<
+        /ren //renmatrix
+        /pixs pixs
+        /pixx 50
+        /pixy pixy
+        /height pixy 72 div
+        /width 50 72 div
+        /opt options
+        >>
+    
+        dontdraw not //renmatrix if
+     
+    } ifelse
+    
     end
 
 } bind def
-% --END ENCODER rss14--
-
-% --BEGIN ENCODER rsslimited--
-% --DESC: Reduced Space Symbology Limited (RSS-Limited)
-% --EXAM: 00978186074271
-% --EXOP: height=0.3
-% --RNDR: renlinear
-/rsslimited {
-
-    1 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
+/databaromni dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER databaromni--
+
+% --BEGIN ENCODER databarstacked--
+% --REQUIRES databaromni--
+% --DESC: GS1 DataBar Stacked
+% --EXAM: (01)24012345678905
+% --EXOP:
+% --RNDR: renmatrix renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+dup /databaromni dup /uk.co.terryburton.bwipp findresource put
+begin
+/databarstacked {
+
+    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 1 def
-    
+
     % Parse the input options
     options type /stringtype eq {
         1 dict begin
@@ -2262,15 +4178,193 @@
         currentdict end /options exch def
     } if
     options {def} forall
+
+    % Get the result of encoding with databaromni with format=stacked
+    options (dontdraw) true put
+    options (format) (stacked) put
+
+    /args barcode options //databaromni exec def
+
+    args (opt) options put
+    args
+ 
+    dontdraw not //renmatrix if
+
+    end
+
+} bind def
+/databarstacked dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER databarstacked--
+
+% --BEGIN ENCODER databarstackedomni--
+% --REQUIRES databaromni--
+% --DESC: GS1 DataBar Stacked Omnidirectional
+% --EXAM: (01)24012345678905
+% --EXOP:
+% --RNDR: renmatrix renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+dup /databaromni dup /uk.co.terryburton.bwipp findresource put
+begin
+/databarstackedomni {
+
+    20 dict begin                 % Confine variables to local scope
+
+    /options exch def       % We are given an option string
+    /barcode exch def       % We are given a barcode string
+
+    /dontdraw false def
+
+    % Parse the input options
+    options type /stringtype eq {
+        1 dict begin
+        options {
+            token false eq {exit} if dup length string cvs (=) search
+            true eq {cvlit exch pop exch def} {cvlit true def} ifelse
+        } loop
+        currentdict end /options exch def
+    } if
+    options {def} forall
+
+    % Get the result of encoding with databaromni with format=stackedomni
+    options (dontdraw) true put
+    options (format) (stackedomni) put
+
+    /args barcode options //databaromni exec def
+
+    args (opt) options put
+    args
+ 
+    dontdraw not //renmatrix if
+
+    end
+
+} bind def
+/databarstackedomni dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER databarstackedomni--
+
+% --BEGIN ENCODER databartruncated--
+% --REQUIRES databaromni--
+% --DESC: GS1 DataBar Truncated
+% --EXAM: (01)24012345678905
+% --EXOP:
+% --RNDR: renlinear renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /databaromni dup /uk.co.terryburton.bwipp findresource put
+begin
+/databartruncated {
+
+    20 dict begin                 % Confine variables to local scope
+
+    /options exch def       % We are given an option string
+    /barcode exch def       % We are given a barcode string
+
+    /dontdraw false def
+
+    % Parse the input options
+    options type /stringtype eq {
+        1 dict begin
+        options {
+            token false eq {exit} if dup length string cvs (=) search
+            true eq {cvlit exch pop exch def} {cvlit true def} ifelse
+        } loop
+        currentdict end /options exch def
+    } if
+    options {def} forall
+
+    % Get the result of encoding with databaromni with format=truncated
+    options (dontdraw) true put
+    options (format) (truncated) put
+
+    /args barcode options //databaromni exec def
+
+    args (opt) options put
+    args
+ 
+    dontdraw not //renlinear if
+
+    end
+
+} bind def
+/databartruncated dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER databartruncated--
+
+% --BEGIN ENCODER databarlimited--
+% --DESC: GS1 DataBar Limited
+% --EXAM: (01)15012345678907
+% --EXOP:
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
+/databarlimited {
+
+    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 10 72 div def
+    /linkage 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
    
+    /height height cvr def
+
+    % Strip the AI and optional check digit
+    barcode length dup 17 eq exch 18 eq or {
+        barcode 0 5 getinterval dup (\(01\)0) eq exch (\(01\)1) eq or {
+            /binval [ 
+                barcode 4 13 getinterval {48 sub} forall
+            ] def
+            linkage {
+                /linkval [ 2 0 1 5 1 3 3 5 3 1 0 9 6 ] def
+                0 1 binval length 1 sub {
+                    /i exch def
+                    binval i binval i get linkval i get add put
+                } for
+            } if 
+        } if
+    } if
+
+    % Calculate EAN checksum and add to end of barcode
+    /checksum 0 def
+    0 1 12 {
+        /i exch def
+        /checksum checksum barcode i 4 add get 48 sub i 2 mod 0 eq {3 mul} if add def
+    } for 
+    /checksum 10 checksum 10 mod sub 10 mod def
+    18 string
+    dup 0 barcode 0 17 getinterval putinterval
+    dup 17 checksum 48 add put
+    /barcode exch def
+
     % Create the human readable text
     /txt barcode length array def
     0 1 barcode length 1 sub {
         /i exch def
         txt i [barcode i 1 getinterval 0 0 () 0] put
     } for
-
-    /height height cvr def
 
     /ncr {  % n r
         2 copy sub 2 copy lt {exch} if  % n r maxd mind
@@ -2326,10 +4420,7 @@
         out el 1 sub nm put
         out
     } bind def
-    
-    /binval [barcode {48 sub} forall] def
-    /binval [binval 0 13 getinterval {} forall] def
-    
+   
     0 1 11 {
         /i exch def
         binval i 1 add 2 copy get binval i get 2013571 mod 10 mul add put
@@ -2453,7 +4544,7 @@
     
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /sbs sbs
     /bhs [sbs length 1 add 2 idiv {height} repeat]
     /bbs [sbs length 1 add 2 idiv {0} repeat]
@@ -2462,28 +4553,39 @@
     /opt options
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
-% --END ENCODER rsslimited--
-
-% --BEGIN ENCODER rssexpanded--
-% --DESC: Reduced Space Symbology Expanded (RSS-Expanded)
-% --EXAM: 000000010011001010100001000000010000
-% --EXOP: height=0.3
-% --RNDR: renlinear
-/rssexpanded {
-
-    1 dict begin            % Confine variables to local scope
+/databarlimited dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER databarlimited--
+
+% --BEGIN ENCODER databarexpanded--
+% --DESC: GS1 DataBar Expanded
+% --EXAM: (01)95012345678903(3103)000123
+% --EXOP:
+% --RNDR: renlinear renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/databarexpanded {
+
+    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 1 def
-    
+    /height 34 72 div def
+    /format (expanded) def
+    /segments -1 def
+    /linkage false def   
+ 
     % Parse the input options
     options type /stringtype eq {
         1 dict begin
@@ -2496,7 +4598,489 @@
     options {def} forall
  
     /height height cvr def
-
+    /segments segments cvi def
+
+    segments -1 eq {
+        /segments format (expandedstacked) eq {2} {22} ifelse def
+    } if
+
+    % 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
+    
+    % Method selection
+    {  % common exit
+    
+        % (01)9...(3103)...
+        ais length 2 eq {
+            ais 0 get (01) eq ais 1 get (3103) eq and { 
+                aival (01) get 0 1 getinterval (9) eq aival (3103) get cvi 32767 le and {
+                   (0100) false exit 
+                } if
+            } if
+        } if
+    
+        % (01)9...(3202)...
+        ais length 2 eq {
+            ais 0 get (01) eq ais 1 get (3202) eq and {
+                aival (01) get 0 1 getinterval (9) eq aival (3202) get cvi 9999 le and {
+                    (0101) false exit
+                } if
+            } if
+        } if
+    
+        % (01)9...(3203)...
+        ais length 2 eq {
+            ais 0 get (01) eq ais 1 get (3203) eq and {
+                aival (01) get 0 1 getinterval (9) eq aival (3203) get cvi 22767 le and {
+                    (0101) false exit
+                } if
+            } if
+        } if
+    
+        % (01)9...(310x/320x)...[(11/13/15/17)...]
+        ais length dup 2 eq exch 3 eq or {
+           /ai310x false 3100 1 3109 {10 4 string cvrs ais 1 get eq or} for def
+           /ai320x false 3200 1 3209 {10 4 string cvrs ais 1 get eq or} for def
+           ais length 3 eq {
+               /aibad true [ (11) (13) (15) (17) ] {ais 2 get ne and} forall def
+           } {
+               /aibad false def
+           } ifelse
+           ais 0 get (01) eq ai310x ai320x or and aibad not and {
+               ais length 3 eq {
+                   aival (01) get 0 1 getinterval (9) eq 
+                   aival ais 1 get get cvi 99999 le and 
+                   aival ais 2 get get cvi 999999 le and {
+                       ai310x ais 2 get (11) eq and { (0111000) false exit } if
+                       ai320x ais 2 get (11) eq and { (0111001) false exit } if
+                       ai310x ais 2 get (13) eq and { (0111010) false exit } if
+                       ai320x ais 2 get (13) eq and { (0111011) false exit } if
+                       ai310x ais 2 get (15) eq and { (0111100) false exit } if
+                       ai320x ais 2 get (15) eq and { (0111101) false exit } if
+                       ai310x ais 2 get (17) eq and { (0111110) false exit } if
+                       ai320x ais 2 get (17) eq and { (0111111) false exit } if
+                   } if
+               } {
+                   aival (01) get 0 1 getinterval (9) eq 
+                   aival ais 1 get get cvi 99999 le and {
+                       ai310x { (0111000) false exit } if
+                       ai320x { (0111001) false exit } if
+                   } if
+               } ifelse
+           } if
+        } if
+    
+        % (01)9...(392x)...
+        ais length 2 ge {
+            /ai392x false 3920 1 3923 {10 4 string cvrs ais 1 get eq or} for def
+            ais 0 get (01) eq ai392x and {
+                aival (01) get 0 1 getinterval (9) eq { (01100) true exit } if
+            } if
+        } if
+    
+        % (01)9...(393x)...
+        ais length 2 ge {
+            /ai393x false 3930 1 3933 {10 4 string cvrs ais 1 get eq or} for def
+            ais 0 get (01) eq ai393x and {
+                aival (01) get 0 1 getinterval (9) eq { (01101) true exit } if
+            } if
+        } if
+    
+        % (01)...
+        ais 0 get (01) eq { (1) true exit } if
+    
+        % Freeform
+        (00) true exit
+    
+    } loop
+    /gpfallow exch def
+    /method exch def
+   
+    /conv12to40 {
+        (0000000000000000000000000000000000000000) 40 string copy
+        2 copy  0 10 getinterval exch 0 3 getinterval cvi 2 10 string cvrs dup length 10 exch sub exch putinterval
+        2 copy 10 10 getinterval exch 3 3 getinterval cvi 2 10 string cvrs dup length 10 exch sub exch putinterval
+        2 copy 20 10 getinterval exch 6 3 getinterval cvi 2 10 string cvrs dup length 10 exch sub exch putinterval
+        2 copy 30 10 getinterval exch 9 3 getinterval cvi 2 10 string cvrs dup length 10 exch sub exch putinterval
+        exch pop
+    } bind def
+    
+    /conv13to44 {
+        (00000000000000000000000000000000000000000000) 44 string copy
+        2 copy 0 4 getinterval exch 0 1 getinterval cvi 2 4 string cvrs dup length 4 exch sub exch putinterval
+        dup 3 -1 roll 1 12 getinterval conv12to40 4 exch putinterval
+    } bind def
+    
+    /tobin {
+        string dup length 1 sub 0 exch 1 exch {1 index exch 48 put} for
+        dup 3 -1 roll 2 2 index length string cvrs dup length 2 index length exch sub exch putinterval 
+    } bind def
+    
+    method (00) eq {
+        /cdf [] def
+        /gpf [] def
+    } if
+    
+    method (1) eq {
+        /cdf aival (01) get 0 13 getinterval conv13to44 def
+        /cdf [ cdf {48 sub} forall ] def
+        /gpf [] def
+        /ais ais 1 ais length 1 sub getinterval def
+    } if
+    
+    method (0100) eq {
+        /cdf 55 string def
+        cdf 0 aival (01) get 1 12 getinterval conv12to40 putinterval
+        cdf 40 aival (3103) get cvi 15 tobin putinterval
+        /cdf [ cdf {48 sub} forall ] def
+        /gpf [] def
+        /ais [] def
+    } if
+    
+    method (0101) eq {
+        /cdf 55 string def
+        cdf 0 aival (01) get 1 12 getinterval conv12to40 putinterval
+        ais 1 get (3202) eq {
+            aival (3202) get cvi 15 tobin
+        } {
+            aival (3203) get cvi 10000 add 15 tobin
+        } ifelse
+        cdf exch 40 exch putinterval
+        /cdf [ cdf {48 sub} forall ] def
+        /gpf [] def
+        /ais [] def
+    } if
+    
+    method length 7 eq {
+        /cdf 76 string def
+        cdf 0 aival (01) get 1 12 getinterval conv12to40 putinterval
+        6 string dup 0 ais 1 get 3 1 getinterval putinterval
+        dup aival ais 1 get get 1 5 getinterval 1 exch putinterval cvi 20 tobin
+        cdf exch 40 exch putinterval
+        ais length 3 eq {
+            aival ais 2 get get
+            dup 0 2 getinterval cvi 384 mul exch
+            dup 2 2 getinterval cvi 1 sub 32 mul exch
+            4 2 getinterval cvi add add 
+        } {
+            38400
+        } ifelse
+        16 tobin cdf exch 60 exch putinterval
+        /cdf [ cdf {48 sub} forall ] def
+        /gpf [] def
+        /ais [] def
+    } if
+    
+    method (01100) eq {
+        /cdf 42 string def
+        cdf 0 aival (01) get 1 12 getinterval conv12to40 putinterval
+        cdf 40 ais 1 get 3 1 getinterval cvi 2 tobin putinterval
+        /cdf [ cdf {48 sub} forall ] def
+        /gpf [ aival ais 1 get get {} forall ] def
+        /ais ais 2 ais length 2 sub getinterval def
+    } if
+    
+    method (01101) eq {
+        /cdf 52 string def
+        cdf 0 aival (01) get 1 12 getinterval conv12to40 putinterval
+        cdf 40 ais 1 get 3 1 getinterval cvi 2 tobin putinterval
+        cdf 42 aival ais 1 get get 0 3 getinterval cvi 10 tobin putinterval
+        /cdf [ cdf {48 sub} forall ] def
+        /gpf [ aival ais 1 get get dup length 3 sub 3 exch getinterval {} forall ] def
+        /ais ais 2 ais length 2 sub getinterval def
+    } if
+    
+    % Variable length symbol field
+    gpfallow {
+        /vlf 2 array def
+    } {
+        /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
+    /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
+
+    /fnc1 -1 def /lnumeric -2 def /lalphanumeric -3 def /liso646 -4 def
+    
+    /numeric <<
+        0 1 119 {
+            dup (00) 2 string copy dup 3 -1 roll 11 2 string cvrs
+            dup length 2 exch sub exch putinterval 
+            dup 0 get 65 eq {dup 0 94 put} if 
+            dup 1 get 65 eq {dup 1 94 put} if 
+            exch 8 add
+            (0000000) 7 string copy dup 3 -1 roll 2 7 string cvrs 
+            dup length 7 exch sub exch putinterval
+        } for
+        lalphanumeric (0000)
+    >> def
+    
+    /alphanumeric <<
+        48 1 57 {dup 43 sub 5 tobin} for
+        fnc1 (01111)
+        65 1 90 {dup 33 sub 6 tobin} for
+        42 (111010)
+        44 1 47 {dup 15 add 6 tobin} for
+        lnumeric (000)
+        liso646 (00100)
+    >> def
+    
+    /iso646 <<
+        48 1 57 {dup 43 sub 5 tobin} for
+        fnc1 (01111)
+        65 1 90 {dup 1 sub 7 tobin} for
+        97 1 122 {dup 7 sub 7 tobin} for
+        33 (11101000)
+        34 (11101001)
+        37 1 47 {dup 197 add 8 tobin} for
+        58 1 63 {dup 187 add 8 tobin} for
+        95 (11111011)
+        32 (11111100)
+        lnumeric (000)
+        lalphanumeric (00100)
+    >> def
+    
+    % Append the remaining AI data
+    0 1 ais length 1 sub {
+        /i exch def
+        /ai ais i get def
+        /val aival ai get def
+        gpf length ai length add val length add array
+        dup 0 gpf putinterval
+        dup gpf length ai [ exch {} forall ] putinterval
+        dup gpf length ai length add val [ exch {} forall ] putinterval
+        /gpf exch def
+        i ais length 1 sub ne aifixed ai 0 2 getinterval known not and {  % Append FNC1
+            gpf length 1 add array
+            dup 0 gpf putinterval
+            dup gpf length fnc1 put
+            /gpf exch def
+        } if
+    } for
+    
+    % Calculate the number of bits remaining to the next valid symbol size
+    /rembits {
+        dup
+        12 div ceiling cvi 12 mul            % Round up to multiple of 12 
+        48 2 copy lt {exch} if pop           % At least 4 symbols
+        dup 12 idiv dup segments mod 1 eq {  % At least 2 symbols on last row of stacked symbol
+            1 add 12 mul exch pop
+        } {
+            pop
+        } ifelse 
+        exch sub
+    } bind def
+    
+    /encode {
+        dup /raw ne {exch get} {pop} ifelse
+        [ exch {48 sub} forall ]
+        dup length exch
+        gpfenc exch j exch putinterval
+        /j exch j add def
+    } bind def
+   
+    % Pre-compute alphanumeric and numeric runlengths and position of next ISO646-only characters
+    /numericruns [ gpf length {0} repeat 0 -1 ] def
+    /alphanumericruns [ gpf length {0} repeat 0 ] def
+    /nextiso646only [ gpf length {0} repeat 9999 ] def
+    gpf length 1 sub -1 0 {
+        /i exch def
+        gpf i get
+        (00) 2 string copy
+        dup 0 gpf i get dup fnc1 eq {pop 94} if put 
+        i gpf length 1 sub lt {dup 1 gpf i 1 add get dup fnc1 eq {pop 94} if put} if
+        numeric exch known {
+            numericruns i numericruns i 2 add get 2 add put
+        } {
+            numericruns i 0 put
+        } ifelse
+        dup alphanumeric exch known {
+            alphanumericruns i alphanumericruns i 1 add get 1 add put
+        } {
+            alphanumericruns i 0 put
+        } ifelse
+        dup iso646 exch known exch alphanumeric exch known not and {
+            nextiso646only i 0 put
+        } {
+            nextiso646only i nextiso646only i 1 add get 1 add put
+        } ifelse
+    } for
+   
+    % Encode the general purpose field
+    /gpfenc 252 array def
+    /i 0 def /j 0 def /mode (numeric) def
+    {  % loop
+        i gpf length eq {exit} if
+        {  % not a loop but common exit point
+    
+            mode (numeric) eq {
+                i gpf length 2 sub le {
+                    2 string 
+                    dup 0 gpf i get dup fnc1 eq {pop 94} if put
+                    dup 1 gpf i 1 add get dup fnc1 eq {pop 94} if put
+                    dup numeric exch known {
+                        numeric encode
+                        /i i 2 add def
+                        exit
+                    } if
+                    pop
+                    lalphanumeric numeric encode 
+                    /mode (alphanumeric) def
+                    exit
+                } {
+                    gpf i get dup 48 lt exch 57 gt or {
+                        lalphanumeric numeric encode
+                        /mode (alphanumeric) def
+                        exit
+                    } if
+                    /rem 12 1 add method length add vlf length add cdf length add j add rembits def
+                    rem 4 ge rem 6 le and {  % C1 + 1 into 4 to 6 bits
+                        (000000) 6 string copy 0 rem getinterval
+                        dup gpf i get 47 sub 2 4 string cvrs
+                        dup length 4 exch sub exch putinterval /raw encode
+                        /i i 1 add def
+                        exit
+                    } {  % C1.FNC1
+                        2 string dup 0 gpf i get put dup 1 94 put numeric encode 
+                        /i i 1 add def
+                        exit
+                    } ifelse
+                } ifelse
+            } if
+    
+            mode (alphanumeric) eq {
+                gpf i get fnc1 eq {
+                    fnc1 alphanumeric encode
+                    /i i 1 add def
+                    exit
+                } if
+                gpf i get dup iso646 exch known exch alphanumeric exch known not and {
+                     liso646 alphanumeric encode
+                     /mode (iso646) def
+                     exit
+                } if
+                numericruns i get 6 ge {
+                    lnumeric alphanumeric encode
+                    /mode (numeric) def
+                    exit
+                } if
+                numericruns i get dup 4 ge exch i add gpf length eq and {
+                    lnumeric alphanumeric encode
+                    /mode (numeric) def
+                    exit
+                } if
+                gpf i get alphanumeric encode
+                /i i 1 add def
+                exit
+            } if
+    
+            mode (iso646) eq {
+                gpf i get fnc1 eq {
+                    fnc1 iso646 encode
+                    /i i 1 add def
+                    exit
+                } if
+                numericruns i get 4 ge nextiso646only i get 10 ge and {
+                    lnumeric iso646 encode
+                    /mode (numeric) def
+                    exit
+                } if
+                alphanumericruns i get 5 ge nextiso646only i get 10 ge and {
+                    lalphanumeric iso646 encode
+                    /mode (alphanumeric) def
+                    exit
+                } if
+                gpf i get iso646 encode
+                /i i 1 add def
+                exit
+            } if
+    
+        } 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
+    vlf length 0 ne {
+        add 12 idiv
+        dup 2 mod vlf exch 0 exch put
+        14 le {0} {1} ifelse vlf exch 1 exch put
+    } {
+        pop pop
+    } ifelse
+    pad length 0 gt {
+        0 5 pad length 1 sub {  % Fill with 00100
+            /i exch def
+            pad i [ 0 0 1 0 0 ] 0 pad length i sub 5 2 copy gt {exch} if pop getinterval putinterval 
+        } for 
+        mode (numeric) eq {  % Prefix shift from numeric to ASCII
+            /pad [ 0 0 0 0 pad aload pop ] 0 pad length getinterval def
+        } if
+    } if
+   
+    % Concatinate fields
+    /binval [
+        linkage {1} {0} ifelse 
+        method {48 sub} forall
+        vlf aload pop
+        cdf aload pop
+        gpf aload pop
+        pad aload pop
+    ] def
+    /datalen binval length 12 idiv def
+    
     /ncr {  % n r
         2 copy sub 2 copy lt {exch} if  % n r maxd mind
         1 1 5 3 roll  % mind j=1 v=1 n maxd
@@ -2552,9 +5136,6 @@
         out
     } bind def
 
-    /binval [barcode {48 sub} forall] def
-    /datalen binval length 12 idiv def
-    
     /tab174 [
         347   0     12 5   7 2  87  4
         1387  348   10 7   5 4  52  20
@@ -2606,65 +5187,6 @@
 
     } for
     
-    /widths [
-        dxw {{} forall} forall
-    ] def
-
-    /checkweights [
-        77   96   32   81   27   9    3    1
-        20   60   180  118  143  7    21   63
-        205  209  140  117  39   13   145  189
-        193  157  49   147  19   57   171  91
-        132  44   85   169  197  136  186  62
-        185  133  188  142  4    12   36   108
-        50   87   29   80   97   173  128  113
-        150  28   84   41   123  158  52   156
-        166  196  206  139  187  203  138  46
-        76   17   51   153  37   111  122  155
-        146  119  110  107  106  176  129  43
-        16   48   144  10   30   90   59   177
-        164  125  112  178  200  137  116  109
-        70   210  208  202  184  130  179  115
-        190  204  68   93   31   151  191  134
-        148  22   66   198  172  94   71   2
-        40   154  192  64   162  54   18   6
-        120  149  25   75   14   42   126  167
-        175  199  207  69   23   78   26   79
-        103  98   83   38   114  131  182  124
-        159  53   88   170  127  183  61   161
-        55   165  73   8    24   72   5    15
-        89   100  174  58   160  194  135  45
-    ] def
-    
-    /checksum 0 def
-    0 1 widths length 1 sub {
-        /i exch def
-        /checksum checksum widths i get checkweights i get mul add def 
-    } for
-    /checksum checksum 211 mod datalen 3 sub 211 mul add def
-
-    /i 0 def {
-        checksum tab174 i get le {
-            tab174 i 1 add 7 getinterval {} forall
-            /cte exch def /cto exch def
-            /cmwe exch def /cmwo exch def
-            /cele exch def /celo exch def
-            /cgs exch def
-            exit
-        } if
-        /i i 8 add def
-    } loop
-
-    /cwo checksum cgs sub cte idiv celo cmwo 4 true  getRSSwidths def
-    /cwe checksum cgs sub cte mod  cele cmwe 4 false getRSSwidths def
-    
-    /cw 8 array def        
-    0 1 3 {
-        /i exch def
-        cw i 2 mul cwo i get put
-        cw i 2 mul 1 add cwe i get put
-    } for
-    
     /finderwidths [
         1 8 4 1 1    1 1 4 8 1
         3 6 4 1 1    1 1 4 6 3
@@ -2687,48 +5209,297 @@
         [0 1 2 3 4 7 6 9 8 11 10]
     ] def
 
-    /seq finderseq datalen 2 add 2 idiv 2 sub get def
+    /seq finderseq datalen 2 sub 2 idiv get def
     /fxw seq length array def
     0 1 seq length 1 sub {
         /x exch def
         fxw x finderwidths seq x get 5 mul 5 getinterval put
     } for
-    
-    /sbs [
-        1
-        cw {} forall
-        0 1 datalen 1 sub {
-            /i exch def
-            i 2 mod 0 eq {fxw i 2 idiv get {} forall} if
-            dxw i get {} forall
+
+    /checkweights [
+        -1   -1   -1   -1   -1   -1   -1   -1   % A1L
+        77   96   32   81   27   9    3    1    % A1R
+        20   60   180  118  143  7    21   63   % A2L
+        205  209  140  117  39   13   145  189  % A2R
+        193  157  49   147  19   57   171  91   % B1L 
+        132  44   85   169  197  136  186  62   % B1R
+        185  133  188  142  4    12   36   108  % B2L
+        50   87   29   80   97   173  128  113  % B2R
+        150  28   84   41   123  158  52   156  % C1L
+        166  196  206  139  187  203  138  46   % C1R
+        76   17   51   153  37   111  122  155  % C2L
+        146  119  110  107  106  176  129  43   % C2R
+        16   48   144  10   30   90   59   177  % D1L
+        164  125  112  178  200  137  116  109  % D1R
+        70   210  208  202  184  130  179  115  % D2L
+        190  204  68   93   31   151  191  134  % D2R
+        148  22   66   198  172  94   71   2    % E1L
+        40   154  192  64   162  54   18   6    % E1R
+        120  149  25   75   14   42   126  167  % E2L
+        175  199  207  69   23   78   26   79   % E2R
+        103  98   83   38   114  131  182  124  % F1L
+        159  53   88   170  127  183  61   161  % F1R
+        55   165  73   8    24   72   5    15   % F2L
+        89   100  174  58   160  194  135  45   % F2R
+    ] def
+
+    /checkweightseq [
+       seq {16 mul checkweights exch 16 getinterval aload pop} forall
+    ] dup length 8 sub 8 exch getinterval def
+
+    /widths [
+        dxw {{} forall} forall
+    ] def
+   
+    /checksum 0 def
+    0 1 widths length 1 sub {
+        /i exch def
+        /checksum checksum widths i get checkweightseq i get mul add def 
+    } for
+    /checksum checksum 211 mod datalen 3 sub 211 mul add def
+
+    /i 0 def {
+        checksum tab174 i get le {
+            tab174 i 1 add 7 getinterval {} forall
+            /cte exch def /cto exch def
+            /cmwe exch def /cmwo exch def
+            /cele exch def /celo exch def
+            /cgs exch def
+            exit
+        } if
+        /i i 8 add def
+    } loop
+
+    /cwo checksum cgs sub cte idiv celo cmwo 4 true  getRSSwidths def
+    /cwe checksum cgs sub cte mod  cele cmwe 4 false getRSSwidths def
+
+    /cw 8 array def        
+    0 1 3 {
+        /i exch def
+        cw i 2 mul cwo i get put
+        cw i 2 mul 1 add cwe i get put
+    } for
+
+    22 array dup dup
+    0 cw put 1 dxw putinterval 0 datalen 1 add getinterval
+    /dxw exch def
+    /datalen dxw length def
+
+    % Encode row runlengths
+    /rows datalen segments div ceiling cvi array def
+    /numrows rows length def
+    0 1 numrows 1 sub {
+        /r exch def
+        mark
+        segments 4 mod 0 ne r 2 mod 1 eq and {0} if
+        1 1
+        0 1 segments 1 sub {
+            /pos exch r segments mul add def
+            pos datalen lt {
+                dxw pos get {} forall                 
+                pos 2 mod 0 eq {fxw pos 2 idiv get {} forall} if
+            } if
         } for
         1 1
-    ] def
-    
-    % Return the arguments
-    <<
-    /ren (renlinear)
-    /sbs sbs
-    /bhs [sbs length 1 add 2 idiv {height} repeat]
-    /bbs [sbs length 1 add 2 idiv {0} repeat]
-    /opt options
-    >>
-
-    dontdraw not {//renlinear exec} if
+        counttomark array astore rows exch r exch put pop
+    } for
+
+    format (expandedstacked) ne {  % Linear
+
+        % Remove leading space
+        /sbs rows 0 get dup length 1 sub 1 exch getinterval def
+
+        /sbs [
+            1
+            0 1 datalen 1 sub {
+                /i exch def
+                dxw i get {} forall
+                i 2 mod 0 eq {fxw i 2 idiv get {} forall} if
+            } for
+            1 1
+        ] def
+
+        <<
+        /ren //renlinear
+        /sbs sbs
+        /bhs [sbs length 1 add 2 idiv {height} repeat]
+        /bbs [sbs length 1 add 2 idiv {0} repeat]
+        /opt options
+        >>
+
+        dontdraw not //renlinear if
+
+    } {  % expandedstacked
+
+        /seps numrows array def
+        0 1 numrows 1 sub {
+
+            /r exch def
+            /row rows r get def
+
+            % Sample runlengths into bitmap
+            mark
+            0 2 row length 1 sub {
+                /i exch def
+                row i get {0} repeat
+                i row length 1 sub lt {row i 1 add get {1} repeat} if
+            } for
+            counttomark array astore /row exch def pop
+
+            % Derive the separator pattern
+            /sep [ row {1 exch sub} forall ] def
+            sep 0 [ 0 0 0 0 ] putinterval
+            sep row length 4 sub [ 0 0 0 0 ] putinterval
+            /finderpos [  % Finder pattern module positions
+                19 98 row length 13 sub {} for
+                68 98 row length 13 sub {} for
+            ] def 
+            finderpos {
+                dup 14 add 1 exch {
+                    /i exch def
+                    row i get 0 eq {
+                        row 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
+            } forall
+
+            % For even segment-pair symbols reverse alternate rows
+            segments 4 mod 0 eq r 2 mod 1 eq and {
+                rows r get length rows 0 get length ne  % Except partial width last row
+                finderpos length 2 mod 1 eq and {       % with odd finders
+                    /row [ 0 row aload pop ] def
+                    /sep [ 0 sep aload pop ] def
+                } {
+                    row length 1 sub -1 0 {row exch get} for
+                    row astore pop
+                    sep length 1 sub -1 0 {sep exch get} for
+                    sep astore pop
+                } ifelse
+            } if
+
+            rows r row put
+            seps r sep put
+
+        } for
+
+        % Extend last row and separator to fill width of symbol
+        /pixx rows 0 get length def
+        [ pixx {0} repeat ] dup 0 rows numrows 1 sub get putinterval
+        rows exch numrows 1 sub exch put 
+        [ pixx {0} repeat ] dup 0 seps numrows 1 sub get putinterval
+        seps exch numrows 1 sub exch put 
+
+        % Middle separator pattern
+        /sep [ pixx 2 idiv 1 add { 0 1 } repeat ] 0 pixx getinterval def
+        sep 0 [0 0 0 0] putinterval
+        sep pixx 4 sub [0 0 0 0] putinterval
+
+        % Compose the symbol
+        /pixs [
+            0 1 numrows 1 sub {
+                /r exch def
+                r 0 ne {
+                    seps r get aload pop
+                } if
+                34 {rows r get aload pop} repeat
+                r numrows 1 sub ne {
+                    seps r get aload pop
+                    sep aload pop
+                } if
+            } for
+        ] def
+
+        <<
+        /ren //renmatrix
+        /pixs pixs
+        /pixx pixx
+        /pixy pixs length pixx idiv
+        /height pixs length pixx idiv 72 div
+        /width pixx 72 div
+        /opt options
+        >>
+
+        dontdraw not //renmatrix if
+
+    } ifelse
 
     end
 
 } bind def
-% --END ENCODER rssexpanded--
+/databarexpanded dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER databarexpanded--
+
+% --BEGIN ENCODER databarexpandedstacked--
+% --REQUIRES databarexpanded--
+% --DESC: GS1 DataBar Expanded Stacked
+% --EXAM: (01)95012345678903(3103)000123
+% --EXOP: segments=4
+% --RNDR: renmatrix renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+dup /databarexpanded dup /uk.co.terryburton.bwipp findresource put
+begin
+/databarexpandedstacked {
+
+    20 dict begin                 % Confine variables to local scope
+
+    /options exch def       % We are given an option string
+    /barcode exch def       % We are given a barcode string
+
+    /dontdraw false def
+
+    % Parse the input options
+    options type /stringtype eq {
+        1 dict begin
+        options {
+            token false eq {exit} if dup length string cvs (=) search
+            true eq {cvlit exch pop exch def} {cvlit true def} ifelse
+        } loop
+        currentdict end /options exch def
+    } if
+    options {def} forall
+
+    % Get the result of encoding with databarexpanded with format=expandedstacked
+    options (dontdraw) true put
+    options (format) (expandedstacked) put
+
+    /args barcode options //databarexpanded exec def
+
+    args (opt) options put
+    args
+ 
+    dontdraw not //renmatrix if
+
+    end
+
+} bind def
+/databarexpandedstacked dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER databarexpandedstacked--
 
 % --BEGIN ENCODER pharmacode--
 % --DESC: Pharmaceutical Binary Code
 % --EXAM: 117480
 % --EXOP: showborder
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
 /pharmacode {
 
-    1 dict begin                 % Confine variables to local scope
+    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
@@ -2782,7 +5553,7 @@
 
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /sbs sbs
     /bhs [sbs length 1 add 2 idiv {height} repeat]
     /bbs [sbs length 1 add 2 idiv {0} repeat]
@@ -2791,23 +5562,117 @@
     /opt options
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/pharmacode dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER pharmacode--
+
+% --BEGIN ENCODER pharmacode2--
+% --DESC: Two-track Pharmacode
+% --EXAM: 117480
+% --EXOP: includetext showborder
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
+/pharmacode2 {
+
+    20 dict begin
+
+    /options exch def           % We are given an option string
+    /barcode exch def           % We are given a barcode string
+
+    /dontdraw false def
+    /includetext false def      % Enable/disable text
+    /height 4 def               % Height of short bars in millimetres
+
+    % 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
+
+    /height height cvr def
+
+    % Create the human readable text
+    /txt barcode length array def
+    0 1 barcode length 1 sub {
+        /i exch def
+        txt i [barcode i 1 getinterval 0 0 () 0] put
+    } for
+
+    /encstr 16 string def
+    /bhs 16 array def
+    /bbs 16 array def
+    /sbs 32 array def
+    /bar 1 25.4 div height mul def     % bar height (mm)
+    /spc 1 25.4 div 72 mul def         % bar width & spacing (1mm)
+ 
+    % Convert number into a base3 representation
+    /i 15 def
+    /val barcode cvi def
+    {  % loop
+        val 0 eq {exit} if
+        val 3 mod dup
+        [3 1 2] exch get val exch sub 3 idiv /val exch def
+        encstr i [2 0 1] 4 -1 roll get put
+        /i i 1 sub def
+    } loop
+    /encstr encstr i 1 add 15 i sub getinterval def
+ 
+    % Generate the bar pattern
+    0 1 encstr length 1 sub {
+        /i exch def
+        encstr i get dup
+        bhs i bar [1 1 2] 5 -1 roll get mul put
+        bbs i [0 bar 0] 4 -1 roll get put
+    } for
+     
+    % Return the arguments
+    <<
+    /ren //renlinear
+    /bhs bhs
+    /bbs bbs
+    /sbs [encstr length 2 mul {spc} repeat]
+    /txt txt
+    /textxalign (center)
+    /textyoffset 4
+    /opt options
+    >>
+
+    dontdraw not //renlinear if
+
+    end
+
+} bind def
+/pharmacode2 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER pharmacode2--
 
 % --BEGIN ENCODER code2of5--
 % --DESC: Code 25
 % --EXAM: 01234567
-% --EXOP: includetext includecheck includecheckintext
+% --EXOP: version=iata includetext includecheck includecheckintext
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
 /code2of5 {
 
-    % Thanks to Michael Landers
-
-    1 dict begin                 % Confine variable to local scope
+    20 dict begin                 % Confine variable to local scope
 
     /options exch def       % We are given an option string
     /barcode exch def       % We are given a barcode string
@@ -2820,7 +5685,8 @@
     /textsize 10 def
     /textyoffset -7 def
     /height 1 def
-    
+    /version (industrial) def
+
     % Parse the input options
     options type /stringtype eq {
         1 dict begin
@@ -2831,18 +5697,42 @@
         currentdict end /options exch def
     } if
     options {def} forall
-    
+
     /textfont textfont cvlit def
     /textsize textsize cvr def
     /textyoffset textyoffset cvr def
     /height height cvr def
-    
+
     % Create an array containing the character mappings
-    /encs
-    [ (1111313111) (3111111131) (1131111131) (3131111111)
-      (1111311131) (3111311111) (1131311111) (1111113131)
-      (3111113111) (1131113111) (313111) (311131)
-    ] def
+    << 
+    /industrial
+        [ (1111313111) (3111111131) (1131111131) (3131111111)
+          (1111311131) (3111311111) (1131311111) (1111113131)
+          (3111113111) (1131113111) (313111)     (31113)
+        ] 
+    /iata
+        [ (1111313111) (3111111131) (1131111131) (3131111111)
+          (1111311131) (3111311111) (1131311111) (1111113131)
+          (3111113111) (1131113111) (1111)       (311)
+        ]
+    /matrix
+        [ (113311) (311131) (131131) (331111) (113131) (313111)
+          (133111) (111331) (311311) (131311) (311111) (31111)
+        ]
+    /coop
+        [ (331111) (111331) (113131) (113311) (131131) (131311)
+          (133111) (311131) (311311) (313111) (3131)   (133)
+        ]
+    /datalogic
+        [ (113311) (311131) (131131) (331111) (113131) (313111)
+          (133111) (111331) (311311) (131311) (1111)   (311)
+        ]
+    >>
+    version get /encs exch def
+    /cs encs 0 get length def
+    /cw 0 encs 0 get {48 sub add} forall def
+    /ss encs dup length 2 sub get length def
+    /sw 0 encs dup length 2 sub get {48 sub add} forall def
 
     % Create a string of the available characters
     /barchars (0123456789) def
@@ -2850,18 +5740,18 @@
     /barlen barcode length def            % Length of the code
 
     includecheck {
-        /sbs barlen 10 mul 22 add string def
+        /sbs barlen 1 add cs mul ss add ss add string def
         /txt barlen 1 add array def
     } {
-        /sbs barlen 10 mul 12 add string def
+        /sbs barlen cs mul ss add ss add string def
         /txt barlen array def
     } ifelse
-    
+
     % Put the start character
     sbs 0 encs 10 get putinterval
 
     /checksum 0 def
-    
+
     0 1 barlen 1 sub {
         /i exch def
         % Lookup the encoding for the each barcode character
@@ -2870,32 +5760,32 @@
         length /indx exch def               % indx is the length of pre
         pop pop                             % Discard seek and post
         /enc encs indx get def              % Get the indxth encoding
-        sbs i 10 mul 6 add enc putinterval  % Put encoded digit into sbs
-        txt i [barcode i 1 getinterval i 14 mul 10 add textyoffset textfont textsize] put
+        sbs i cs mul ss add enc putinterval % Put encoded digit into sbs
+        txt i [barcode i 1 getinterval i cw mul sw add textyoffset textfont textsize] put
         barlen i sub 2 mod 0 eq {
             /checksum checksum indx add def
-        } {            
+        } {
             /checksum checksum indx 3 mul add def
-        } ifelse        
-    } for
-    
+        } ifelse
+    } for
+
     % Put the checksum and end characters
     includecheck {
         /checksum 10 checksum 10 mod sub 10 mod def
-        sbs barlen 10 mul 6 add encs checksum get putinterval
-        sbs barlen 10 mul 16 add encs 11 get putinterval
+        sbs barlen cs mul ss add encs checksum get putinterval
+        sbs barlen cs mul cs add ss add encs 11 get putinterval
         includecheckintext {
-            txt barlen [barchars checksum 1 getinterval barlen 14 mul 10 add textyoffset textfont textsize] put
-        } {            
-            txt barlen [( ) barlen 14 mul 10 add textyoffset textfont textsize] put
+            txt barlen [barchars checksum 1 getinterval barlen cw mul sw add textyoffset textfont textsize] put
+        } {
+            txt barlen [( ) barlen cw mul sw add textyoffset textfont textsize] put
         } ifelse
     } {
-        sbs barlen 10 mul 6 add encs 11 get putinterval
+        sbs barlen cs mul ss add encs 11 get putinterval
     } ifelse
-    
+
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /sbs [sbs {48 sub} forall]
     /bhs [sbs length 1 add 2 idiv {height} repeat]
     /bbs [sbs length 1 add 2 idiv {0} repeat]
@@ -2905,11 +5795,14 @@
     /opt options
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/code2of5 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER code2of5--
 
 % --BEGIN ENCODER code11--
@@ -2917,9 +5810,13 @@
 % --EXAM: 0123456789
 % --EXOP: includetext includecheck includecheckintext
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
 /code11 {
 
-    1 dict begin            % Confine variables to local scope
+    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
@@ -2975,7 +5872,7 @@
     } ifelse
 
     % Put the start character
-    sbs 0 encs 10 get putinterval
+    sbs 0 encs 11 get putinterval
 
     /checksum1 0 def /checksum2 0 def
     
@@ -3031,7 +5928,7 @@
 
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /sbs [sbs {48 sub} forall]
     /bhs [sbs length 1 add 2 idiv {height} repeat]
     /bbs [sbs length 1 add 2 idiv {0} repeat]
@@ -3041,21 +5938,166 @@
     /opt options
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/code11 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER code11--
+
+% --BEGIN ENCODER bc412--
+% --DESC: BC412
+% --EXAM: BC412
+% --EXOP: semi includetext includecheckintext
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
+/bc412 {
+
+    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
+    /includecheck false def  % Enable/disable checkdigit
+    /includetext false def
+    /includecheckintext false def
+    /includestartstop false def
+    /semi false def
+    /textfont /Courier def
+    /textsize 10 def
+    /textyoffset -7 def
+    /height 1 def
+    
+    % Parse the input options
+    options type /stringtype eq {
+        1 dict begin
+        options {
+            token false eq {exit} if dup length string cvs (=) search
+            true eq {cvlit exch pop exch def} {cvlit true def} ifelse
+        } loop
+        currentdict end /options exch def
+    } if
+    options {def} forall
+ 
+    /textfont textfont cvlit def
+    /textsize textsize cvr def
+    /textyoffset textyoffset cvr def
+    /height height cvr def
+   
+    semi {
+        /includecheck true def
+        /includestartstop true def
+    } if
+ 
+    % Create an array containing the character mappings
+    /encs
+    [ (11111115) (13111212) (11131113) (12111213) (12121311)
+      (13131111) (12111312) (11131212) (11121411) (11151111)
+      (15111111) (11111511) (12131211) (13121112) (13111212)
+      (11111214) (12121113) (11111313) (13111113) (11121213)
+      (11141112) (11121312) (11141211) (14121111) (12121212)
+      (11131311) (13121211) (12111411) (14111211) (11111412)
+      (12111114) (14111112) (12141111) (11121114) (12131112)
+      (12) (111)
+    ] def
+
+    % Create a string of the available characters
+    /barchars (0R9GLVHA8EZ4NTS1J2Q6C7DYKBUIX3FWP5M) def
+
+    /barlen barcode length def  % Length of the code
+
+    /sbs barlen 1 add 8 mul 5 add string def
+    includecheck {
+        /txt barlen 1 add array def
+    } {
+        /txt barlen array def
+    } ifelse
+
+    % Put the start character
+    includestartstop {
+        sbs 0 encs 35 get putinterval
+        /pos 2 def
+        /txtpos 3 def
+    } {
+        /pos 0 def
+        /txtpos 0 def
+    } ifelse
+
+    /checksum 0 def
+    0 1 barlen 1 sub {
+        /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
+        /enc encs indx get def               % Get the indxth encoding
+        sbs pos enc putinterval  % Put encoded digit into sbs
+        txt i [barcode i 1 getinterval i 12 mul txtpos add textyoffset textfont textsize] put
+        /checksum checksum indx add def
+        /pos pos 8 add def
+    } for
+
+    % Put the checksum
+    includecheck {
+        /checksum checksum 35 mod def
+        sbs pos encs checksum get putinterval
+        includecheckintext {
+            txt barlen [barchars checksum 1 getinterval barlen 12 mul txtpos add textyoffset textfont textsize] put
+        } {
+            txt barlen [() barlen 12 mul txtpos add textyoffset textfont textsize] put
+        } ifelse
+        /pos pos 8 add def
+    } if 
+
+    % Put the stop character
+    includestartstop { 
+        sbs pos encs 36 get putinterval
+        /pos pos 2 add def
+    } if
+
+    % Return the arguments
+    /sbs sbs 0 pos getinterval def 
+    <<
+    /ren //renlinear
+    /sbs [sbs {48 sub} forall]
+    /bhs [sbs length 1 add 2 idiv {height} repeat]
+    /bbs [sbs length 1 add 2 idiv {0} repeat]
+    includetext {
+        /txt txt
+    } if
+    /opt options
+    >>
+
+    dontdraw not //renlinear if
+
+    end
+
+} bind def
+/bc412 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER bc412--
 
 % --BEGIN ENCODER rationalizedCodabar--
 % --DESC: Rationalized Codabar
 % --EXAM: A0123456789B
 % --EXOP: includetext includecheck includecheckintext
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
 /rationalizedCodabar {
 
-    1 dict begin                    % Confine variables to local scope
+    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
@@ -3156,7 +6198,7 @@
 
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /sbs [sbs {48 sub} forall]
     /bhs [sbs length 1 add 2 idiv {height} repeat]
     /bbs [sbs length 1 add 2 idiv {0} repeat]
@@ -3166,11 +6208,14 @@
     /opt options
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/rationalizedCodabar dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER rationalizedCodabar--
 
 % --BEGIN ENCODER onecode--
@@ -3178,15 +6223,19 @@
 % --EXAM: 0123456709498765432101234567891
 % --EXOP: barcolor=FF0000
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
 /onecode {
 
-    1 dict begin
+    20 dict begin
 
     /options exch def              % We are given an option string
     /barcode exch def              % We are given a barcode string
 
     /dontdraw false def
-    /height 0.175 def
+    /height 0.15 def
     
     % Parse the input options
     options type /stringtype eq {
@@ -3204,11 +6253,25 @@
     /barlen barcode length def
  
     % Create the human readable text
-    /txt barcode length array def
-    0 1 barcode length 1 sub {
+    /txtdict <<
+        2 dup
+        5 dup
+        barcode 5 1 getinterval (9) eq {14} {11} ifelse dup
+        20 dup
+        25 dup
+        29 dup
+    >> def
+    /txt barlen 6 add array def
+    /spacecnt 0 def
+    0 1 barlen 1 sub {
         /i exch def
-        txt i [barcode i 1 getinterval 0 0 () 0] put
-    } for
+        txtdict i known {
+            txt i spacecnt add [( ) 0 0 () 0] put
+            /spacecnt spacecnt 1 add def
+        } if
+        txt i spacecnt add [barcode i 1 getinterval 0 0 () 0] put
+    } for
+    /txt txt 0 barcode length spacecnt add getinterval def
 
     /normalize {
         /base exch def
@@ -3474,30 +6537,40 @@
     
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /bbs bbs
     /bhs bhs
     /sbs [bhs length 1 sub {1.44 1.872} repeat 1.44]
     /txt txt
-    /textxalign (center)
+    /textxalign (left)
+    /textfont /Helvetica
+    /textyoffset 1
+    /textxoffset -0.3
     /opt options
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/onecode dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER onecode--
 
 % --BEGIN ENCODER postnet--
-% --DESC: United States Postal Service Postnet
-% --EXAM: 012345
+% --DESC: United States Postal Service POSTNET
+% --EXAM: 01234
 % --EXOP: includetext includecheckintext
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
 /postnet {
 
-    1 dict begin
+    20 dict begin
 
     /options exch def              % We are given an option string
     /barcode exch def              % We are given a barcode string
@@ -3527,6 +6600,21 @@
     /height height cvr def
     
     /barlen barcode length def
+
+    % Ensure 5, 9 or 11 digits
+    barlen 5 lt {
+        /barlen -1 def  % Error
+    } {
+        barlen 11 ge {
+            /barlen 11 def
+        } if
+        barlen 10 eq {
+            /barlen 9 def
+        } if
+        barlen 8 le {
+            /barlen 5 def
+        } if
+    } ifelse
 
     % Create an array containing the character mappings
     /encs
@@ -3596,7 +6684,7 @@
 
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /bhs bhs
     /bbs [bhs length {0} repeat]
     /sbs [bhs length 1 sub {1.44 1.872} repeat 1.44]
@@ -3606,21 +6694,169 @@
     /opt options
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/postnet dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER postnet--
+
+% --BEGIN ENCODER planet--
+% --DESC: United States Postal Service PLANET
+% --EXAM: 01234567890
+% --EXOP: includetext includecheckintext
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
+/planet {
+
+    20 dict begin
+
+    /options exch def              % We are given an option string
+    /barcode exch def              % We are given a barcode string
+
+    /dontdraw false def
+    /includetext false def          % Enable/disable text
+    /includecheckintext false def
+    /textfont /Courier def
+    /textsize 10 def
+    /textyoffset -7 def
+    /height 0.125 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
+ 
+    /textfont textfont cvlit def
+    /textsize textsize cvr def
+    /textyoffset textyoffset cvr def
+    /height height cvr def
+    
+    /barlen barcode length def
+
+    % Ensure 11 or 13 digits
+    barlen 11 lt {
+        /barlen -1 def  % Error
+    } {
+        barlen 13 ge {
+            /barlen 13 def
+        } {
+            /barlen 11 def
+        } ifelse
+    } ifelse
+
+    % Create an array containing the character mappings
+    /encs
+    [ (22555) (55522) (55252) (55225) (52552)
+      (52525) (52255) (25552) (25525) (25255)
+      (5) (5)
+    ] def
+
+    % Create a string of the available characters
+    /barchars (0123456789) def
+
+    /bhs barlen 5 mul 7 add array def
+    /txt barlen 1 add array def
+
+    % Put start character
+    /enc encs 10 get def
+    /heights enc length array def
+    0 1 enc length 1 sub {
+        /j exch def
+        heights j enc j 1 getinterval cvi height mul 5 div put
+    } for
+    bhs 0 heights putinterval   % Put encoded digit into sbs
+
+    /checksum 0 def
+    0 1 barlen 1 sub {
+        /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
+        /enc encs indx get def              % Get the indxth encoding
+        /heights enc length array def
+        0 1 enc length 1 sub {
+            /j exch def
+            heights j enc j 1 getinterval cvi height mul 5 div put
+        } for
+        bhs i 5 mul 1 add heights putinterval   % Put encoded digit into sbs
+        txt i [barcode i 1 getinterval i 5 mul 1 add 3.312 mul textyoffset textfont textsize] put
+        /checksum checksum indx add def     % checksum+=indx
+    } for
+
+    % Put the checksum character
+    /checksum 10 checksum 10 mod sub 10 mod def
+    /enc encs checksum get def
+    /heights enc length array def
+    0 1 enc length 1 sub {
+        /j exch def
+        heights j enc j 1 getinterval cvi height mul 5 div put
+    } for
+    bhs barlen 5 mul 1 add heights putinterval  
+    
+    includecheckintext {
+        txt barlen [barchars checksum 1 getinterval barlen 5 mul 1 add 3.312 mul textyoffset textfont textsize] put
+    } {
+        txt barlen [( ) barlen 5 mul 1 add 72 mul 25 div textyoffset textfont textsize] put
+    } ifelse
+    
+    % Put end character
+    /enc encs 11 get def
+    /heights enc length array def
+    0 1 enc length 1 sub {
+        /j exch def
+        heights j enc j 1 getinterval cvi height mul 5 div put
+    } for
+    bhs barlen 5 mul 6 add heights putinterval  
+
+    % Return the arguments
+    <<
+    /ren //renlinear
+    /bhs bhs
+    /bbs [bhs length {0} repeat]
+    /sbs [bhs length 1 sub {1.44 1.872} repeat 1.44]
+    includetext {
+        /txt txt
+    } if
+    /opt options
+    >>
+
+    dontdraw not //renlinear if
+
+    end
+
+} bind def
+/planet dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER planet--
 
 % --BEGIN ENCODER royalmail--
 % --DESC: Royal Mail 4 State Customer Code (RM4SCC)
 % --EXAM: LE28HS9Z
 % --EXOP: includetext includecheckintext barcolor=FF0000
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
 /royalmail {
 
-    1 dict begin
+    20 dict begin
 
     /options exch def              % We are given an option string
     /barcode exch def              % We are given a barcode string
@@ -3724,7 +6960,7 @@
     
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /bbs bbs
     /bhs bhs
     /sbs [bhs length 1 sub {1.44 1.872} repeat 1.44]
@@ -3734,11 +6970,14 @@
     /opt options
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/royalmail dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER royalmail--
 
 % --BEGIN ENCODER auspost--
@@ -3746,9 +6985,13 @@
 % --EXAM: 5956439111ABA 9
 % --EXOP: includetext custinfoenc=character
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
 /auspost {
 
-    1 dict begin
+    20 dict begin
 
     /options exch def              % We are given an option string
     /barcode exch def              % We are given a barcode string
@@ -3925,7 +7168,7 @@
     
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /bbs bbs
     /bhs bhs
     /sbs [bhs length 1 sub {1.44 1.872} repeat 1.44]
@@ -3935,11 +7178,14 @@
     /opt options
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/auspost dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER auspost--
 
 % --BEGIN ENCODER kix--
@@ -3947,9 +7193,13 @@
 % --EXAM: 1231FZ13XHS
 % --EXOP: includetext includecheckintext
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
 /kix {
 
-    1 dict begin
+    20 dict begin
 
     /options exch def              % We are given an option string
     /barcode exch def              % We are given a barcode string
@@ -4032,7 +7282,7 @@
     
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /bbs bbs
     /bhs bhs
     /sbs [bhs length 1 sub {1.44 1.872} repeat 1.44]
@@ -4042,11 +7292,14 @@
     /opt options
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/kix dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER kix--
 
 % --BEGIN ENCODER japanpost--
@@ -4054,9 +7307,13 @@
 % --EXAM: 6540123789-A-K-Z
 % --EXOP: includetext includecheckintext
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
 /japanpost {
 
-    1 dict begin
+    20 dict begin
 
     /options exch def              % We are given an option string
     /barcode exch def              % We are given a barcode string
@@ -4193,7 +7450,7 @@
 
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /bbs bbs
     /bhs bhs
     /sbs [bhs length 1 sub {1.44 1.872} repeat 1.44]
@@ -4203,11 +7460,14 @@
     /opt options
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/japanpost dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER japanpost--
 
 % --BEGIN ENCODER msi--
@@ -4215,9 +7475,13 @@
 % --EXAM: 0123456789
 % --EXOP: includetext includecheck includecheckintext
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
 /msi {
 
-    1 dict begin                 % Confine variables to local scope
+    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
@@ -4226,6 +7490,8 @@
     /includecheck false def  % Enable/disable checkdigit
     /includetext false def   % Enable/disable text
     /includecheckintext false def
+    /checktype (mod10) def
+    /badmod11 false def
     /textfont /Courier def
     /textsize 10 def
     /textyoffset -7 def
@@ -4249,27 +7515,68 @@
     
     % Create an array containing the character mappings
     /encs
-    [ (13131313) (13131331) (13133113) (13133131) (13311313)
-      (13311331) (13313113) (13313131) (31131313) (31131331)
-      (31) (131)
+    [ (12121212) (12121221) (12122112) (12122121) (12211212)
+      (12211221) (12212112) (12212121) (21121212) (21121221)
+      (21) (121)
     ] def
 
     % Create a string of the available characters
     /barchars (0123456789) def
 
     /barlen barcode length def     % Length of the code
-
+    /txtlen barlen def
+
+    /mod10 {
+        /code exch def
+        0 0 code {48 sub exch 10 mul add exch} forall pop 2 mul  
+        0 {1 index 10 mod add exch 10 idiv dup 0 eq {pop exit} if exch} loop
+        0 0 code {48 sub add exch} forall exch pop add
+        10 mod 10 exch sub 10 mod
+        code length 1 add string dup 0 code putinterval dup code length 4 -1 roll 48 add put
+    } bind def
+
+    /mod11 {
+        /code exch def
+        code length 1 sub code {48 sub exch dup 1 sub exch 6 mod 2 add exch} forall pop
+        0 code length {3 1 roll mul add} repeat 
+        11 mod 11 exch sub 11 mod
+        dup 10 eq badmod11 and {
+            pop code length 2 add string dup 0 code putinterval dup code length (10) putinterval
+        } {
+            code length 1 add string dup 0 code putinterval dup code length 4 -1 roll 48 add put
+        } ifelse
+    } bind def
+
+    /ncrmod11 {
+        /code exch def
+        code length 1 sub code {48 sub exch dup 1 sub exch 8 mod 2 add exch} forall pop
+        0 code length {3 1 roll mul add} repeat 
+        11 mod 11 exch sub 11 mod
+        dup 10 eq badmod11 and {
+            pop code length 2 add string dup 0 code putinterval dup code length (10) putinterval
+        } {
+            code length 1 add string dup 0 code putinterval dup code length 4 -1 roll 48 add put
+        } ifelse
+    } bind def
+
+    % Calculate checksum
     includecheck {
-        /sbs barlen 8 mul 13 add string def
-        /txt barlen 1 add array def
-    } {
-        /sbs barlen 8 mul 5 add string def
-        /txt barlen array def
-    } ifelse
+        checktype (mod10) eq      {barcode mod10} if
+        checktype (mod1010) eq    {barcode mod10 mod10} if
+        checktype (mod11) eq      {barcode mod11} if
+        checktype (ncrmod11) eq   {barcode ncrmod11} if
+        checktype (mod1110) eq    {barcode mod11 mod10} if
+        checktype (ncrmod1110) eq {barcode ncrmod11 mod10} if
+        /barcode exch def
+        /barlen barcode length def
+        includecheckintext {/txtlen barlen def} if
+    } if
+
+    /sbs barlen 8 mul 5 add string def
+    /txt barlen array def
 
     % Put start character
     sbs 0 encs 10 get putinterval
-    /checksum 0 def
 
     0 1 barlen 1 sub {
         /i exch def
@@ -4280,55 +7587,46 @@
         pop pop                            % Discard seek and post
         /enc encs indx get def             % Get the indxth encoding
         sbs i 8 mul 2 add enc putinterval  % Put encoded digit into sbs
-        txt i [barcode i 1 getinterval i 16 mul 4 add textyoffset textfont textsize] put
-        barlen i sub 2 mod 0 eq {
-            /checksum indx checksum add def
-        } {
-            /checksum indx 2 mul dup 10 idiv add checksum add def
-        } ifelse
-    } for
-
-    % Put the checksum and end characters
-    includecheck {
-        /checksum 10 checksum 10 mod sub 10 mod def
-        sbs barlen 8 mul 2 add encs checksum get putinterval
-        includecheckintext {
-            txt barlen [barchars checksum 1 getinterval barlen 16 mul 4 add textyoffset textfont textsize] put
-        } {
-            txt barlen [( ) barlen 16 mul 4 add textyoffset textfont textsize] put
-        } ifelse
-        sbs barlen 8 mul 10 add encs 11 get putinterval
-    } {
-        sbs barlen 8 mul 2 add encs 11 get putinterval
-    } ifelse
+        txt i [barcode i 1 getinterval i 12 mul 3 add textyoffset textfont textsize] put
+    } for
+
+    % Put the end character
+    sbs barlen 8 mul 2 add encs 11 get putinterval
 
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /sbs [sbs {48 sub} forall]
     /bhs [sbs length 1 add 2 idiv {height} repeat]
     /bbs [sbs length 1 add 2 idiv {0} repeat]
     includetext {
-        /txt txt
+        /txt txt 0 txtlen getinterval
     } if
     /opt options
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/msi dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER msi--
 
 % --BEGIN ENCODER plessey--
-% --DESC: Plessey
+% --DESC: Plessey UK
 % --EXAM: 01234ABCD
 % --EXOP: includetext includecheckintext
 % --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
 /plessey {
 
-    1 dict begin                  % Confine variables to local scope
+    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
@@ -4336,6 +7634,7 @@
     /dontdraw false def
     /includetext false def    % Enable/disable text
     /includecheckintext false def
+    /unidirectional false def
     /textfont /Courier def
     /textsize 10 def
     /textyoffset -7 def
@@ -4359,18 +7658,22 @@
     
     % Create an array containing the character mappings
     /encs
-    [ (13131313) (31131313) (13311313) (31311313)
-      (13133113) (31133113) (13313113) (31313113)
-      (13131331) (31131331) (13311331) (31311331)
-      (13133131) (31133131) (13313131) (31313131)
-      (31311331) (331311313)
+    [ (14141414) (32141414) (14321414) (32321414)
+      (14143214) (32143214) (14323214) (32323214)
+      (14141432) (32141432) (14321432) (32321432)
+      (14143232) (32143232) (14323232) (32323232)
+      (32321432) (541412323) (323)
     ] def
 
     % Create a string of the available characters
     /barchars (0123456789ABCDEF) def
 
     /barlen barcode length def     % Length of the code
-    /sbs barlen 8 mul 33 add string def
+    unidirectional {
+        /sbs barlen 8 mul 27 add string def
+    } {
+        /sbs barlen 8 mul 33 add string def
+    } ifelse
     /txt barlen 2 add array def
     /checkbits barlen 4 mul 8 add array def
     checkbits barlen 4 mul [ 0 0 0 0 0 0 0 0 ] putinterval
@@ -4387,7 +7690,7 @@
         pop pop                            % Discard seek and post
         /enc encs indx get def             % Get the indxth encoding
         sbs i 8 mul 8 add enc putinterval  % Put encoded digit into sbs
-        txt i [barcode i 1 getinterval i 16 mul 16 add textyoffset textfont textsize] put
+        txt i [barcode i 1 getinterval i 20 mul 20 add textyoffset textfont textsize] put
         checkbits i 4 mul [
                 indx 1 and
                 indx -1 bitshift 1 and
@@ -4412,28 +7715,32 @@
     /checkval 0 def
     0 1 7 {
         /i exch def
-        /checkval checkval 2 7 i sub exp cvi checkbits barlen 4 mul i add get mul add def
+        /checkval checkval 2 i exp cvi checkbits barlen 4 mul i add get mul add def
     } for
 
     % Put the checksum characters
-    /checksum1 checkval -4 bitshift def
-    /checksum2 checkval 15 and def
+    /checksum1 checkval 15 and def
+    /checksum2 checkval -4 bitshift def
     sbs barlen 8 mul 8 add encs checksum1 get putinterval
     sbs barlen 8 mul 16 add encs checksum2 get putinterval
     includecheckintext {
-        txt barlen [barchars checksum1 1 getinterval barlen 16 mul 16 add textyoffset textfont textsize] put
-        txt barlen 1 add [barchars checksum2 1 getinterval barlen 1 add 16 mul 16 add textyoffset textfont textsize] put
+        txt barlen [barchars checksum1 1 getinterval barlen 20 mul 20 add textyoffset textfont textsize] put
+        txt barlen 1 add [barchars checksum2 1 getinterval barlen 1 add 20 mul 20 add textyoffset textfont textsize] put
     } {
-        txt barlen [( ) barlen 16 mul 16 add textyoffset textfont textsize] put
-        txt barlen 1 add [( ) barlen 1 add 16 mul 16 add textyoffset textfont textsize] put
+        txt barlen [( ) barlen 20 mul 20 add textyoffset textfont textsize] put
+        txt barlen 1 add [( ) barlen 1 add 20 mul 20 add textyoffset textfont textsize] put
     } ifelse
 
     % Put end character
-    sbs barlen 8 mul 24 add encs 17 get putinterval
+    unidirectional {
+        sbs barlen 8 mul 24 add encs 18 get putinterval
+    } {
+        sbs barlen 8 mul 24 add encs 17 get putinterval
+    } ifelse
 
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /sbs [sbs {48 sub} forall]
     /bhs [sbs length 1 add 2 idiv {height} repeat]
     /bbs [sbs length 1 add 2 idiv {0} repeat]
@@ -4443,27 +7750,40 @@
     /opt options
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
+/plessey dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER plessey--
 
-% --BEGIN ENCODER raw--
-% --DESC: Raw bar space succession for custom symbologies 
-% --EXAM: 331132131313411122131311333213114131131221323
-% --EXOP: height=0.5
+% --BEGIN ENCODER telepen--
+% --DESC: Telepen
+% --EXAM: Telepen
+% --EXOP: includetext
 % --RNDR: renlinear
-/raw {
-
-    1 dict begin                  % Confine variables to local scope
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
+/telepen {
+
+    20 dict begin                  % Confine variables to local scope
 
     /options exch def        % We are given an option string
-    /sbs exch def        % We are given a barcode string
-
+    /barcode exch def        % We are given a barcode string
+
+    /numeric false def
     /dontdraw false def
+    /includetext false def    % Enable/disable text
+    /textfont /Courier def
+    /textsize 10 def
+    /textyoffset -7 def
     /height 1 def
+    /parse false def
 
     % Parse the input options
     options type /stringtype eq {
@@ -4476,96 +7796,178 @@
     } if
     options {def} forall
 
+    /textfont textfont cvlit def
+    /textsize textsize cvr def
+    /textyoffset textyoffset cvr def
     /height height cvr 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
+
+    % Create an array containing the character mappings
+    /encs
+    [ (31313131)        (1131313111)     (33313111)       (1111313131)
+      (3111313111)      (11333131)       (13133131)       (111111313111)
+      (31333111)        (1131113131)     (33113131)       (1111333111)
+      (3111113131)      (1113133111)     (1311133111)     (111111113131)
+      (3131113111)      (11313331)       (333331)         (111131113111)
+      (31113331)        (1133113111)     (1313113111)     (1111113331)
+      (31131331)        (113111113111)   (3311113111)     (1111131331)
+      (311111113111)    (1113111331)     (1311111331)     (11111111113111)
+      (31313311)        (1131311131)     (33311131)       (1111313311)
+      (3111311131)      (11333311)       (13133311)       (111111311131)
+      (31331131)        (1131113311)     (33113311)       (1111331131)
+      (3111113311)      (1113131131)     (1311131131)     (111111113311)
+      (3131111131)      (1131131311)     (33131311)       (111131111131)
+      (3111131311)      (1133111131)     (1313111131)     (111111131311)
+      (3113111311)      (113111111131)   (3311111131)     (111113111311)
+      (311111111131)    (111311111311)   (131111111311)   (11111111111131)
+      (3131311111)      (11313133)       (333133)         (111131311111)
+      (31113133)        (1133311111)     (1313311111)     (1111113133)
+      (313333)          (113111311111)   (3311311111)     (11113333)
+      (311111311111)    (11131333)       (13111333)       (11111111311111)
+      (31311133)        (1131331111)     (33331111)       (1111311133)
+      (3111331111)      (11331133)       (13131133)       (111111331111)
+      (3113131111)      (1131111133)     (33111133)       (111113131111)
+      (3111111133)      (111311131111)   (131111131111)   (111111111133)
+      (31311313)        (113131111111)   (3331111111)     (1111311313)
+      (311131111111)    (11331313)       (13131313)       (11111131111111)
+      (3133111111)      (1131111313)     (33111313)       (111133111111)
+      (3111111313)      (111313111111)   (131113111111)   (111111111313)
+      (313111111111)    (1131131113)     (33131113)       (11113111111111)
+      (3111131113)      (113311111111)   (131311111111)   (111111131113)
+      (3113111113)      (11311111111111) (331111111111)   (111113111113)
+      (31111111111111)  (111311111113)   (131111111113)   (1111111111111111)
+    ] def
+
+    /barlen barcode length def    % Length of the code
+    /sbs barlen 16 mul 48 add string def
+    /txt barlen array def
+
+    % Put the start character ASCII 95
+    /enc encs 95 get def
+    sbs 0 enc putinterval
+    /l enc length def
+
+    /checksum 0 def
+    /i 0 def /j 0 def
+    { % loop
+        i barlen eq {exit} if
+        numeric {  % numeric mode: 00-99 & 0X-9X
+            barcode i get 16 gt { 
+                /np barcode i 2 getinterval def
+                np 1 1 getinterval (X) eq {  % X in even position amongst digits
+                    /indx np 0 1 getinterval cvi 17 add def
+                } {
+                    /indx np cvi 27 add def
+                } ifelse
+                txt j [np j 16 mul 16 add textyoffset textfont textsize] put
+                /i i 2 add def
+            } {
+                /indx barcode i get def
+                txt j [( ) j 16 mul 16 add textyoffset textfont textsize] put
+                /i i 1 add def
+            } ifelse
+        } {  % ASCII mode
+            /indx barcode i get def
+            indx 32 ge indx 126 le and {
+                txt j [barcode i 1 getinterval j 16 mul 16 add textyoffset textfont textsize] put
+            } {
+                txt j [( ) j 16 mul 16 add textyoffset textfont textsize] put
+            } ifelse
+            /i i 1 add def
+        } ifelse
+        /checksum checksum indx add def
+        /enc encs indx get def
+        sbs l enc putinterval          % Put encoded digit into sbs
+        /l l enc length add def
+        /j j 1 add def
+    } loop
+
+    % Put the checksum character
+    /checksum 127 checksum 127 mod sub 127 mod def
+    /enc encs checksum get def
+    sbs l enc putinterval
+    /l l enc length add def
+
+    % Put the end character ASCII 122
+    /enc encs 122 get def
+    sbs l enc putinterval
+    /l l enc length add def
+
+    % Shrink sbs and txt to fit exactly
+    /sbs sbs 0 l getinterval def
+    /txt txt 0 j getinterval def
 
     % Return the arguments
     <<
-    /ren (renlinear)
+    /ren //renlinear
     /sbs [sbs {48 sub} forall]
     /bhs [sbs length 1 add 2 idiv {height} repeat]
     /bbs [sbs length 1 add 2 idiv {0} repeat]
+    includetext {
+        /txt txt
+    } if
     /opt options
     >>
 
-    dontdraw not {//renlinear exec} if
+    dontdraw not //renlinear if
 
     end
 
 } bind def
-% --END ENCODER raw--
-
-% --BEGIN ENCODER symbol--
-% --DESC: Miscellaneous symbols
-% --EXAM: fima
-% --EXOP: backgroundcolor=DD000011
+/telepen dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER telepen--
+
+% --BEGIN ENCODER posicode--
+% --DESC: PosiCode
+% --EXAM: ABC123
+% --EXOP: version=b inkspread=-0.5 parsefnc includetext
 % --RNDR: renlinear
-/symbol {
-
-    1 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
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
+/posicode {
+
+    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
-
-    barcode (fima) eq {
-        /sbs [2.25 2.25 2.25 11.25 2.25 11.25 2.25 2.25 2.25] def
-        /bhs [.625 .625 .625 .625 .625] def
-        /bbs [0 0 0 0 0] def
-    } if
-
-    barcode (fimb) eq {
-        /sbs [2.25 6.75 2.25 2.25 2.25 6.25 2.25 2.25 2.25 6.75 2.25] def
-        /bhs [.625 .625 .625 .625 .625 .625] def
-        /bbs [0 0 0 0 0 0] def
-    } if
-
-    barcode (fimc) eq {
-        /sbs [2.25 2.25 2.25 6.75 2.25 6.75 2.25 6.75 2.25 2.25 2.25] def
-        /bhs [.625 .625 .625 .625 .625 .625] def
-        /bbs [0 0 0 0 0 0] def
-    } if
-    
-    barcode (fimd) eq {
-        /sbs [2.25 2.25 2.25 2.25 2.25 6.75 2.25 6.75 2.25 2.25 2.25 2.25 2.25] def
-        /bhs [.625 .625 .625 .625 .625 .625 .625] def
-        /bbs [0 0 0 0 0 0 0] def
-    } if
-    
-    % Return the arguments
-    <<
-    /ren (renlinear)
-    /sbs sbs
-    /bhs bhs
-    /bbs bbs
-    /opt options
-    >>
-
-    dontdraw not {//renlinear exec} if
-
-    end
-
-} bind def
-% --END ENCODER symbol--
-
-% --BEGIN ENCODER pdf417--
-% --DESC: PDF417
-% --EXAM: ^453^178^121^239
-% --EXOP: columns=2 rows=10
-% --RNDR: renmatrix
-/pdf417 {
-
-    1 dict begin
-
-    /options exch def
-    /barcode exch def
-
-    /dontdraw false def
-    /compact false def
-    /eclevel -1 def
-    /columns 0 def
-    /rows 0 def
-    /rowmult 3 def
+    /includetext false def    % Enable/disable text
+    /textfont /Courier def
+    /textsize 10 def
+    /textxoffset 0 def
+    /textyoffset -7 def
+    /height 1 def
+    /encoding (auto) def
+    /version (a) def
+    /checkoffset 0 def
+    /raw false def
+    /parse false def
+    /parsefnc false def
 
     % Parse the input options
     options type /stringtype eq {
@@ -4578,30 +7980,914 @@
     } if
     options {def} forall
 
+    /textfont textfont cvlit def
+    /textsize textsize cvr def
+    /textxoffset textxoffset cvr def
+    /textyoffset textyoffset cvr def
+    /encoding encoding cvlit def
+    /version version cvlit def
+    /checkoffset checkoffset cvi def
+    /height height cvr 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
+
+    % Special function characters
+    /la0  -1 def  /la1  -2 def  /la2  -3 def 
+    /sf0  -4 def  /sf1  -5 def  /sf2  -6 def 
+    /fn1  -7 def  /fn2  -8 def  /fn3  -9 def  /fn4 -10 def
+
+    % Character maps for each state
+    <<
+    /normal
+      [
+          %  0    1    2        0    1    2        0    1    2
+          [ (0)  (^)  (') ]  [ (1)  (;)   27 ]  [ (2)  (<)   28 ]  % 0-2 
+          [ (3)  (=)   29 ]  [ (4)  (>)   30 ]  [ (5)  (?)   31 ]  % 3-5
+          [ (6)  (@)  (!) ]  [ (7)  ([)  (") ]  [ (8)   92  (#) ]  % 6-8
+          [ (9)  (])  (&) ]  [ (A)  (a)    1 ]  [ (B)  (b)    2 ]  % 9-11
+          [ (C)  (c)    3 ]  [ (D)  (d)    4 ]  [ (E)  (e)    5 ]  % 12-14
+          [ (F)  (f)    6 ]  [ (G)  (g)    7 ]  [ (H)  (h)    8 ]  % 15-17
+          [ (I)  (i)    9 ]  [ (J)  (j)   10 ]  [ (K)  (k)   11 ]  % 18-20
+          [ (L)  (l)   12 ]  [ (M)  (m)   13 ]  [ (N)  (n)   14 ]  % 21-23
+          [ (O)  (o)   15 ]  [ (P)  (p)   16 ]  [ (Q)  (q)   17 ]  % 24-26
+          [ (R)  (r)   18 ]  [ (S)  (s)   19 ]  [ (T)  (t)   20 ]  % 27-29
+          [ (U)  (u)   21 ]  [ (V)  (v)   22 ]  [ (W)  (w)   23 ]  % 30-32
+          [ (X)  (x)   24 ]  [ (Y)  (y)   25 ]  [ (Z)  (z)   26 ]  % 33-35
+          [ (-)  (_)   40 ]  [ (.)  (`)   41 ]  [ ( )  127    0 ]  % 36-38
+          [ ($)  ({)  (*) ]  [ (/)  (|)  (,) ]  [ (+)  (})  (:) ]  % 39-41
+          [ (%)  (~)  fn1 ]  [ la1  la0  fn2 ]  [ sf1  sf0  fn3 ]  % 42-44
+          [ sf2  sf2  fn4 ]                                        % 45
+      ]
+    /limited
+      [
+          [ (0)  -98  -98 ]  [ (1)  -98   -98 ]  [ (2)  -98  -98 ]  % 0-2
+          [ (3)  -98  -98 ]  [ (4)  -98   -98 ]  [ (5)  -98  -98 ]  % 3-5
+          [ (6)  -98  -98 ]  [ (7)  -98   -98 ]  [ (8)  -98  -98 ]  % 6-8
+          [ (9)  -98  -98 ]  [ (A)  -98   -98 ]  [ (B)  -98  -98 ]  % 9-11
+          [ (C)  -98  -98 ]  [ (D)  -98   -98 ]  [ (E)  -98  -98 ]  % 12-14
+          [ (F)  -98  -98 ]  [ (G)  -98   -98 ]  [ (H)  -98  -98 ]  % 15-17
+          [ (I)  -98  -98 ]  [ (J)  -98   -98 ]  [ (K)  -98  -98 ]  % 18-20
+          [ (L)  -98  -98 ]  [ (M)  -98   -98 ]  [ (N)  -98  -98 ]  % 21-23
+          [ (O)  -98  -98 ]  [ (P)  -98   -98 ]  [ (Q)  -98  -98 ]  % 24-26
+          [ (R)  -98  -98 ]  [ (S)  -98   -98 ]  [ (T)  -98  -98 ]  % 27-29
+          [ (U)  -98  -98 ]  [ (V)  -98   -98 ]  [ (W)  -98  -98 ]  % 30-32
+          [ (X)  -98  -98 ]  [ (Y)  -98   -98 ]  [ (Z)  -98  -98 ]  % 33-35
+          [ (-)  -98  -98 ]  [ (.)  -98   -98 ]                     % 36-37
+      ]
+    >> 
+    version (a) eq version (b) eq or {/normal} {/limited} ifelse get 
+    /charmaps exch def
+
+    % Invert charmaps to give character to value maps for each state
+    /charvals [
+        charmaps length dict charmaps length dict charmaps length 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
+    /set0 charvals 0 get def
+    /set1 charvals 1 get def
+    /set2 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
+
+        % Convert input into bytes accounting for FNC characters 
+        /msg barlen array def
+        /text barlen string def
+        /i 0 def /j 0 def {
+            i barlen eq {exit} if
+            /char barcode i get def
+            text j char put
+            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
+                    text j ( ) putinterval
+                    /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
+        /text text 0 j getinterval def
+
+        % Convert the input message to codewords
+        /enc {
+            exch get cws exch j exch put
+            /j j 1 add def
+        } bind def
+
+        /cws barcode length 2 mul array def
+        /i 0 def /j 0 def /cset (set0) def
+        {
+            i msglen eq {exit} if
+       
+            {  % common exit
+
+                % Read next two characters
+                /char1 msg i get def
+                /char2 i 1 add msglen lt {msg i 1 add get} {-99} ifelse def
+
+                % If current mode is sufficient then directly encode
+                cset load char1 known { 
+                    char1 cset load enc
+                    /i i 1 add def
+                    exit
+                } if
+
+                % If char1 is in set2 then shift encode
+                set2 char1 known {
+                    sf2 cset load enc
+                    char1 set2 enc
+                    /i i 1 add def
+                    exit
+                } if 
+
+                % If char2 is also not in this set then latch else shift encode
+                cset load char2 known not {
+                    cset (set0) eq {
+                       la1 cset load enc
+                       /cset (set1) def
+                    } {
+                       la0 cset load enc
+                       /cset (set0) def
+                    } ifelse
+                    exit
+                } { 
+                    cset (set0) eq {
+                        sf1 cset load enc
+                        char1 set1 enc
+                    } {
+                        sf0 cset load enc
+                        char1 set0 enc
+                    } ifelse 
+                    /i i 1 add def
+                    exit
+                } ifelse
+
+                exit
+            } loop
+        
+        } loop
+        /cws cws 0 j getinterval def
+    } if  % auto encoding
+
+    % Create an array containing the character mappings
+    <<   % ";"=11, "<"=12
+    /a
+        [ (141112) (131212) (121312) (111412) (131113)
+          (121213) (111313) (121114) (111214) (111115)
+          (181111) (171211) (161311) (151411) (141511)
+          (131611) (121711) (111811) (171112) (161212)
+          (151312) (141412) (131512) (121612) (111712)
+          (161113) (151213) (141313) (131413) (121513)
+          (111613) (151114) (141214) (131314) (121414)
+          (111514) (141115) (131215) (121315) (111415)
+          (131116) (121216) (111316) (121117) (111217)
+          (111118) (1<111112) (111111111;1)
+        ]
+    /b
+        [ (151213) (141313) (131413) (121513) (141214)
+          (131314) (121414) (131215) (121315) (121216)
+          (191212) (181312) (171412) (161512) (151612)
+          (141712) (131812) (121912) (181213) (171313)
+          (161413) (151513) (141613) (131713) (121813)
+          (171214) (161314) (151414) (141514) (131614)
+          (121714) (161215) (151315) (141415) (131515)
+          (121615) (151216) (141316) (131416) (121516)
+          (141217) (131317) (121417) (131218) (121318)
+          (121219) (1<121312) (121212121<1)
+        ]
+    /limiteda
+        [ (111411) (111312) (111213) (111114) (121311)
+          (121212) (121113) (141111) (131211) (131112)
+          (171111) (161211) (151311) (141411) (131511)
+          (121611) (111711) (161112) (151212) (141312)
+          (131412) (121512) (111612) (151113) (141213)
+          (131313) (121413) (111513) (141114) (131214)
+          (121314) (111414) (131115) (121215) (111315)
+          (121116) (111216) (111117) (151111) (1)
+        ]
+    /limitedb
+        [ (121512) (121413) (121314) (121215) (131412)
+          (131313) (131214) (151212) (141312) (141213)
+          (181212) (171312) (161412) (151512) (141612)
+          (131712) (121812) (171213) (161313) (151413)
+          (141513) (131613) (121713) (161214) (151314)
+          (141414) (131514) (121614) (151215) (141315)
+          (131415) (121515) (141216) (131316) (121416)
+          (131217) (121317) (121218) (141212) (1)
+        ]
+    >>
+    version get /encs exch def
+
+    /c2w [
+        [ 495 330 210 126  70  35  15   5 ]
+        [ 165 120  84  56  35  20  10   4 ]
+        [  45  36  28  21  15  10   6   3 ] 
+        [   9   8   7   6   5   4   3   2 ]
+        [   1   1   1   1   1   1   1   1 ]
+    ] def
+    /v 0 def
+    cws {
+        /cw exch def
+        6 {
+            cw v xor 1 and 0 ne {
+                /v v 7682 xor def
+            } if
+            /v v -1 bitshift def
+            /cw cw -1 bitshift def
+        } repeat 
+    } forall
+    /v v checkoffset add def
+
+    version (limiteda) eq version (limitedb) eq or {
+        /v v 1023 and def
+        v 824 gt v 853 lt and {
+            /v v 292 add def
+        } if 
+    } {
+        /v v 1023 and 45 add def
+    } ifelse
+
+    /d [ 2 2 2 2 2 2 ] def
+    /r 0 def /c 0 def /w 0 def /sum 0 def
+    {
+        sum v eq {exit} if
+        /t sum c2w r get c get add def
+        t v eq {
+            /w w 1 add def
+            d r w 2 add put
+            /sum t def
+        } if
+        t v gt {
+            d r w 2 add put
+            /r r 1 add def
+            /w 0 def
+        } if
+        t v lt {
+            /c c 1 add def
+            /w w 1 add def
+            /sum t def
+        } if
+    } loop
+    20 0 1 4 {d exch get sub} for
+    d exch 5 exch put
+    version (b) eq version (limitedb) eq or {  
+        /d [ d {1 add} forall ] def
+    } if
+    /cbs (111111111111) 12 string copy def
+    5 -1 0 {
+        /i exch def
+        cbs 5 i sub 2 mul 1 add d i get 47 add put
+    } for
+
+    % Concatenate the space bar successions
+    /sbs cws length 6 mul 31 add string def
+    encs encs length 2 sub get dup 
+    sbs exch 0 exch putinterval 
+    length /j exch def
+    0 1 cws length 1 sub {
+        /i exch def
+        sbs j encs cws i get get putinterval
+        /j j 6 add def
+    } for
+    sbs j cbs putinterval
+    /j j 12 add def
+    encs encs length 1 sub get dup
+    sbs exch j exch putinterval
+    length j add /j exch def
+    /sbs sbs 0 j getinterval def
+
+    % Return the arguments
+    <<
+    /ren //renlinear
+    /sbs [sbs {48 sub} forall]
+    /bhs [sbs length 1 add 2 idiv {height} repeat]
+    /bbs [sbs length 1 add 2 idiv {0} repeat]
+    /txt [ [text textxoffset textyoffset textfont textsize] ]
+    /textxalign (center)
+    /opt options
+    >>
+
+    dontdraw not //renlinear if
+
+    end
+
+} bind def
+/posicode dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER posicode--
+
+% --BEGIN ENCODER channelcode--
+% --DESC: Channel Code
+% --EXAM: 3493
+% --EXOP: height=0.5 includetext 
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
+/channelcode {
+
+    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
+    /shortfinder false def
+    /includetext false def
+    /includecheck false def
+    /height 1 def
+    
+    % Parse the input options
+    options type /stringtype eq {
+        1 dict begin
+        options {
+            token false eq {exit} if dup length string cvs (=) search
+            true eq {cvlit exch pop exch def} {cvlit true def} ifelse
+        } loop
+        currentdict end /options exch def
+    } if
+    options {def} forall
+
+    /height height cvr def
+  
+    /barlen barcode length def
+
+    barlen 2 ge barlen 7 le and {
+        /channels barlen 1 add def
+    } if
+
+    % Determine finder
+    shortfinder {
+        /finder [ 1 1 1 1 1 ] def
+    } {
+        /finder [ 1 1 1 1 1 1 1 1 1 ] def
+    } ifelse
+
+    /nextb {
+        dup
+        dup s exch get exch
+        dup b exch 1 sub get exch
+        dup s exch 1 sub get exch
+        b exch 2 sub get exch
+        add add add 4 gt {1} {2} ifelse
+        1 index chan 2 add lt {
+            dup 1 4 index {
+                b 3 index 2 index put
+                3 index exch sub 1 add 4 index 3 index 1 add nexts
+            } for
+        } {
+            dup 3 index le {
+                b 2 index 4 index put
+                value target eq {
+                    /out [ 
+                        3 1 10 {dup s exch get exch b exch get} for
+                    ] 0 chan 2 mul getinterval def 
+                } if
+                /value value 1 add def
+            } if
+        } ifelse 
+        pop pop pop pop
+    } bind def
+
+    /nexts {
+        dup chan 2 add lt {1} {1 index} ifelse 1 3 index {
+            s 2 index 2 index put
+            2 index exch sub 1 add 3 index 2 index nextb
+        } for
+        pop pop pop
+    } bind def
+
+    /encode {
+        /chan exch def
+        /target exch def
+        /value 0 def
+        /out -1 def
+        /b [ 1 1 1 0 0 0 0 0 0 0 0 ] def
+        /s [ 0 1 1 0 0 0 0 0 0 0 0 ] def
+        chan dup 3 nexts
+        out
+    } bind def
+
+    % Encode the main data
+    /data barcode cvi channels encode def
+
+    % Determine check data
+    /check [] def
+    includecheck {
+        /mod23 [
+            [] [] []
+            [ 13 12  4  9  3  1 ]
+            [ 13  2 12  3 18 16  4  1 ]
+            [ 11 16 17  8 20  4 10  2  5  1 ]
+            [  1  4 16 18  3 12  2  8  9 13  6  1 ]
+            [ 20 16 22 13 15 12  5  4  8  9 21  3  7  1 ]
+            [  2  6 18  8  1  3  9  4 12 13 16  2  6 18  8  1 ]
+        ] channels get def
+        0
+        0 1 data length 1 sub {
+            dup data exch get 1 sub exch mod23 exch get mul add
+        } for
+        23 mod 3 encode /check exch def
+    } if
+
+    % Construct the symbol
+    /sbs [
+        finder aload pop
+        data aload pop
+        check aload pop
+    ] def
+
+    % Create the human readable text
+    /txt barlen array def
+    0 1 barlen 1 sub {
+        /i exch def
+        txt i [barcode i 1 getinterval 0 0 () 0] put
+    } for
+
+    % Return the arguments
+    <<
+    /ren //renlinear
+    /sbs sbs
+    /bhs [sbs length 1 add 2 idiv {height} repeat]
+    /bbs [sbs length 1 add 2 idiv {0} repeat]
+    /txt txt
+    /textxalign (center)
+    /opt options
+    >>
+
+    dontdraw not //renlinear if
+
+    end
+
+} bind def
+/channelcode dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER channelcode--
+
+% --BEGIN ENCODER flattermarken--
+% --DESC: Flattermarken
+% --EXAM: 12345
+% --EXOP: inkspread=-0.25
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
+/flattermarken {
+
+    20 dict begin                 % Confine variable to local scope
+
+    /options exch def       % We are given an option string
+    /barcode exch def       % We are given a barcode string
+
+    /dontdraw false def
+    /includetext false def   % Enable/disable text
+    /textfont /Courier def
+    /textsize 10 def
+    /textyoffset -7 def
+    /height 0.3 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
+
+    /textfont textfont cvlit def
+    /textsize textsize cvr def
+    /textyoffset textyoffset cvr def
+    /height height cvr def
+
+    % Create an array containing the character mappings
+    /encs
+    [ (0018) (0117) (0216) (0315) (0414) (0513) (0612) (0711) (0810)
+      (0900)
+    ] def
+
+    % Create a string of the available characters
+    /barchars (1234567890) def
+
+    /barlen barcode length def            % Length of the code
+
+    /sbs barlen 4 mul string def
+    /txt barlen array def
+
+    0 1 barlen 1 sub {
+        /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
+        /enc encs indx get def              % Get the indxth encoding
+        sbs i 4 mul enc putinterval         % Put encoded digit into sbs
+        txt i [barcode i 1 getinterval i 9 mul textyoffset textfont textsize] put
+    } for
+
+    % Return the arguments
+    <<
+    /ren //renlinear
+    /sbs [sbs {48 sub} forall]
+    /bhs [sbs length 1 add 2 idiv {height} repeat]
+    /bbs [sbs length 1 add 2 idiv {0} repeat]
+    /txt txt
+    /opt options
+    >>
+
+    dontdraw not //renlinear if
+
+    end
+
+} bind def
+/flattermarken dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER flattermarken--
+
+% --BEGIN ENCODER raw--
+% --DESC: Raw bar space succession for custom symbologies 
+% --EXAM: 331132131313411122131311333213114131131221323
+% --EXOP: height=0.5
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
+/raw {
+
+    20 dict begin                  % Confine variables to local scope
+
+    /options exch def        % We are given an option string
+    /sbs exch def        % We are given a barcode string
+
+    /dontdraw false def
+    /height 1 def
+
+    % Parse the input options
+    options type /stringtype eq {
+        1 dict begin
+        options {
+            token false eq {exit} if dup length string cvs (=) search
+            true eq {cvlit exch pop exch def} {cvlit true def} ifelse
+        } loop
+        currentdict end /options exch def
+    } if
+    options {def} forall
+
+    /height height cvr def
+
+    % Return the arguments
+    <<
+    /ren //renlinear
+    /sbs [sbs {48 sub} forall]
+    /bhs [sbs length 1 add 2 idiv {height} repeat]
+    /bbs [sbs length 1 add 2 idiv {0} repeat]
+    /opt options
+    >>
+
+    dontdraw not //renlinear if
+
+    end
+
+} bind def
+/raw dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER raw--
+
+% --BEGIN ENCODER daft--
+% --DESC: Raw DAFT succession for custom 4 state symbologies
+% --EXAM: FATDAFTDAD
+% --EXOP:
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
+/daft {
+
+    20 dict begin
+
+    /options exch def              % We are given an option string
+    /barcode exch def              % We are given a barcode string
+
+    /dontdraw false def
+    /height 0.175 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
+
+    /height height cvr def
+
+    /barlen barcode length def
+
+    /bbs barlen array def
+    /bhs barlen array def
+    0 1 barlen 1 sub {
+        /i exch def
+        /enc barcode i 1 getinterval def
+        enc (D) eq {
+            bbs i 0 height mul 8 div put
+            bhs i 5 height mul 8 div put
+        } if
+        enc (A) eq {
+            bbs i 3 height mul 8 div put
+            bhs i 5 height mul 8 div put
+        } if
+        enc (F) eq {
+            bbs i 0 height mul 8 div put
+            bhs i 8 height mul 8 div put
+        } if
+        enc (T) eq {
+            bbs i 3 height mul 8 div put
+            bhs i 2 height mul 8 div put
+        } if
+    } for
+
+    % Return the arguments
+    <<
+    /ren //renlinear
+    /bbs bbs
+    /bhs bhs
+    /sbs [bhs length 1 sub {1.44 1.872} repeat 1.44]
+    /opt options
+    >>
+
+    dontdraw not //renlinear if
+
+    end
+
+} bind def
+/daft dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER daft--
+
+% --BEGIN ENCODER symbol--
+% --DESC: Miscellaneous symbols
+% --EXAM: fima
+% --EXOP: backgroundcolor=DD000011
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+begin
+/symbol {
+
+    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
+
+    barcode (fima) eq {
+        /sbs [2.25 2.25 2.25 11.25 2.25 11.25 2.25 2.25 2.25] def
+        /bhs [.625 .625 .625 .625 .625] def
+        /bbs [0 0 0 0 0] def
+    } if
+
+    barcode (fimb) eq {
+        /sbs [2.25 6.75 2.25 2.25 2.25 6.25 2.25 2.25 2.25 6.75 2.25] def
+        /bhs [.625 .625 .625 .625 .625 .625] def
+        /bbs [0 0 0 0 0 0] def
+    } if
+
+    barcode (fimc) eq {
+        /sbs [2.25 2.25 2.25 6.75 2.25 6.75 2.25 6.75 2.25 2.25 2.25] def
+        /bhs [.625 .625 .625 .625 .625 .625] def
+        /bbs [0 0 0 0 0 0] def
+    } if
+    
+    barcode (fimd) eq {
+        /sbs [2.25 2.25 2.25 2.25 2.25 6.75 2.25 6.75 2.25 2.25 2.25 2.25 2.25] def
+        /bhs [.625 .625 .625 .625 .625 .625 .625] def
+        /bbs [0 0 0 0 0 0 0] def
+    } if
+    
+    % Return the arguments
+    <<
+    /ren //renlinear
+    /sbs sbs
+    /bhs bhs
+    /bbs bbs
+    /opt options
+    >>
+
+    dontdraw not //renlinear if
+
+    end
+
+} bind def
+/symbol dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER symbol--
+
+% --BEGIN ENCODER pdf417--
+% --DESC: PDF417
+% --EXAM: This is PDF417
+% --EXOP:
+% --RNDR: renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/pdf417 {
+
+    20 dict begin
+
+    /options exch def
+    /barcode exch def
+
+    /dontdraw false def
+    /compact false def
+    /eclevel -1 def
+    /columns 0 def
+    /rows 0 def
+    /rowmult 3 def
+    /ccc false 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
+
     /eclevel eclevel cvi def
     /columns columns cvi def
     /rows rows cvi def
     /rowmult rowmult cvr def
 
-    % Split the input barcode into an array of codewords
-    /datcws barcode length array def
-    /i 0 def /j 0 def
-    { % loop
-        i barcode length eq {exit} if
-        /cw barcode i 1 add 3 getinterval cvi def
-        datcws j cw put
-        /i i 4 add def
-        /j j 1 add def
-    } loop
-    /datcws datcws 0 j getinterval 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
+
+    % Convert input into array of codewords
+    raw {
+        /datcws barcode length array def
+        /i 0 def /j 0 def
+        { % loop
+            i barcode length eq {exit} if
+            /cw barcode i 1 add 3 getinterval cvi def
+            datcws j cw put
+            /i i 4 add def
+            /j j 1 add def
+        } loop
+        /datcws datcws 0 j getinterval def
+    } {  % Simple autoencoder from input to codewords using byte mode
+        /barlen barcode length def
+        barlen 6 mod 0 eq {
+            /datcws barlen 6 idiv 5 mul 1 add array def
+            datcws 0 924 put
+        } {
+            /datcws barlen 6 idiv 5 mul barlen 6 mod add 1 add array def
+            datcws 0 901 put 
+        } ifelse
+
+        % Rebase groups of 6 bytes splitting into 3 byte chunks
+        0 1 barlen 6 idiv 1 sub {
+            /i exch def
+            /msbs [ barcode i 6 mul 3 getinterval {} forall ] def
+            /mscs [
+                msbs aload pop exch 256 mul add exch 65536 mul add 
+                3 {dup 900 mod exch 900 idiv} repeat 
+            ] def
+            /lsbs [barcode i 6 mul 3 add 3 getinterval {} forall] def
+            /lscs [
+                lsbs aload pop exch 256 mul add exch 65536 mul add
+                3 {dup 900 mod exch 900 idiv} repeat
+            ] def
+            /cws 5 array def
+            lscs 0 get mscs 0 get 316 mul add
+            cws 4 2 index 900 mod put
+            900 idiv lscs 1 get add mscs 0 get 641 mul add mscs 1 get 316 mul add
+            cws 3 2 index 900 mod put 
+            900 idiv lscs 2 get add mscs 0 get 20 mul add mscs 1 get 641 mul add mscs 2 get 316 mul add 
+            cws 2 2 index 900 mod put
+            900 idiv lscs 3 get add mscs 1 get 20 mul add mscs 2 get 641 mul add
+            cws 1 2 index 900 mod put
+            900 idiv mscs 2 get 20 mul add
+            cws 0 3 -1 roll 900 mod put
+            datcws i 5 mul 1 add cws putinterval 
+        } for
+
+        % Add the remaining bytes to the end of the codewords
+        /rem barlen 6 mod def
+        rem 0 ne {
+            datcws datcws length rem sub 
+            [ barcode barlen rem sub rem getinterval {} forall ] 
+            putinterval
+        } if
+
+        ccc {/datcws [920 datcws aload pop] def} if
+
+    } ifelse
 
     % Determine the error correction level if unspecified
     /m datcws length def
     eclevel -1 eq {
-        m 40 le {/eclevel 2 def} if
-        m 41 ge m 160 le and {/eclevel 3 def} if
+        m  40 le              {/eclevel 2 def} if
+        m  41 ge m 160 le and {/eclevel 3 def} if
         m 161 ge m 320 le and {/eclevel 4 def} if
-        m 321 ge {/eclevel 5 def} if
+        m 321 ge              {/eclevel 5 def} if
     } if
 
     % Reduce the error level so that it does not cause an excessive number of codewords
@@ -4610,6 +8896,7 @@
     /k 2 eclevel 1 add exp cvi def
 
     % To determine size of matrix, number of columns if given by user...
+    columns 0 eq {/columns m k add 3 div sqrt round cvi def} if
     columns 1 ge columns 30 le and {/c columns def} if
 
     % ... and rows is greater of those required and that given by user within limits
@@ -4618,7 +8905,7 @@
     r 3 lt {/r 3 def} if
 
     % Opportunistically raise the error level if a better fit to the matrix is possible
-    /maxeclevel c r mul 1 sub m sub ln 2 ln div cvi 1 sub def
+    /maxeclevel c r mul 1 sub m sub ln 2 ln div cvi 1 sub 8 2 copy gt {exch} if pop def
     maxeclevel eclevel gt {
       /eclevel maxeclevel def
       /k 2 eclevel 1 add exp cvi def
@@ -4658,7 +8945,7 @@
         coeffs 0 coeffs 0 get rsalog i get rsprod put
     } for
     /coeffs coeffs 0 coeffs length 1 sub getinterval def
-    1 2 coeffs length 1 sub {coeffs exch 2 copy get 929 exch sub put} for
+    coeffs length 1 sub -2 0 {coeffs exch 2 copy get 929 exch sub put} for
 
     % Derive the error codewords
     0 1 n 1 sub {
@@ -4668,7 +8955,7 @@
             cws n j add cws n j add 1 add get 929 t coeffs k j sub 1 sub get mul 929 mod sub add 929 mod put
         } for
     } for
-    n 1 n k add { dup cws exch 929 cws 5 -1 roll get sub put } for
+    n 1 n k add { dup cws exch 929 cws 5 -1 roll get sub 929 mod put } for
 
     % Trim the working space from the end of the codewords
     /cws cws 0 cws length 1 sub getinterval def
@@ -4962,7 +9249,7 @@
 
     % Return the arguments
     <<
-    /ren (renmatrix)
+    /ren //renmatrix
     /pixs pixs
     /pixx rwid
     /pixy r
@@ -4971,21 +9258,28 @@
     /opt options
     >>
 
-    dontdraw not {//renmatrix exec} if
+    dontdraw not //renmatrix if
 
     end
 
 } bind def
+/pdf417 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER pdf417--
 
-% --BEGIN ENCODER datamatrix--
-% --DESC: Data Matrix
-% --EXAM: ^142^164^186
-% --EXOP: rows=32 columns=32
+% --BEGIN ENCODER micropdf417--
+% --DESC: MicroPDF417
+% --EXAM: MicroPDF417
+% --EXOP:
 % --RNDR: renmatrix
-/datamatrix {
-
-    1 dict begin
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/micropdf417 {
+
+    20 dict begin
 
     /options exch def
     /barcode exch def
@@ -4993,6 +9287,11 @@
     /dontdraw false def
     /columns 0 def
     /rows 0 def
+    /rowmult 2 def
+    /cca false def
+    /ccb false def
+    /raw false def
+    /parse false def
 
     % Parse the input options
     options type /stringtype eq {
@@ -5007,18 +9306,812 @@
 
     /columns columns cvi def
     /rows rows cvi def
-
-    % Split the input barcode into an array of codewords
-    /cws barcode length array def
-    /i 0 def /j 0 def
+    /rowmult rowmult cvr def
+
+    cca {/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
+
+    % Convert input into array of codewords
+    raw {
+        /datcws barcode length array def
+        /i 0 def /j 0 def
+        { % loop
+            i barcode length eq {exit} if
+            /cw barcode i 1 add 3 getinterval cvi def
+            datcws j cw put
+            /i i 4 add def
+            /j j 1 add def
+        } loop
+        /datcws datcws 0 j getinterval def
+    } {  % Simple autoencoder from input to codewords using byte mode
+        /barlen barcode length def
+        barlen 6 mod 0 eq {
+            /datcws barlen 6 idiv 5 mul 1 add array def
+            datcws 0 924 put
+        } {
+            /datcws barlen 6 idiv 5 mul barlen 6 mod add 1 add array def
+            datcws 0 901 put 
+        } ifelse
+
+        % Rebase groups of 6 bytes splitting into 3 byte chunks
+        0 1 barlen 6 idiv 1 sub {
+            /i exch def
+            /msbs [ barcode i 6 mul 3 getinterval {} forall ] def
+            /mscs [
+                msbs aload pop exch 256 mul add exch 65536 mul add 
+                3 {dup 900 mod exch 900 idiv} repeat 
+            ] def
+            /lsbs [barcode i 6 mul 3 add 3 getinterval {} forall] def
+            /lscs [
+                lsbs aload pop exch 256 mul add exch 65536 mul add
+                3 {dup 900 mod exch 900 idiv} repeat
+            ] def
+            /cws 5 array def
+            lscs 0 get mscs 0 get 316 mul add
+            cws 4 2 index 900 mod put
+            900 idiv lscs 1 get add mscs 0 get 641 mul add mscs 1 get 316 mul add
+            cws 3 2 index 900 mod put 
+            900 idiv lscs 2 get add mscs 0 get 20 mul add mscs 1 get 641 mul add mscs 2 get 316 mul add 
+            cws 2 2 index 900 mod put
+            900 idiv lscs 3 get add mscs 1 get 20 mul add mscs 2 get 641 mul add
+            cws 1 2 index 900 mod put
+            900 idiv mscs 2 get 20 mul add
+            cws 0 3 -1 roll 900 mod put
+            datcws i 5 mul 1 add cws putinterval 
+        } for
+
+        % Add the remaining bytes to the end of the codewords
+        /rem barlen 6 mod def
+        rem 0 ne {
+            datcws datcws length rem sub 
+            [ barcode barlen rem sub rem getinterval {} forall ] 
+            putinterval
+        } if
+
+        ccb {/datcws [920 datcws aload pop] def} if
+
+    } ifelse
+
+    % Basic metrics for the each symbol
+    %     c  r ecw  rl rc rr
+    /metrics [
+        [ 1 11   7   1  0  9 ]
+        [ 1 14   7   8  0  8 ]
+        [ 1 17   7  36  0 36 ]
+        [ 1 20   8  19  0 19 ]
+        [ 1 24   8   9  0 17 ]
+        [ 1 28   8  25  0 33 ]
+        [ 2  8   8   1  0  1 ]
+        [ 2 11   9   1  0  9 ]
+        [ 2 14   9   8  0  8 ]
+        [ 2 17  10  36  0 36 ]
+        [ 2 20  11  19  0 19 ]
+        [ 2 23  13   9  0 17 ]
+        [ 2 26  15  27  0 35 ]
+        [ 3  6  12   1  1  1 ]
+        [ 3  8  14   7  7  7 ]
+        [ 3 10  16  15 15 15 ]
+        [ 3 12  18  25 25 25 ]
+        [ 3 15  21  37 37 37 ]
+        [ 3 20  26   1 17 33 ]
+        [ 3 26  32   1  9 17 ]
+        [ 3 32  38  21 29 37 ]
+        [ 3 38  44  15 31 47 ]
+        [ 3 44  50   1 25 49 ]
+        [ 4  4   8  47 19 43 ]
+        [ 4  6  12   1  1  1 ]
+        [ 4  8  14   7  7  7 ]
+        [ 4 10  16  15 15 15 ]
+        [ 4 12  18  25 25 25 ]
+        [ 4 15  21  37 37 37 ]
+        [ 4 20  26   1 17 33 ]
+        [ 4 26  32   1  9 17 ]
+        [ 4 32  38  21 29 37 ]
+        [ 4 38  44  15 31 47 ]
+        [ 4 44  50   1 25 49 ]
+    ] def
+
+    % Basic metrics for the each symbol
+    %     c  r ecw  rl rc rr
+    /ccametrics [
+        [ 2  5   4  39  0 19 ]
+        [ 2  6   4   1  0 33 ]
+        [ 2  7   5  32  0 12 ]
+        [ 2  8   5   8  0 40 ]
+        [ 2  9   6  14  0 46 ]
+        [ 2 10   6  43  0 23 ]
+        [ 2 12   7  20  0 52 ]
+        [ 3  4   4  11 43 23 ]
+        [ 3  5   5   1 33 13 ]
+        [ 3  6   6   5 37 17 ]
+        [ 3  7   7  15 47 27 ]
+        [ 3  8   7  21  1 33 ]
+        [ 4  3   4  40 20 52 ]
+        [ 4  4   5  43 23  3 ]
+        [ 4  5   6  46 26  6 ]
+        [ 4  6   7  34 14 46 ]
+        [ 4  7   8  29  9 41 ]
+    ] def
+    cca {/metrics ccametrics def} if
+
+    % Select metrics of an appropriate symbol
+    /urows rows def
+    /ucols columns def
+    /i 0 def
     { % loop
-        i barcode length 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
+        /m metrics i get def
+        /c    m 0 get def        % Rows in symbol
+        /r    m 1 get def        % Columns 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
+        /rapr m 5 get def        % Right row address pattern
+        /ncws r c mul k sub def  % Data codewords
+        /okay true def
+        datcws length ncws gt     {/okay false def} if
+        urows 0 ne urows r ne and {/okay false def} if
+        ucols 0 ne ucols c ne and {/okay false def} if
+        okay {exit} if
+        /i i 1 add def
     } loop
-    /cws cws 0 j getinterval def
+    /m datcws length def
+
+    % Create codewords array with one extra working space element and add padding
+    /n c r mul k sub def
+    /cws c r mul 1 add array def
+    cws 0 datcws putinterval
+    cws m [ n m sub {900} repeat ] putinterval
+    cws n [ k {0} repeat 0 ] putinterval
+
+    % Calculate the log and anti-log tables
+    /rsalog [ 1 928 {dup 3 mul 929 mod} repeat ] def
+    /rslog 929 array def
+    1 1 928 {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 928 mod rsalog exch get
+        } {
+            pop pop 0
+        } ifelse
+    } bind def
+
+    % Generate the coefficients
+    /coeffs [ 1 k {0} repeat ] def
+    1 1 k {
+        /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 add 929 mod put
+        } for 
+        coeffs 0 coeffs 0 get rsalog i get rsprod put
+    } for
+    /coeffs coeffs 0 coeffs length 1 sub getinterval def
+    coeffs length 1 sub -2 0 {coeffs exch 2 copy get 929 exch sub put} for
+
+    % Derive the error codewords
+    0 1 n 1 sub {
+        /t exch cws exch get cws n get add 929 mod def
+        0 1 k 1 sub {
+            /j exch def
+            cws n j add cws n j add 1 add get 929 t coeffs k j sub 1 sub get mul 929 mod sub add 929 mod put
+        } for
+    } for
+    n 1 n k add { dup cws exch 929 cws 5 -1 roll get sub 929 mod put } for
+
+    % Trim the working space from the end of the codewords
+    /cws cws 0 cws length 1 sub getinterval def
+
+    % Base 10 encoding of the bar space successions for the codewords in each cluster
+    /clusters [
+        [
+            120256 125680 128380 120032 125560 128318 108736 119920 108640  86080 108592  86048
+            110016 120560 125820 109792 120440 125758  88256 109680  88160  89536 110320 120700
+             89312 110200 120638  89200 110140  89840 110460  89720 110398  89980 128506 119520
+            125304 128190 107712 119408 125244 107616 119352  84032 107568 119324  84000 107544
+             83984 108256 119672 125374  85184 108144 119612  85088 108088 119582  85040 108060
+             85728 108408 119742  85616 108348  85560 108318  85880 108478  85820  85790 107200
+            119152 125116 107104 119096 125086  83008 107056 119068  82976 107032  82960  82952
+             83648 107376 119228  83552 107320 119198  83504 107292  83480  83468  83824 107452
+             83768 107422  83740  83900 106848 118968 125022  82496 106800 118940  82464 106776
+            118926  82448 106764  82440 106758  82784 106936 119006  82736 106908  82712 106894
+             82700  82694 106974  82830  82240 106672 118876  82208 106648 118862  82192 106636
+             82184 106630  82180  82352  82328  82316  82080 118830 106572 106566  82050 117472
+            124280 127678 103616 117360 124220 103520 117304 124190  75840 103472  75808 104160
+            117624 124350  76992 104048 117564  76896 103992  76848  76824  77536 104312 117694
+             77424 104252  77368  77340  77688 104382  77628  77758 121536 126320 128700 121440
+            126264 128670 111680 121392 126236 111648 121368 126222 111632 121356 103104 117104
+            124092 112320 103008 117048 124062 112224 121656 126366  93248  74784 102936 117006
+             93216 112152  93200  75456 103280 117180  93888  75360 103224 117150  93792 112440
+            121758  93744  75288  93720  75632 103356  94064  75576 103326  94008 112542  93980
+             75708  94140  75678  94110 121184 126136 128606 111168 121136 126108 111136 121112
+            126094 111120 121100 111112 111108 102752 116920 123998 111456 102704 116892  91712
+             74272 121244 116878  91680  74256 102668  91664 111372 102662  74244  74592 102840
+            116958  92000  74544 102812  91952 111516 102798  91928  74508  74502  74680 102878
+             92088  74652  92060  74638  92046  92126 110912 121008 126044 110880 120984 126030
+            110864 120972 110856 120966 110852 110850  74048 102576 116828  90944  74016 102552
+            116814  90912 111000 121038  90896  73992 102534  90888 110982  90884  74160 102620
+             91056  74136 102606  91032 111054  91020  74118  91014  91100  91086 110752 120920
+            125998 110736 120908 110728 120902 110724 110722  73888 102488 116782  90528  73872
+            102476  90512 110796 102470  90504  73860  90500  73858  73944  90584  90572  90566
+            120876 120870 110658 102444  73800  90312  90308  90306 101056 116080 123580 100960
+            116024  70720 100912 115996  70688 100888  70672  70664  71360 101232 116156  71264
+            101176 116126  71216 101148  71192  71180  71536 101308  71480 101278  71452  71612
+             71582 118112 124600 127838 105024 118064 124572 104992 118040 124558 104976 118028
+            104968 118022 100704 115896 123486 105312 100656 115868  79424  70176 118172 115854
+             79392 105240 100620  79376  70152  79368  70496 100792 115934  79712  70448 118238
+             79664 105372 100750  79640  70412  79628  70584 100830  79800  70556  79772  70542
+             70622  79838 122176 126640 128860 122144 126616 128846 122128 126604 122120 126598
+            122116 104768 117936 124508 113472 104736 126684 124494 113440 122264 126670 113424
+            104712 117894 113416 122246 104706  69952 100528 115804  78656  69920 100504 115790
+             96064  78624 104856 117966  96032 113560 122318 100486  96016  78600 104838  96008
+             69890  70064 100572  78768  70040 100558  96176  78744 104910  96152 113614  70022
+             78726  70108  78812  70094  96220  78798 122016 126552 128814 122000 126540 121992
+            126534 121988 121986 104608 117848 124462 113056 104592 126574 113040 122060 117830
+            113032 104580 113028 104578 113026  69792 100440 115758  78240  69776 100428  95136
+             78224 104652 100422  95120 113100  69764  95112  78212  69762  78210  69848 100462
+             78296  69836  95192  78284  69830  95180  78278  69870  95214 121936 126508 121928
+            126502 121924 121922 104528 117804 112848 104520 117798 112840 121958 112836 104514
+            112834  69712 100396  78032  69704 100390  94672  78024 104550  94664 112870  69698
+             94660  78018  94658  78060  94700  94694 126486 121890 117782 104484 104482  69672
+             77928  94440  69666  77922  99680  68160  99632  68128  99608 115342  68112  99596
+             68104  99590  68448  99768 115422  68400  99740  68376  99726  68364  68358  68536
+             99806  68508  68494  68574 101696 116400 123740 101664 116376 101648 116364 101640
+            116358 101636  67904  99504 115292  72512  67872 116444 115278  72480 101784 116430
+             72464  67848  99462  72456 101766  67842  68016  99548  72624  67992  99534  72600
+            101838  72588  67974  68060  72668  68046  72654 118432 124760 127918 118416 124748
+            118408 124742 118404 118402 101536 116312 105888 101520 116300 105872 118476 116294
+            105864 101508 105860 101506 105858  67744  99416  72096  67728 116334  80800  72080
+            101580  99398  80784 105932  67716  80776  72068  67714  72066  67800  99438  72152
+             67788  80856  72140  67782  80844  72134  67822  72174  80878 126800 128940 126792
+            128934 126788 126786 118352 124716 122576 126828 124710 122568 126822 122564 118338
+            122562 101456 116268 105680 101448 116262 114128 105672 118374 114120 122598 101442
+            114116 105666 114114  67664  99372  71888  67656  99366  80336  71880 101478  97232
+             80328 105702  67650  97224 114150  71874  97220  67692  71916  67686  80364  71910
+             97260  80358  97254 126760 128918 126756 126754 118312 124694 122472 126774 122468
+            118306 122466 101416 116246 105576 101412 113896 105572 101410 113892 105570 113890
+             67624  99350  71784 101430  80104  71780  67618  96744  80100  71778  96740  80098
+             96738  71798  96758 126738 122420 122418 105524 113780 113778  71732  79988  96500
+             96498  66880  66848  98968  66832  66824  66820  66992  66968  66956  66950  67036
+             67022 100000  99984 115532  99976 115526  99972  99970  66720  98904  69024 100056
+             98892  69008 100044  69000 100038  68996  66690  68994  66776  98926  69080 100078
+             69068  66758  69062  66798  69102 116560 116552 116548 116546  99920 102096 116588
+            115494 102088 116582 102084  99906 102082  66640  68816  66632  98854  73168  68808
+             66628  73160  68804  66626  73156  68802  66668  68844  66662  73196  68838  73190
+            124840 124836 124834 116520 118632 124854 118628 116514 118626  99880 115478 101992
+            116534 106216 101988  99874 106212 101986 106210  66600  98838  68712  99894  72936
+             68708  66594  81384  72932  68706  81380  72930  66614  68726  72950  81398 128980
+            128978 124820 126900 124818 126898 116500 118580 116498 122740 118578 122738  99860
+            101940  99858 106100 101938 114420
+        ] [
+            128352 129720 125504 128304 129692 125472 128280 129678 125456 128268 125448 128262
+            125444 125792 128440 129758 120384 125744 128412 120352 125720 128398 120336 125708
+            120328 125702 120324 120672 125880 128478 110144 120624 125852 110112 120600 125838
+            110096 120588 110088 120582 110084 110432 120760 125918  89664 110384 120732  89632
+            110360 120718  89616 110348  89608 110342  89952 110520 120798  89904 110492  89880
+            110478  89868  90040 110558  90012  89998 125248 128176 129628 125216 128152 129614
+            125200 128140 125192 128134 125188 125186 119616 125360 128220 119584 125336 128206
+            119568 125324 119560 125318 119556 119554 108352 119728 125404 108320 119704 125390
+            108304 119692 108296 119686 108292 108290  85824 108464 119772  85792 108440 119758
+             85776 108428  85768 108422  85764  85936 108508  85912 108494  85900  85894  85980
+             85966 125088 128088 129582 125072 128076 125064 128070 125060 125058 119200 125144
+            128110 119184 125132 119176 125126 119172 119170 107424 119256 125166 107408 119244
+            107400 119238 107396 107394  83872 107480 119278  83856 107468  83848 107462  83844
+             83842  83928 107502  83916  83910  83950 125008 128044 125000 128038 124996 124994
+            118992 125036 118984 125030 118980 118978 106960 119020 106952 119014 106948 106946
+             82896 106988  82888 106982  82884  82882  82924  82918 124968 128022 124964 124962
+            118888 124982 118884 118882 106728 118902 106724 106722  82408 106742  82404  82402
+            124948 124946 118836 118834 106612 106610 124224 127664 129372 124192 127640 129358
+            124176 127628 124168 127622 124164 124162 117568 124336 127708 117536 124312 127694
+            117520 124300 117512 124294 117508 117506 104256 117680 124380 104224 117656 124366
+            104208 117644 104200 117638 104196 104194  77632 104368 117724  77600 104344 117710
+             77584 104332  77576 104326  77572  77744 104412  77720 104398  77708  77702  77788
+             77774 128672 129880  93168 128656 129868  92664 128648 129862  92412 128644 128642
+            124064 127576 129326 126368 124048 129902 126352 128716 127558 126344 124036 126340
+            124034 126338 117152 124120 127598 121760 117136 124108 121744 126412 124102 121736
+            117124 121732 117122 121730 103328 117208 124142 112544 103312 117196 112528 121804
+            117190 112520 103300 112516 103298 112514  75680 103384 117230  94112  75664 103372
+             94096 112588 103366  94088  75652  94084  75650  75736 103406  94168  75724  94156
+             75718  94150  75758 128592 129836  91640 128584 129830  91388 128580  91262 128578
+            123984 127532 126160 123976 127526 126152 128614 126148 123970 126146 116944 124012
+            121296 116936 124006 121288 126182 121284 116930 121282 102864 116972 111568 102856
+            116966 111560 121318 111556 102850 111554  74704 102892  92112  74696 102886  92104
+            111590  92100  74690  92098  74732  92140  74726  92134 128552 129814  90876 128548
+             90750 128546 123944 127510 126056 128566 126052 123938 126050 116840 123958 121064
+            116836 121060 116834 121058 102632 116854 111080 121078 111076 102626 111074  74216
+            102646  91112  74212  91108  74210  91106  74230  91126 128532  90494 128530 123924
+            126004 123922 126002 116788 120948 116786 120946 102516 110836 102514 110834  73972
+             90612  73970  90610 128522 123914 125978 116762 120890 102458 110714 123552 127320
+            129198 123536 127308 123528 127302 123524 123522 116128 123608 127342 116112 123596
+            116104 123590 116100 116098 101280 116184 123630 101264 116172 101256 116166 101252
+            101250  71584 101336 116206  71568 101324  71560 101318  71556  71554  71640 101358
+             71628  71622  71662 127824 129452  79352 127816 129446  79100 127812  78974 127810
+            123472 127276 124624 123464 127270 124616 127846 124612 123458 124610 115920 123500
+            118224 115912 123494 118216 124646 118212 115906 118210 100816 115948 105424 100808
+            115942 105416 118246 105412 100802 105410  70608 100844  79824  70600 100838  79816
+            105446  79812  70594  79810  70636  79852  70630  79846 129960  95728 113404 129956
+             95480 113278 129954  95356  95294 127784 129430  78588 128872 129974  95996  78462
+            128868 127778  95870 128866 123432 127254 124520 123428 126696 128886 123426 126692
+            124514 126690 115816 123446 117992 115812 122344 117988 115810 122340 117986 122338
+            100584 115830 104936 100580 113640 104932 100578 113636 104930 113634  70120 100598
+             78824  70116  96232  78820  70114  96228  78818  96226  70134  78838 129940  94968
+            113022 129938  94844  94782 127764  78206 128820 127762  95102 128818 123412 124468
+            123410 126580 124466 126578 115764 117876 115762 122100 117874 122098 100468 104692
+            100466 113140 104690 113138  69876  78324  69874  95220  78322  95218 129930  94588
+             94526 127754 128794 123402 124442 126522 115738 117818 121978 100410 104570 112890
+             69754  78074  94714  94398 123216 127148 123208 127142 123204 123202 115408 123244
+            115400 123238 115396 115394  99792 115436  99784 115430  99780  99778  68560  99820
+             68552  99814  68548  68546  68588  68582 127400 129238  72444 127396  72318 127394
+            123176 127126 123752 123172 123748 123170 123746 115304 123190 116456 115300 116452
+            115298 116450  99560 115318 101864  99556 101860  99554 101858  68072  99574  72680
+             68068  72676  68066  72674  68086  72694 129492  80632 105854 129490  80508  80446
+            127380  72062 127924 127378  80766 127922 123156 123700 123154 124788 123698 124786
+            115252 116340 115250 118516 116338 118514  99444 101620  99442 105972 101618 105970
+             67828  72180  67826  80884  72178  80882  97008 114044  96888 113982  96828  96798
+            129482  80252 130010  97148  80190  97086 127370 127898 128954 123146 123674 124730
+            126842 115226 116282 118394 122618  99386 101498 105722 114170  67706  71930  80378
+             96632 113854  96572  96542  80062  96702  96444  96414  96350 123048 123044 123042
+            115048 123062 115044 115042  99048 115062  99044  99042  67048  99062  67044  67042
+             67062 127188  68990 127186 123028 123316 123026 123314 114996 115572 114994 115570
+             98932 100084  98930 100082  66804  69108  66802  69106 129258  73084  73022 127178
+            127450 123018 123290 123834 114970 115514 116602  98874  99962 102138  66682  68858
+             73210  81272 106174  81212  81182  72894  81342  97648 114364  97592 114334  97564
+             97550  81084  97724  81054  97694  97464 114270  97436  97422  80990  97502  97372
+             97358  97326 114868 114866  98676  98674  66292  66290 123098 114842 115130  98618
+             99194  66170  67322  69310  73404  73374  81592 106334  81564  81550  73310  81630
+             97968 114524  97944 114510  97932  97926  81500  98012  81486  97998  97880 114478
+             97868  97862  81454  97902  97836  97830  69470  73564  73550  81752 106414  81740
+             81734  73518  81774  81708  81702
+        ] [
+            109536 120312  86976 109040 120060  86496 108792 119934  86256 108668  86136 129744
+             89056 110072 129736  88560 109820 129732  88312 109694 129730  88188 128464 129772
+             89592 128456 129766  89340 128452  89214 128450 125904 128492 125896 128486 125892
+            125890 120784 125932 120776 125926 120772 120770 110544 120812 110536 120806 110532
+             84928 108016 119548  84448 107768 119422  84208 107644  84088 107582  84028 129640
+             85488 108284 129636  85240 108158 129634  85116  85054 128232 129654  85756 128228
+             85630 128226 125416 128246 125412 125410 119784 125430 119780 119778 108520 119798
+            108516 108514  83424 107256 119166  83184 107132  83064 107070  83004  82974 129588
+             83704 107390 129586  83580  83518 128116  83838 128114 125172 125170 119284 119282
+            107508 107506  82672 106876  82552 106814  82492  82462 129562  82812  82750 128058
+            125050 119034  82296 106686  82236  82206  82366  82108  82078  76736 103920 117500
+             76256 103672 117374  76016 103548  75896 103486  75836 129384  77296 104188 129380
+             77048 104062 129378  76924  76862 127720 129398  77564 127716  77438 127714 124392
+            127734 124388 124386 117736 124406 117732 117730 104424 117750 104420 104418 112096
+            121592 126334  92608 111856 121468  92384 111736 121406  92272 111676  92216 111646
+             92188  75232 103160 117118  93664  74992 103036  93424 112252 102974  93304  74812
+             93244  74782  93214 129332  75512 103294 129908 129330  93944  75388 129906  93820
+             75326  93758 127604  75646 128756 127602  94078 128754 124148 126452 124146 126450
+            117236 121844 117234 121842 103412 103410  91584 111344 121212  91360 111224 121150
+             91248 111164  91192 111134  91164  91150  74480 102780  91888  74360 102718  91768
+            111422  91708  74270  91678 129306  74620 129850  92028  74558  91966 127546 128634
+            124026 126202 116986 121338 102906  90848 110968 121022  90736 110908  90680 110878
+             90652  90638  74104 102590  91000  74044  90940  74014  90910  74174  91070  90480
+            110780  90424 110750  90396  90382  73916  90556  73886  90526  90296 110686  90268
+             90254  73822  90334  90204  90190  71136 101112 116094  70896 100988  70776 100926
+             70716  70686 129204  71416 101246 129202  71292  71230 127348  71550 127346 123636
+            123634 116212 116210 101364 101362  79296 105200 118140  79072 105080 118078  78960
+            105020  78904 104990  78876  78862  70384 100732  79600  70264 100670  79480 105278
+             79420  70174  79390 129178  70524 129466  79740  70462  79678 127290 127866 123514
+            124666 115962 118266 100858 113376 122232 126654  95424 113264 122172  95328 113208
+            122142  95280 113180  95256 113166  95244  78560 104824 117950  95968  78448 104764
+             95856 113468 104734  95800  78364  95772  78350  95758  70008 100542  78712  69948
+             96120  78652  69918  96060  78622  96030  70078  78782  96190  94912 113008 122044
+             94816 112952 122014  94768 112924  94744 112910  94732  94726  78192 104636  95088
+             78136 104606  95032 113054  95004  78094  94990  69820  78268  69790  95164  78238
+             95134  94560 112824 121950  94512 112796  94488 112782  94476  94470  78008 104542
+             94648  77980  94620  77966  94606  69726  78046  94686  94384 112732  94360 112718
+             94348  94342  77916  94428  77902  94414  94296 112686  94284  94278  77870  94318
+             94252  94246  68336  99708  68216  99646  68156  68126  68476  68414 127162 123258
+            115450  99834  72416 101752 116414  72304 101692  72248 101662  72220  72206  67960
+             99518  72568  67900  72508  67870  72478  68030  72638  80576 105840 118460  80480
+            105784 118430  80432 105756  80408 105742  80396  80390  72048 101564  80752  71992
+            101534  80696  71964  80668  71950  80654  67772  72124  67742  80828  72094  80798
+            114016 122552 126814  96832 113968 122524  96800 113944 122510  96784 113932  96776
+            113926  96772  80224 105656 118366  97120  80176 105628  97072 114076 105614  97048
+             80140  97036  80134  97030  71864 101470  80312  71836  97208  80284  71822  97180
+             80270  97166  67678  71902  80350  97246  96576 113840 122460  96544 113816 122446
+             96528 113804  96520 113798  96516  96514  80048 105564  96688  80024 105550  96664
+            113870  96652  80006  96646  71772  80092  71758  96732  80078  96718  96416 113752
+            122414  96400 113740  96392 113734  96388  96386  79960 105518  96472  79948  96460
+             79942  96454  71726  79982  96494  96336 113708  96328 113702  96324  96322  79916
+             96364  79910  96358  96296 113686  96292  96290  79894  96310  66936  99006  66876
+             66846  67006  68976 100028  68920  99998  68892  68878  66748  69052  66718  69022
+             73056 102072 116574  73008 102044  72984 102030  72972  72966  68792  99934  73144
+             68764  73116  68750  73102  66654  68830  73182  81216 106160 118620  81184 106136
+            118606  81168 106124  81160 106118  81156  81154  72880 101980  81328  72856 101966
+             81304 106190  81292  72838  81286  68700  72924  68686  81372  72910  81358 114336
+            122712 126894 114320 122700 114312 122694 114308 114306  81056 106072 118574  97696
+             81040 106060  97680 114380 106054  97672  81028  97668  81026  97666  72792 101934
+             81112  72780  97752  81100  72774  97740  81094  97734  68654  72814  81134  97774
+            114256 122668 114248 122662 114244 114242  80976 106028  97488  80968 106022  97480
+            114278  97476  80962  97474  72748  81004  72742  97516  80998  97510 114216 122646
+            114212 114210  80936 106006  97384  80932  97380  80930  97378  72726  80950  97398
+            114196 114194  80916  97332  80914  97330  66236  66206  67256  99166  67228  67214
+             66142  67294  69296 100188  69272 100174  69260  69254  67164  69340  67150  69326
+             73376 102232 116654  73360 102220  73352 102214  73348  73346  69208 100142  73432
+            102254  73420  69190  73414  67118  69230  73454 106320 118700 106312 118694 106308
+            106306  73296 102188  81616 106348 102182  81608  73284  81604  73282  81602  69164
+             73324  69158  81644  73318  81638 122792 126934 122788 122786 106280 118678 114536
+            106276 114532 106274 114530  73256 102166  81512  73252  98024  81508  73250  98020
+             81506  98018  69142  73270  81526  98038 122772 122770 106260 114484 106258 114482
+             73236  81460  73234  97908  81458  97906 122762 106250 114458  73226  81434  97850
+             66396  66382  67416  99246  67404  67398  66350  67438  69456 100268  69448 100262
+             69444  69442  67372  69484  67366  69478 102312 116694 102308 102306  69416 100246
+             73576 102326  73572  69410  73570  67350  69430  73590 118740 118738 102292 106420
+            102290 106418  69396  73524  69394  81780  73522  81778 118730 102282 106394  69386
+             73498  81722  66476  66470  67496  99286  67492  67490  66454  67510 100308 100306
+             67476  69556  67474  69554 116714
+        ]
+    ] def
+
+    % Row address patterns
+    /raps [
+        [  % Left and right
+            802 930 946 818 882 890 826 954 922 986 970 906 778
+            794 786 914 978 982 980 916 948 932 934 942 940 936
+            808 812 814 806 822 950 918 790 788 820 884 868 870
+            878 876 872 840 856 860 862 846 844 836 838 834 866
+        ] [  % Centre
+            718 590 622 558 550 566 534 530 538 570 562 546 610
+            626 634 762 754 758 630 628 612 614 582 578 706 738
+            742 740 748 620 556 552 616 744 712 716 708 710 646
+            654 652 668 664 696 688 656 720 592 600 604 732 734
+        ]
+    ] def
+
+    % Return the 17 bits for a codeword in a given cluster
+    /cwtobits {
+        clusters exch get exch get /v exch def
+        [ 17 {0} repeat v 2 17 string cvrs {48 sub} forall ]
+        dup length 17 sub 17 getinterval
+    } bind def
+
+    % Return the 10 bits for a row address pattern
+    /raptobits {
+        raps exch get exch get /v exch def
+        [ 10 {0} repeat v 2 10 string cvrs {48 sub} forall ]
+        dup length 10 sub 10 getinterval
+    } bind def
+
+    % Populate bitmap for the image
+    /rwid [38 55 82 99] c 1 sub get def
+    c 3 eq cca and {/rwid 72 def} if
+    /pixs rwid r mul array def
+
+    0 1 r 1 sub {
+        /i exch def
+        /clst i rapl add 1 sub 3 mod def
+        pixs rwid i mul [
+            c 1 eq {
+                i rapl add 1 sub 52 mod 0 raptobits aload pop
+                cws i get clst cwtobits aload pop
+                i rapr add 1 sub 52 mod 0 raptobits aload pop
+            } if
+            c 2 eq {
+                i rapl add 1 sub 52 mod 0 raptobits aload pop
+                cws i 2 mul get clst cwtobits aload pop
+                cws i 2 mul 1 add get clst cwtobits aload pop
+                i rapr add 1 sub 52 mod 0 raptobits aload pop
+            } if
+            c 3 eq {
+                cca not {
+                    i rapl add 1 sub 52 mod 0 raptobits aload pop
+                } if
+                cws i 3 mul get clst cwtobits aload pop
+                i rapc add 1 sub 52 mod 1 raptobits aload pop
+                cws i 3 mul 1 add get clst cwtobits aload pop
+                cws i 3 mul 2 add get clst cwtobits aload pop
+                i rapr add 1 sub 52 mod 0 raptobits aload pop
+            } if
+            c 4 eq {
+                i rapl add 1 sub 52 mod 0 raptobits aload pop
+                cws i 4 mul get clst cwtobits aload pop
+                cws i 4 mul 1 add get clst cwtobits aload pop
+                i rapc add 1 sub 52 mod 1 raptobits aload pop
+                cws i 4 mul 2 add get clst cwtobits aload pop
+                cws i 4 mul 3 add get clst cwtobits aload pop
+                i rapr add 1 sub 52 mod 0 raptobits aload pop
+            } if
+            1
+        ] putinterval
+    } for
+
+    % Return the arguments
+    <<
+    /ren //renmatrix
+    /pixs pixs
+    /pixx rwid
+    /pixy r
+    /height r 72 div rowmult mul
+    /width rwid 72 div
+    /opt options
+    >>
+
+    dontdraw not //renmatrix if
+
+    end
+
+} bind def
+/micropdf417 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER micropdf417--
+
+% --BEGIN ENCODER datamatrix--
+% --DESC: Data Matrix
+% --EXAM: This is Data Matrix!
+% --EXOP: rows=32 columns=32
+% --RNDR: renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/datamatrix {
+
+    20 dict begin
+
+    /options exch def
+    /barcode exch def
+
+    /dontdraw false def
+    /columns 0 def
+    /rows 0 def
+    /encoding (byte) 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
+
+    /columns columns cvi def
+    /rows rows 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
+
+    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 (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
+
+    encoding (ascii) eq {
+        /cws barlen 2 mul array def
+        /i 0 def /j 0 def
+        { % loop
+            i barlen eq {exit} if
+            /char barcode i get def
+            char 48 ge char 57 le and i barlen 1 sub lt and {
+                barcode i 1 add get dup 48 ge exch 57 le and {  % Digit pair
+                    cws j barcode i 2 getinterval cvi 130 add put
+                    /i i 2 add def
+                    /j j 1 add def
+                } {  % Singular digit
+                    cws j char 1 add put
+                    /i i 1 add def
+                    /j j 1 add def
+                } ifelse
+            } { char 127 le {  % ASCII
+                cws j char 1 add put
+                /i i 1 add def
+                /j j 1 add def
+            } {  % Extended ASCII
+                cws j 235 put
+                cws j 1 add char 127 sub put
+                /i i 1 add def
+                /j j 2 add def
+            } ifelse } ifelse
+        } loop
+        /cws cws 0 j getinterval def
+    } if
+
+    encoding (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
     %    rows  cols  regh  regv  rscw  rsbl
@@ -5299,7 +10392,7 @@
 
     % Return the arguments
     <<
-    /ren (renmatrix)
+    /ren //renmatrix
     /pixs pixs
     /pixx cols
     /pixy rows
@@ -5308,21 +10401,28 @@
     /opt options
     >>
 
-    dontdraw not {//renmatrix exec} if
+    dontdraw not //renmatrix if
 
     end
 
 } bind def
+/datamatrix dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER datamatrix--
 
 % --BEGIN ENCODER qrcode--
 % --DESC: QR Code
-% --EXAM: 000100000010000000001100010101100110000110000
-% --EXOP: version=1 eclevel=M
+% --EXAM: http://www.terryburton.co.uk/barcodewriter/
+% --EXOP: eclevel=M
 % --RNDR: renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
 /qrcode {
 
-    1 dict begin
+    20 dict begin
 
     /options exch def
     /barcode exch def
@@ -5330,7 +10430,9 @@
     /dontdraw false def
     /format (full) def     % full or micro
     /version (unset) def
-    /eclevel (L) def       % L, M, Q or H
+    /eclevel (unset) def   % L, M, Q or H
+    /raw false def
+    /parse false def
 
     % Parse the input options
     options type /stringtype eq {
@@ -5343,17 +10445,107 @@
     } if
     options {def} forall
 
+    % 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
+
+    % 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
+
     % Convert from input into message bitstream
-    /msgbits barcode def 
+    raw {
+        /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
+        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 
+                /i i 1 add def
+            } loop
+            /version i 10 2 string cvrs def
+        } 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
+        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
+
+    } ifelse
 
     % Lookup the most appropriate symbol specification
     /metrics [
         % format   vers  size align modules    error codewords        error correction blocks 
         %                                      L    M    Q    H       L1 L2 M1 M2 Q1 Q2 H1 H2
-        [ (micro)  (M1)   11  98 99     36  [   2   99   99   99 ]  [  1  0 99 99 99 99 99 99 ] ]
-        [ (micro)  (M2)   13  98 99     80  [   5    6   99   99 ]  [  1  0  1  0 99 99 99 99 ] ]
-        [ (micro)  (M3)   15  98 99    132  [   6    8   99   99 ]  [  1  0  1  0 99 99 99 99 ] ]
-        [ (micro)  (M4)   17  98 99    192  [   8   10   14   99 ]  [  1  0  1  0  1  0 99 99 ] ]
+        [ (micro)  (M1)   11  98 99     36  [   2   99   99   99 ]  [  1  0 -1 -1 -1 -1 -1 -1 ] ]
+        [ (micro)  (M2)   13  98 99     80  [   5    6   99   99 ]  [  1  0  1  0 -1 -1 -1 -1 ] ]
+        [ (micro)  (M3)   15  98 99    132  [   6    8   99   99 ]  [  1  0  1  0 -1 -1 -1 -1 ] ]
+        [ (micro)  (M4)   17  98 99    192  [   8   10   14   99 ]  [  1  0  1  0  1  0 -1 -1 ] ]
         [ (full)   (1)    21  98 99    208  [   7   10   13   17 ]  [  1  0  1  0  1  0  1  0 ] ]
         [ (full)   (2)    25  18 99    359  [  10   16   22   28 ]  [  1  0  1  0  1  0  1  0 ] ]
         [ (full)   (3)    29  22 99    567  [  15   26   36   44 ]  [  1  0  1  0  2  0  2  0 ] ]
@@ -5395,7 +10587,6 @@
         [ (full)   (39)  173  26 54  28256  [ 720 1316 1950 2310 ]  [ 20  4 40  7 43 22 10 67 ] ]
         [ (full)   (40)  177  30 58  29648  [ 750 1372 2040 2430 ]  [ 19  6 18 31 34 34 20 61 ] ]
     ] def
-
     /eclval (LMQH) eclevel search pop length exch pop exch pop def
     /i 0 def
     { % loop
@@ -5419,17 +10610,18 @@
         /dmod dcws 8 mul lc4b {4} {0} ifelse sub def  % Number of data modules
         /ecb1 m 7 get eclval 2 mul get def            % First error correction blocks
         /ecb2 m 7 get eclval 2 mul 1 add get def      % Second error correction blocks
-        /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
         /okay true def
-        version (unset) ne version vers ne and {/okay false def} if
-        version (unset) eq format frmt ne and {/okay false def} if
-        msgbits length dmod gt {/okay false def} if
+        format frmt ne {/okay false def} if           % The format must match that supplied
+        version (unset) ne version vers ne and {/okay false def} if  % The version must match that supplied
+        msgbits length dmod gt {/okay false def} if   % Bitstream must fit into data modules
+        ecb1 -1 eq ecb2 -1 eq or {/okay false def} if % Error correction level must be valid
         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
 
     % Expand the message bits by adding padding as necessary
     /pad dmod string def
@@ -5770,7 +10962,7 @@
         /sym exch def
 
         /n1 0 def /n2 0 def /n3 0 def
-        /rle size array def
+        /rle size 1 add array def
         /lastpairs size array def
         /thispairs size array def
         /sizeadd1 size 1 add def
@@ -5906,7 +11098,7 @@
 
     % Return the arguments
     <<
-    /ren (renmatrix)
+    /ren //renmatrix
     /pixs pixs
     /pixx size
     /pixy size
@@ -5915,28 +11107,36 @@
     /opt options
     >>
 
-    dontdraw not {//renmatrix exec} if
+    dontdraw not //renmatrix if
 
     end
 
 } bind def
+/qrcode dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER qrcode--
 
 % --BEGIN ENCODER maxicode--
 % --DESC: MaxiCode
-% --EXAM: ^059^042^041^059^040^03001^02996152382802^029840^029001^0291Z00004951^029UPSN^02906X610^029159^0291234567^0291^0471^029^029Y^029634 ALPHA DR^029PITTSBURGH^029PA^030^062^004^063
-% --EXOP: mode=2
+% --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
+1 dict
+dup /renmaximatrix dup /uk.co.terryburton.bwipp findresource put
+begin
 /maxicode {
 
-    1 dict begin
+    20 dict begin
 
     /options exch def        % We are given an option string
     /barcode exch def        % We are given a barcode string
 
     /dontdraw false def
-    /mode 4 def
+    /mode -1 def
     /sam -1 def
+    /parse false def
 
     % Parse the input options
     options type /stringtype eq {
@@ -5952,74 +11152,331 @@
     /mode mode cvi def
     /sam sam cvi def
 
-    /txtvals (@ABCDEFGHIJKLMNOPQRSTUVWXYZ@@@@@ @@@@@@@@@@@@@@@0123456789@@@@@@) def
-
-    % Parse a given message into codewords
-    /maxiparse {
-        /txt exch def
-        /out txt length array def
-        /i 0 def /j 0 def
-        { % loop  
-            i txt length eq {exit} if
-            txt i 1 getinterval (^) eq {
-                % Codeword is given by the next three characters
-                /cw txt i 1 add 3 getinterval cvi def
-                /i i 4 add 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
             } {
-                % Codeword is the characters position in txtvals
-                txtvals txt i 1 getinterval search 
-                pop length /cw exch def pop pop
-                /i i 1 add def
-            } ifelse
-            out j cw put
-            /j j 1 add def 
+                dup msg exch j exch putinterval
+                length j add /j exch def
+                /barcode msg 0 j getinterval def
+                exit
+            } ifelse 
         } loop
-        out 0 j getinterval
-    } bind def
-
-    % Calcalate the structured append mode insert
-    /sami () def
-    sam -1 ne {
-        /sami (^033^000) 8 string copy def
-        sam 10 idiv 1 sub 8 mul sam 10 mod 1 sub add 10 2 string cvrs
-        dup length 8 exch sub sami exch 3 -1 roll putinterval 
-    } if
-
-    % Message handling for modes 2 and 3
+    } if
+    
+    /msg barcode def
+    /msglen msg length def
+
+    % Special message handling for modes 2 and 3
     mode 2 eq mode 3 eq or {
 
-        /msg barcode def
-
         % Normalise messages that begin with a field identifier [)>RS01GSyy
-        msg (^059^042^041^059^040^03001^029) search {
-            pop
-            dup length 2 add string /fid exch def
-            fid 0 3 -1 roll putinterval
-            dup fid fid length 2 sub 3 -1 roll 0 2 getinterval putinterval
-            dup length 2 sub 2 exch getinterval /msg exch def
+        msg 0 7 getinterval <5b293e1e30311d> eq {
+            /fid msg 0 9 getinterval def
+            /msg msg 9 msglen 9 sub getinterval def 
         } {
-            pop
             /fid () def
         } ifelse
 
-        % Read the postcode, country code and service code fields
-        msg (^029) search pop /pc exch def
-        pop (^029) search pop /cc exch def
-        pop (^029) search pop /sc exch def
+        % Read the postcode, country code and service code fields seperated by GS
+        msg <1d> search pop /pcode exch def
+        pop <1d> search pop /ccode exch def
+        pop <1d> search pop /scode exch def
         pop /msg exch def
+
+        % Prepend the field identifier
+        msg length fid length add string dup
+        0 fid putinterval dup 
+        fid length msg putinterval
+        /msg exch def
+        /msglen msg length def
+
+    } if
+
+    % Special function characters
+    /eci -1 def  /pad -2 def  /ns -3 def
+    /la  -4 def  /lb  -5 def
+    /sa  -6 def  /sb  -7 def  /sc -8 def  /sd -9 def  /se -10 def
+    /sa2 -11 def /sa3 -12 def  
+    /lkc -13 def /lkd -14 def /lke -15 def
+    /pd2 -16 def /pd3 -17 def 
+    
+    % Character maps for each state
+    /charmaps [
+        %  A    B    C    D    E
+        [  13  (`)  192  224    0 ]  % 0
+        [ (A)  (a)  193  225    1 ]  % 1
+        [ (B)  (b)  194  226    2 ]  % 2
+        [ (C)  (c)  195  227    3 ]  % 3
+        [ (D)  (d)  196  228    4 ]  % 4
+        [ (E)  (e)  197  229    5 ]  % 5
+        [ (F)  (f)  198  230    6 ]  % 6
+        [ (G)  (g)  199  231    7 ]  % 7
+        [ (H)  (h)  200  232    8 ]  % 8
+        [ (I)  (i)  201  233    9 ]  % 9 
+        [ (J)  (j)  202  234   10 ]  % 10
+        [ (K)  (k)  203  235   11 ]  % 11
+        [ (L)  (l)  204  236   12 ]  % 12
+        [ (M)  (m)  205  237   13 ]  % 13
+        [ (N)  (n)  206  238   14 ]  % 14
+        [ (O)  (o)  207  239   15 ]  % 15
+        [ (P)  (p)  208  240   16 ]  % 16
+        [ (Q)  (q)  209  241   17 ]  % 17
+        [ (R)  (r)  210  242   18 ]  % 18
+        [ (S)  (s)  211  243   19 ]  % 19
+        [ (T)  (t)  212  244   20 ]  % 20
+        [ (U)  (u)  213  245   21 ]  % 21
+        [ (V)  (v)  214  246   22 ]  % 22
+        [ (W)  (w)  215  247   23 ]  % 23
+        [ (X)  (x)  216  248   24 ]  % 24
+        [ (Y)  (y)  217  249   25 ]  % 25
+        [ (Z)  (z)  218  250   26 ]  % 26
+        [ eci  eci  eci  eci  eci ]  % 27
+        [  28   28   28   28  pad ]  % 28
+        [  29   29   29   29  pad ]  % 29
+        [  30   30   30   30   27 ]  % 30
+        [  ns   ns   ns   ns   ns ]  % 31
+        [ ( )  ({)  219  251   28 ]  % 32
+        [ pad  pad  220  252   29 ]  % 33
+        [ (")  (})  221  253   30 ]  % 34
+        [ (#)  (~)  222  254   31 ]  % 35
+        [ ($)  127  223  255  159 ]  % 36
+        [ (%)  (;)  170  161  160 ]  % 37
+        [ (&)  (<)  172  168  162 ]  % 38
+        [ (')  (=)  177  171  163 ]  % 39
+        [  40  (>)  178  175  164 ]  % 40
+        [  41  (?)  179  176  165 ]  % 41
+        [ (*)  ([)  181  180  166 ]  % 42
+        [ (+)   92  185  183  167 ]  % 43
+        [ (,)  (])  186  184  169 ]  % 44
+        [ (-)  (^)  188  187  173 ]  % 45
+        [ (.)  (_)  189  191  174 ]  % 46
+        [ (/)  ( )  190  138  182 ]  % 47
+        [ (0)  (,)  128  139  149 ]  % 48
+        [ (1)  (.)  129  140  150 ]  % 49
+        [ (2)  (/)  130  141  151 ]  % 50
+        [ (3)  (:)  131  142  152 ]  % 51
+        [ (4)  (@)  132  143  153 ]  % 52
+        [ (5)  (!)  133  144  154 ]  % 53
+        [ (6)  (|)  134  145  155 ]  % 54
+        [ (7)  pd2  135  146  156 ]  % 55
+        [ (8)  sa2  136  147  157 ]  % 56
+        [ (9)  sa3  137  148  158 ]  % 57
+        [ (:)  pd3   la   la   la ]  % 58
+        [  sb   sa  ( )  ( )  ( ) ]  % 59
+        [  sc   sc  lkc   sc   sc ]  % 60
+        [  sd   sd   sd  lkd   sd ]  % 61
+        [  se   se   se   se  lke ]  % 62
+        [  lb   la   lb   lb   lb ]  % 63
+    ] def 
+    
+    % Invert charmaps to give character to value maps for each state
+    /charvals [ 64 dict 64 dict 64 dict 64 dict 64 dict ] def
+    0 1 charmaps length 1 sub {
+        /i exch def
+        /encs charmaps i get def
+        0 1 4 {
+            /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
+    /setd charvals 3 get def
+    /sete charvals 4 get def
+
+    % Compute numeric runlengths
+    /nseq [ msglen 1 add {0} repeat ] def
+    msglen 1 sub -1 0 {
+        /i exch def
+        msg i get dup 48 ge exch 57 le and {
+            nseq i nseq i 1 add get 1 add put
+        } {
+            nseq i 0 put
+        } ifelse
+    } for
+    /nseq nseq 0 msglen getinterval def
+
+    % Encode the message from ASCII to codewords 
+    /prefixinset {
+        0 {
+            2 copy exch length ge {exit} if 
+            2 copy get 3 index exch known {1 add} {exit} ifelse
+        } loop
+        exch pop exch pop
+    } bind def
+    
+    /enc {
+        exch get out exch j exch put
+        /j j 1 add def
+    } bind def
+
+    /out 144 array def
+    /i 0 def /j 0 def /cset (seta) def
+    { % loop
+        % Exit when no characters remain latching back to A if necessary
+        i msglen eq {
+            cset (seta) ne cset (setb) ne and {
+                la cset load enc
+                /cset (seta) def
+            } if
+            exit
+        } if
+        { % not a loop but common exit point
+    
+            % If 9 numerals available then use NS
+            nseq i get 9 ge {
+                msg i 9 getinterval cvi 4 { dup 63 and exch -6 bitshift } repeat cset load ns get
+                0 2 10 {index} for 6 array astore 7 1 roll 6 {pop} repeat
+                out exch j exch putinterval
+                /i i 9 add def
+                /j j 6 add def
+                exit
+            } if
+    
+            % Read next three characters
+            /char1 msg i get def
+            /char2 i 1 add msglen lt {msg i 1 add get} {-99} ifelse def
+            /char3 i 2 add msglen lt {msg i 2 add get} {-99} ifelse def
+    
+            % If current mode is sufficient then directly encode
+            cset load char1 known { 
+                char1 cset load enc
+                /i i 1 add def
+                exit
+            } if
+    
+            % For switching from A to B
+            cset (seta) eq setb char1 known and {
+                setb char2 known {
+                    lb seta enc
+                    /cset (setb) def
+                } {
+                    sb seta enc
+                    char1 setb enc
+                    /i i 1 add def
+                } ifelse
+                exit
+            } if
+    
+            % For switching from B to A encode according to length of prefix
+            cset (setb) eq seta char1 known and {
+                /p seta msg i 4 msglen i sub 2 copy gt {exch} if pop getinterval prefixinset def
+                p 1 eq {
+                    sa setb enc
+                    char1 seta enc
+                    /i i 1 add def
+                } if
+                p 2 eq {
+                    sa2 setb enc
+                    char1 seta enc
+                    char2 seta enc
+                    /i i 2 add def 
+                } if
+                p 3 eq {
+                    sa3 setb enc
+                    char1 seta enc
+                    char2 seta enc
+                    char3 seta enc
+                    /i i 3 add def 
+                } if
+                p 4 ge {
+                    la setb enc
+                    /cset (seta) def
+                } if
+                exit
+            } if
+    
+            % If character is in A or B then directly latch
+            seta char1 known {
+                la cset load enc
+                /cset (seta) def
+                exit
+            } if      
+            setb char1 known {
+                lb cset load enc
+                /cset (setb) def
+                exit
+            } if      
+     
+            % Determine which one of sets C, D or E the character is in
+            setc char1 known {/setx (setc) def /sx sc def /lkx lkc def} if
+            setd char1 known {/setx (setd) def /sx sd def /lkx lkd def} if
+            sete char1 known {/setx (sete) def /sx se def /lkx lke def} if
+    
+            % Encode according to the length of the prefix
+            /p setx load msg i 4 msglen i sub 2 copy gt {exch} if pop getinterval prefixinset def
+            p 1 eq {
+                sx cset load enc
+                char1 setx load enc
+                /i i 1 add def
+            } if
+            p 2 eq {
+                sx cset load enc
+                char1 setx load enc
+                sx cset load enc
+                char2 setx load enc
+                /i i 2 add def
+            } if
+            p 3 eq {
+                sx cset load enc
+                char1 setx load enc
+                sx cset load enc
+                char2 setx load enc
+                sx cset load enc
+                char3 setx load enc
+                /i i 3 add def
+            } if
+            p 4 ge {
+                sx cset load enc
+                lkx setx load enc
+                /cset setx def 
+            } if
+    
+            exit
+        } loop  % out
+    } loop
+    /encmsg out 0 j getinterval def
+    /padval cset load pad get def 
+
+    % Prefix the encoded message with the structured append insert
+    /sami [] def
+    sam -1 ne {
+        /sami 2 array def
+        sami 0 seta pad get put 
+        sami 1 sam 10 idiv 1 sub 8 mul sam 10 mod 1 sub add put
+    } if
+    /encmsg [ sami aload pop encmsg aload pop ] def
+
+    % Derive the primary and secondary codewords for modes 2 and 3
+    mode 2 eq mode 3 eq or {
 
         % Calculate the fixed-width binary values for the mode, postcode, country code and service
         /mdb (0000) 4 string copy dup mode cvi 2 4 string cvrs dup length 4 exch sub exch putinterval def
-        /ccb (0000000000) 10 string copy dup cc cvi 2 10 string cvrs dup length 10 exch sub exch putinterval def
-        /scb (0000000000) 10 string copy dup sc cvi 2 10 string cvrs dup length 10 exch sub exch putinterval def
+        /ccb (0000000000) 10 string copy dup ccode cvi 2 10 string cvrs dup length 10 exch sub exch putinterval def
+        /scb (0000000000) 10 string copy dup scode cvi 2 10 string cvrs dup length 10 exch sub exch putinterval def
         /pcb (000000000000000000000000000000000000) 36 string copy def
         mode 2 eq {
             % For numeric postcode, first six bits represent length and remaining 30 bits the value
-            pcb pc length 2 6 string cvrs dup length 6 exch sub exch putinterval
-            pcb pc cvi 2 30 string cvrs dup length 36 exch sub exch putinterval
+            pcb pcode length 2 6 string cvrs dup length 6 exch sub exch putinterval
+            pcb pcode cvi 2 30 string cvrs dup length 36 exch sub exch putinterval
         } {  % mode=3
             % For alphanumeric postcode, trim or pad with spaces to 6 chars and encode to binary
-            /pccw (      ) 6 string copy dup 0 pc length 6 gt {pc 0 6 getinterval} {pc} ifelse putinterval maxiparse def
+            /pccw [ 
+                (      ) 6 string copy dup 0 pcode length 6 gt {pcode 0 6 getinterval} {pcode} ifelse putinterval 
+                {seta exch get} forall
+            ] def
             0 1 5 {
                 /i exch def
                 pcb pccw i get 2 6 string cvrs dup length 6 i mul 6 add exch sub exch putinterval
@@ -6051,24 +11508,24 @@
             pri ps pri ps get ep add put
         } for
 
-        % Encode the secondary parts, including any SAM insert and field identifier
-        /sec [ 84 {33} repeat ] def
-        sec 0 [ sami maxiparse {} forall fid maxiparse {} forall msg maxiparse {} forall ] putinterval
-
-    } if
-
-    % Message handling for modes 4, 5 and 6
-    mode 4 eq mode 5 eq or mode 6 eq or {
-
-        % Prefix the message with the structured append insert
-        /msg sami length barcode length add string def
-        msg 0 sami putinterval
-        msg sami length barcode putinterval
+        % Pad the encoded message into the secondary component
+        /sec [ 84 {padval} repeat ] def
+        sec 0 encmsg putinterval
+
+    } if
+
+    % Derive the primary and secondary codewords for modes 4, 5 and 6
+    mode 4 eq mode 5 eq or mode 6 eq or mode -1 eq or {
+
+        % If mode isn't specified then use EEC if message fits, otherwise SEC
+        mode -1 eq {
+            /mode encmsg length 77 le {5} {4} ifelse def
+        } if
 
         % First symbol is the mode and the remainder are the padded message
-        /cws [ mode 5 eq {78} {94} ifelse {33} repeat ] def
+        /cws [ mode 5 eq {78} {94} ifelse {padval} repeat ] def
         cws 0 mode put
-        cws 1 msg maxiparse putinterval
+        cws 1 encmsg putinterval
 
         % Fit the message into the primary and secondary components
         /pri cws 0 10 getinterval def
@@ -6226,26 +11683,33 @@
 
     % Return the arguments
     <<
-    /ren (renmaximatrix)
+    /ren //renmaximatrix
     /pixs pixs
     /opt options
     >>
 
-    dontdraw not {//renmaximatrix exec} if
+    dontdraw not //renmaximatrix if
 
     end
 
 } bind def
+/maxicode dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER maxicode--
 
 % --BEGIN ENCODER azteccode--
 % --DESC: Aztec Code
-% --EXAM: 00100111001000000101001101111000010100111100101000000110
-% --EXOP: format=compact
+% --EXAM: This is Aztec Code
+% --EXOP: format=full
 % --RNDR: renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
 /azteccode {
 
-    1 dict begin
+    20 dict begin
 
     /options exch def
     /barcode exch def
@@ -6256,6 +11720,8 @@
     /layers -1 def
     /eclevel 23 def
     /ecaddchars 3 def
+    /raw false def
+    /parse false def
 
     % Parse the input options
     options type /stringtype eq {
@@ -6271,11 +11737,58 @@
     /layers layers cvi def
     /eclevel eclevel cvr def
     /ecaddchars ecaddchars 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
+
     % Convert from input into message bitstream
     /msgbits () def 
-    format (rune) ne {/msgbits barcode def} if 
-   
+    format (rune) ne raw and {/msgbits barcode def} if 
+    format (rune) ne raw not and {  % Simple autoencoder from input to bitstream using byte mode only
+
+        % Determine the character count
+        /barlen barcode length def
+        barlen 31 le {
+            (00000) 5 string copy dup barlen 2 5 string cvrs
+            dup length 5 exch sub exch putinterval
+            /cc exch def
+        } {
+            (0000000000000000) 16 string copy dup barlen 31 sub 2 16 string cvrs
+            dup length 16 exch sub exch putinterval
+            /cc exch def
+        } ifelse
+        /cclen cc length def
+
+        % Create the bitstream as byte_mode_id character_count data_bytes
+        /msgbits 5 cclen add barlen 8 mul add string def
+        msgbits 0 (11111) putinterval
+        msgbits 5 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 5 cclen add i 8 mul add 3 -1 roll putinterval
+        } for
+
+    } if
+
     % Lookup the most appropriate symbol specification 
     /metrics [
         [ (rune)     0 0    0  6 ]  % Special metric for rune symbols
@@ -6580,7 +12093,7 @@
     } for
 
     <<
-    /ren (renmatrix)
+    /ren //renmatrix
     /pixs pixs
     /pixx size
     /pixy size
@@ -6589,11 +12102,1181 @@
     /opt options
     >>
 
-    dontdraw not {//renmatrix exec} if
+    dontdraw not //renmatrix if
 
     end
 
 } bind def
+/azteccode dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
 % --END ENCODER azteccode--
 
+% --BEGIN ENCODER gs1-cc--
+% --REQUIRES micropdf417 pdf417--
+% --DESC: GS1 Composite 2D Component
+% --EXAM: (01)95012345678903(3103)000123
+% --EXOP: ccversion=b cccolumns=4
+% --RNDR: renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+dup /pdf417 dup /uk.co.terryburton.bwipp findresource put
+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
+    /linwidth -1 def
+ 
+    % Parse the input options
+    options type /stringtype eq {
+        1 dict begin
+        options {
+            token false eq {exit} if dup length string cvs (=) search
+            true eq {cvlit exch pop exch def} {cvlit true def} ifelse
+        } loop
+        currentdict end /options exch def
+    } if
+    options {def} forall
+ 
+    /height height cvr def
+    /cccolumns cccolumns cvi def
+    /linwidth linwidth cvi def
+
+    % Select columns based on linear type
+    cccolumns -1 eq {
+        <<
+            /ean13                  4
+            /upca                   4
+            /ean8                   3
+            /upce                   2
+            /gs1-128                4
+            /databaromni            4
+            /databarstacked         2
+            /databarstackedomni     2
+            /databarlimited         3
+            /databarexpanded        4
+            /databarexpandedstacked 4
+        >> lintype get /cccolumns exch def 
+    } if
+
+    % 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
+    
+    % Method selection
+    /isupper {dup 65 ge exch 90 le and} bind def  % A-Z
+    /isnum0  {dup 48 ge exch 57 le and} bind def  % 0-9
+    /isnum1  {dup 49 ge exch 57 le and} bind def  % 1-9
+    {  % common exit
+    
+        % (10/11/17)...
+        ais length 1 ge {
+            ais 0 get (10) eq ais 0 get (11) eq or ais 0 get (17) eq or {
+                -1 (10) exit
+            } if
+        } if
+
+        % (90){0-3 digits not starting 0}{upper alpha}...
+        ais length 1 ge {
+            ais 0 get (90) eq {
+                /v aival (90) get def
+                v length 1 ge {
+                   v 0 get isupper {
+                       0 (11) exit
+                   } if
+                } if
+                v length 2 ge {
+                   v 0 get isnum1
+                   v 1 get isupper and {
+                       1 (11) exit
+                   } if
+                } if
+                v length 3 ge {
+                    v 0 get isnum1
+                    v 1 get isnum0 and
+                    v 2 get isupper and {
+                        2 (11) exit
+                    } if
+                } if
+                v length 4 ge {
+                    v 0 get isnum1
+                    v 1 get isnum0 and
+                    v 2 get isnum0 and
+                    v 3 get isupper and {
+                        3 (11) exit
+                    } if
+                } if
+            } if
+        } if
+
+        % Freeform
+        -1 (0) exit
+    
+    } loop
+    /method exch def
+    /npre exch def
+
+    /fnc1 -1 def /lnumeric -2 def /lalphanumeric -3 def /liso646 -4 def
+
+    /tobin {
+        string dup length 1 sub 0 exch 1 exch {1 index exch 48 put} for
+        dup 3 -1 roll 2 2 index length string cvrs dup length 2 index length exch sub exch putinterval 
+    } bind def
+ 
+    /alpha <<
+        65 1 90 {dup 65 sub 5 tobin} for
+        48 1 57 {dup 4 add 6 tobin} for
+        fnc1 (11111)
+    >> def
+
+    /numeric <<
+        0 1 119 {
+            dup (00) 2 string copy dup 3 -1 roll 11 2 string cvrs
+            dup length 2 exch sub exch putinterval 
+            dup 0 get 65 eq {dup 0 94 put} if 
+            dup 1 get 65 eq {dup 1 94 put} if 
+            exch 8 add
+            (0000000) 7 string copy dup 3 -1 roll 2 7 string cvrs 
+            dup length 7 exch sub exch putinterval
+        } for
+        lalphanumeric (0000)
+    >> def
+ 
+    /alphanumeric <<
+        48 1 57 {dup 43 sub 5 tobin} for
+        fnc1 (01111)
+        65 1 90 {dup 33 sub 6 tobin} for
+        42 (111010)
+        44 1 47 {dup 15 add 6 tobin} for
+        lnumeric (000)
+        liso646 (00100)
+    >> def
+    
+    /iso646 <<
+        48 1 57 {dup 43 sub 5 tobin} for
+        fnc1 (01111)
+        65 1 90 {dup 1 sub 7 tobin} for
+        97 1 122 {dup 7 sub 7 tobin} for
+        33 (11101000)
+        34 (11101001)
+        37 1 47 {dup 197 add 8 tobin} for
+        58 1 63 {dup 187 add 8 tobin} for
+        95 (11111011)
+        32 (11111100)
+        lnumeric (000)
+        lalphanumeric (00100)
+    >> def
+
+    method (10) eq {
+        ais 0 get (11) eq ais 0 get (17) eq or {
+            aival ais 0 get get
+            dup 0 2 getinterval cvi 384 mul exch
+            dup 2 2 getinterval cvi 1 sub 32 mul exch
+            4 2 getinterval cvi add add 
+            (0000000000000000) 16 string copy dup 3 -1 roll 2 16 string cvrs
+            dup length 16 exch sub exch putinterval
+            [ 1 0
+              4 -1 roll {48 sub} forall
+              ais 0 get (11) eq {0} {1} ifelse
+            ] /cdf exch def
+            /ais ais 1 ais length 1 sub getinterval def
+        } {
+            /cdf [ 1 0  1 1 ] def
+        } ifelse
+        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 ais 1 ais length 1 sub getinterval def
+            } {
+                /gpf [fnc1] def
+            } ifelse
+        } {
+            /gpf [fnc1] def
+        } ifelse
+        /mode (numeric) def
+    } if
+
+    method (11) eq {
+        /cdf [ 1 1 ] def
+        /ai90 aival (90) get def
+        npre 1 add ai90 length ne {
+            ai90 npre 1 add ai90 length npre sub 1 sub getinterval
+        } {
+            ()
+        } ifelse
+        /ai90rem exch def
+        /nalpha 0 ai90rem {dup 65 ge exch 90 le and {1 add} if} forall def
+        /nnums  0 ai90rem {dup 48 ge exch 57 le and {1 add} if} forall def
+        /mode nalpha nnums gt {(alpha)} {(numeric)} ifelse def
+        nalpha nnums add ai90rem length ne {/mode (alphanumeric) def} if
+        /cdf [
+            cdf aload pop
+            mode (alphanumeric) eq {0} if   
+            mode (numeric) eq {1 0} if   
+            mode (alpha) eq {1 1} if   
+        ] def
+        /ais1 ais length 1 gt {ais 1 get} {-1} ifelse def
+        ais1 (21) eq ais1 (8004) eq or { 
+            /cdf [ cdf aload pop ais1 (21) eq {1 0} {1 1} ifelse ] def
+        } {
+            /cdf [ cdf aload pop 0 ] def
+        } ifelse
+        /nval npre 0 ne {ai90 0 npre getinterval cvi} {0} ifelse def
+        (BDHIJKLNPQRSTVXZ) ai90 npre 1 getinterval search {
+            length exch pop exch pop
+            /aval exch def
+        } {
+            pop /aval -1 def
+        } ifelse 
+        nval 31 lt aval -1 ne and {
+            (00000) 5 string copy dup nval 2 5 string cvrs
+            dup length 5 exch sub exch putinterval
+            [ exch {48 sub} forall ] /nbits exch def
+            (0000) 4 string copy dup aval 2 4 string cvrs
+            dup length 4 exch sub exch putinterval
+            [ exch {48 sub} forall ] /abits exch def
+            /cdf [
+                cdf aload pop 
+                nbits aload pop
+                abits aload pop
+            ] def
+        } {
+            (0000000000) 10 string copy dup nval 2 10 string cvrs
+            dup length 10 exch sub exch putinterval
+            [ exch {48 sub} forall ] /nbits exch def
+            (00000) 5 string copy dup ai90 npre get 65 sub 2 5 string cvrs
+            dup length 5 exch sub exch putinterval
+            [ exch {48 sub} forall ] /abits exch def
+            /cdf [
+                cdf aload pop
+                1 1 1 1 1
+                nbits aload pop
+                abits aload pop
+            ] def
+        } ifelse
+        mode (numeric) eq {
+            /gpf [ ai90rem {} forall ais length 1 gt {fnc1} if ] def
+        } {
+            /encs mode (alpha) eq {alpha} {alphanumeric} ifelse def
+            /in [ ai90rem {} forall ais length 1 gt {fnc1} if ] def
+            /out in length 6 mul array def
+            /j 0 def
+            0 1 in length 1 sub {
+                in exch get encs exch get 
+                dup [ exch {48 sub} forall ] out exch j exch putinterval
+                length j add /j exch def
+            } for
+            /cdf [
+                cdf aload pop 
+                out 0 j getinterval aload pop
+            ] def
+            /gpf [] def
+            ais length 1 gt mode (alpha) ne or {/mode (numeric) def} if
+        } ifelse
+        /ais ais 1 ais length 1 sub getinterval def
+        ais length 0 ne {
+            ais1 (21) eq ais1 (8004) eq or {
+                /gpf [
+                    gpf aload pop
+                    aival ais1 get {} forall
+                ] def
+                /ais ais 1 ais length 1 sub getinterval def
+                ais length 0 ne {/gpf [gpf aload pop fnc1] def} if
+            } if
+        } if
+    } if
+
+    method (0) eq {
+        /cdf [ 0 ] def
+        /gpf [] def
+        /mode (numeric) def
+    } if
+
+    % 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
+
+    % Append the remaining AI data
+    0 1 ais length 1 sub {
+        /i exch def
+        /ai ais i get def
+        /val aival ai get def
+        gpf length ai length add val length add array
+        dup 0 gpf putinterval
+        dup gpf length ai [ exch {} forall ] putinterval
+        dup gpf length ai length add val [ exch {} forall ] putinterval
+        /gpf exch def
+        i ais length 1 sub ne aifixed ai 0 2 getinterval known not and {  % Append FNC1
+            gpf length 1 add array
+            dup 0 gpf putinterval
+            dup gpf length fnc1 put
+            /gpf exch def
+        } if
+    } for
+
+    % Calculate the number of bits remaining to the next valid symbol size
+    /rembits {
+        /used exch def
+        ccversion (c) ne {  % cc-a or cc-b
+            <<
+            /a [
+                [167 138 118 108 88 78 59]
+                [167 138 118  98 78]
+                [197 167 138 108 78]
+            ]
+            /b [
+                [ 336  296 256 208 160 104  56]
+                [ 768  648 536 416 304 208 152 112  72 32]
+                [1184 1016 840 672 496 352 264 208 152 96 56]
+            ]
+            >> ccversion get cccolumns 2 sub get /bitcaps exch def
+            -1 bitcaps {dup used ge {exch} if pop} forall
+            dup -1 ne {used sub} if
+        } {
+            << /c -1 >> ccversion get pop  % Assert cc-c
+            /m used 8 div ceiling cvi dup 6 idiv 5 mul exch 6 mod add def
+            m   40 le               {8 } if
+            m   41 ge m  160 le and {16} if
+            m  161 ge m  320 le and {32} if
+            m  321 ge               {64} if
+            /eccws exch def
+            /m m eccws add 3 add def
+            /c linwidth 62 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
+            used 8296 le {tgt used sub} {-1} ifelse
+        } ifelse
+        dup -1 eq {  % Upgrade CC-A to CC-B or CC-B to CC-C to fit
+            pop
+            ccversion (a) eq {
+                (b)
+            } {
+                ccversion (b) eq lintype (gs1-128) eq and {(c)} {-1} ifelse
+            } ifelse 
+            /ccversion exch def
+            used rembits
+        } if
+    } bind def
+
+    /encode {
+        dup /raw ne {exch get} {pop} ifelse
+        [ exch {48 sub} forall ]
+        dup length exch
+        gpfenc exch j exch putinterval
+        /j exch j add def
+    } bind def
+
+    % Pre-compute alphanumeric and numeric runlengths and position of next ISO646-only characters
+    /numericruns [ gpf length {0} repeat 0 -1 ] def
+    /alphanumericruns [ gpf length {0} repeat 0 ] def
+    /nextiso646only [ gpf length {0} repeat 9999 ] def
+    gpf length 1 sub -1 0 {
+        /i exch def
+        gpf i get
+        (00) 2 string copy
+        dup 0 gpf i get dup fnc1 eq {pop 94} if put 
+        i gpf length 1 sub lt {dup 1 gpf i 1 add get dup fnc1 eq {pop 94} if put} if
+        numeric exch known {
+            numericruns i numericruns i 2 add get 2 add put
+        } {
+            numericruns i 0 put
+        } ifelse
+        dup alphanumeric exch known {
+            alphanumericruns i alphanumericruns i 1 add get 1 add put
+        } {
+            alphanumericruns i 0 put
+        } ifelse
+        dup iso646 exch known exch alphanumeric exch known not and {
+            nextiso646only i 0 put
+        } {
+            nextiso646only i nextiso646only i 1 add get 1 add put
+        } ifelse
+    } for
+   
+    % Encode the general purpose field
+    /gpfenc 8296 array def
+    /i 0 def /j 0 def
+    {  % loop
+        i gpf length eq {exit} if
+        {  % not a loop but common exit point
+    
+            mode (numeric) eq {
+                i gpf length 2 sub le {
+                    2 string 
+                    dup 0 gpf i get dup fnc1 eq {pop 94} if put
+                    dup 1 gpf i 1 add get dup fnc1 eq {pop 94} if put
+                    dup numeric exch known {
+                        numeric encode
+                        /i i 2 add def
+                        exit
+                    } if
+                    pop
+                    lalphanumeric numeric encode 
+                    /mode (alphanumeric) def
+                    exit
+                } {
+                    gpf i get dup 48 lt exch 57 gt or {
+                        lalphanumeric numeric encode
+                        /mode (alphanumeric) def
+                        exit
+                    } if
+                    /rem cdf length j add rembits def
+                    rem 4 ge rem 6 le and {  % C1 + 1 into 4 to 6 bits
+                        (000000) 6 string copy 0 rem getinterval
+                        dup gpf i get 47 sub 2 4 string cvrs
+                        dup length 4 exch sub exch putinterval /raw encode
+                        /i i 1 add def
+                        exit
+                    } {  % C1.FNC1
+                        2 string dup 0 gpf i get put dup 1 94 put numeric encode 
+                        /i i 1 add def
+                        exit
+                    } ifelse
+                } ifelse
+            } if
+    
+            mode (alphanumeric) eq {
+                gpf i get fnc1 eq {
+                    fnc1 alphanumeric encode
+                    /i i 1 add def
+                    exit
+                } if
+                gpf i get dup iso646 exch known exch alphanumeric exch known not and {
+                     liso646 alphanumeric encode
+                     /mode (iso646) def
+                     exit
+                } if
+                numericruns i get 6 ge {
+                    lnumeric alphanumeric encode
+                    /mode (numeric) def
+                    exit
+                } if
+                numericruns i get dup 4 ge exch i add gpf length eq and {
+                    lnumeric alphanumeric encode
+                    /mode (numeric) def
+                    exit
+                } if
+                gpf i get alphanumeric encode
+                /i i 1 add def
+                exit
+            } if
+    
+            mode (iso646) eq {
+                gpf i get fnc1 eq {
+                    fnc1 iso646 encode
+                    /i i 1 add def
+                    exit
+                } if
+                numericruns i get 4 ge nextiso646only i get 10 ge and {
+                    lnumeric iso646 encode
+                    /mode (numeric) def
+                    exit
+                } if
+                alphanumericruns i get 5 ge nextiso646only i get 10 ge and {
+                    lalphanumeric iso646 encode
+                    /mode (alphanumeric) def
+                    exit
+                } if
+                gpf i get iso646 encode
+                /i i 1 add def
+                exit
+            } if
+    
+        } loop
+    } loop
+    /gpf gpfenc 0 j getinterval def
+
+    % Create pad
+    /pad cdf length gpf length add rembits array def
+    pad length 0 gt {
+        0 5 pad length 1 sub {  % Fill with 00100
+            /i exch def
+            pad i [ 0 0 1 0 0 ] 0 pad length i sub 5 2 copy gt {exch} if pop getinterval putinterval 
+        } for 
+        mode (numeric) eq {  % Prefix shift from numeric to ASCII
+            /pad [ 0 0 0 0 pad aload pop ] 0 pad length getinterval def
+        } if
+        mode (alpha) eq {  % Prefix FNC1
+            /pad [ 1 1 1 1 1 pad aload pop ] 0 pad length getinterval def
+        } if
+    } if
+
+    % Concatinate fields
+    /bits [
+        cdf aload pop
+        gpf aload pop
+        pad aload pop
+    ] def
+
+    ccversion (a) eq {
+        /pwr928 [
+            [ 0 0 0 0 0 0 1 ]
+            68 {7 array} repeat
+        ] def
+        1 1 68 {
+            /j exch def
+            /v 0 def
+            6 -1 1 {
+                /i exch def
+                /v pwr928 j 1 sub get i get 2 mul v 928 idiv add def
+                pwr928 j get i v 928 mod put 
+            } for   
+            pwr928 j get 0 pwr928 j 1 sub get 0 get 2 mul v 928 idiv add put
+        } for
+        /cws [ 28 {0} repeat ] def
+        /b 0 def /c 0 def
+        {  % loop
+            b bits length eq {exit} if
+            /bs bits b 69 bits length b sub 2 copy gt {exch} if pop getinterval def
+            /bsl bs length def
+            /cs cws c bsl 10 idiv 1 add getinterval def
+            /csl cs length def
+            0 1 bsl 1 sub {
+                /i exch def
+                0 1 csl 1 sub {
+                    /j exch def
+                    cs j 2 copy get
+                    pwr928 i get j 7 add csl sub get
+                    bs bsl i sub 1 sub get
+                    mul add put
+                } for
+            } for
+            csl 1 sub -1 1 {
+                /i exch def
+                cs i 1 sub 2 copy get cs i get 928 idiv add put
+                cs i 2 copy get 928 mod put
+            } for 
+            /b b bsl add def
+            /c c csl add def
+        } loop
+        /cws cws 0 c getinterval def
+        /barcode cws length 4 mul string def
+        0 1 cws length 1 sub {
+            /i exch def
+            (^   ) 4 string copy dup cws i get 10 4 string cvrs
+            dup length 4 exch sub exch putinterval
+            barcode i 4 mul 3 -1 roll putinterval
+        } for
+        options (dontdraw) true put
+        options (cca) true put
+        options (columns) cccolumns put
+        /args barcode options //micropdf417 exec def
+    } if
+
+    ccversion (b) eq {
+        /barcode bits length 8 idiv string def
+        0 1 barcode length 1 sub {
+            /i exch def
+            bits i 8 mul 8 getinterval 0 exch {add 2 mul} forall 2 idiv
+            barcode exch i exch put
+        } for
+        options (dontdraw) true put
+        options (ccb) true put
+        options (columns) cccolumns put
+        /args barcode options //micropdf417 exec def
+    } if
+
+    ccversion (c) eq {
+        /barcode bits length 8 idiv string def
+        0 1 barcode length 1 sub {
+            /i exch def
+            bits i 8 mul 8 getinterval 0 exch {add 2 mul} forall 2 idiv
+            barcode exch i exch put
+        } for
+        options (dontdraw) true put
+        options (ccc) true put
+        options (columns) cccolumns put
+        /args barcode options //pdf417 exec def
+    } if
+
+    args
+    dontdraw not //renmatrix if
+
+    end
+
+} bind def
+/gs1-cc dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER gs1-cc--
+
+% --BEGIN ENCODER ean13composite--
+% --REQUIRES ean13 micropdf417 pdf417 gs1-cc--
+% --SUGGESTS ean5 ean2--
+% --DESC: EAN-13 Composite
+% --EXAM: 331234567890|(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 /renmatrix dup /uk.co.terryburton.bwipp findresource put
+begin
+/ean13composite {
+
+    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  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
+
+    end
+
+} bind def
+/ean13composite dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER ean13composite--
+
+% --BEGIN ENCODER hibccode39--
+% --REQUIRES code39--
+% --DESC: HIBC Code 39
+% --EXAM: A123BJC5D6E71
+% --EXOP: includetext
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /code39 dup /uk.co.terryburton.bwipp findresource put
+begin
+/hibccode39 {
+
+    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
+    /textfont /Courier def
+    /textsize 10 def
+    /textyoffset -7 def
+    /textxoffset 0 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
+
+    /textfont textfont cvlit def
+    /textsize textsize cvr def
+    /textyoffset textyoffset cvr def
+    /textxoffset textxoffset cvr def
+
+    /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
+
+    /text barlen 4 add string def
+    text 0 42 put
+    text 1 barcode putinterval
+    text barlen 2 add barcode barlen 1 add get dup 32 eq {pop 95} if put
+    text barlen 3 add 42 put
+
+    % Get the result of encoding with code39
+    options (dontdraw) true put
+    options (includecheck) false put
+    /args barcode options //code39 exec def
+
+    args (txt) [ [text textxoffset textyoffset textfont textsize] ] put
+    args (textxalign) (center) put
+    args (opt) options put
+    args
+ 
+    dontdraw not //renlinear if
+
+    end
+
+} bind def
+/hibccode39 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER hibccode39--
+
+% --BEGIN ENCODER hibccode128--
+% --REQUIRES code128--
+% --DESC: HIBC Code 128
+% --EXAM: A123BJC5D6E71
+% --EXOP: includetext
+% --RNDR: renlinear
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renlinear dup /uk.co.terryburton.bwipp findresource put
+dup /code128 dup /uk.co.terryburton.bwipp findresource put
+begin
+/hibccode128 {
+
+    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
+    /textfont /Courier def
+    /textsize 10 def
+    /textyoffset -7 def
+    /textxoffset 0 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
+
+    /textfont textfont cvlit def
+    /textsize textsize cvr def
+    /textyoffset textyoffset cvr def
+    /textxoffset textxoffset cvr def
+
+    /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
+
+    /text barlen 4 add string def
+    text 0 42 put
+    text 1 barcode putinterval
+    text barlen 2 add barcode barlen 1 add get dup 32 eq {pop 95} if put
+    text barlen 3 add 42 put
+
+    % Get the result of encoding with code128
+    options (dontdraw) true put
+    /args barcode options //code128 exec def
+
+    args (txt) [ [text textxoffset textyoffset textfont textsize] ] put
+    args (textxalign) (center) put
+    args (opt) options put
+    args
+ 
+    dontdraw not //renlinear if
+
+    end
+
+} bind def
+/hibccode128 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER hibccode128--
+
+% --BEGIN ENCODER hibcdatamatrix--
+% --REQUIRES datamatrix--
+% --DESC: HIBC Data Matrix
+% --EXAM: A123BJC5D6E71
+% --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
+/hibcdatamatrix {
+
+    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 datamatrix
+    options (dontdraw) true put
+    /args barcode options //datamatrix exec def
+
+    args (opt) options put
+    args
+ 
+    dontdraw not //renmatrix if
+
+    end
+
+} bind def
+/hibcdatamatrix dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER hibcdatamatrix--
+
+% --BEGIN ENCODER hibcpdf417--
+% --REQUIRES pdf417--
+% --DESC: HIBC PDF417
+% --EXAM: A123BJC5D6E71
+% --EXOP:
+% --RNDR: renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+dup /pdf417 dup /uk.co.terryburton.bwipp findresource put
+begin
+/hibcpdf417 {
+
+    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
+    /columns 2 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
+
+    /columns columns cvi def
+
+    /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 pdf417
+    options (dontdraw) true put
+    options (columns) columns put
+    /args barcode options //pdf417 exec def
+
+    args (opt) options put
+    args
+ 
+    dontdraw not //renmatrix if
+
+    end
+
+} bind def
+/hibcpdf417 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER hibcpdf417--
+
+% --BEGIN ENCODER hibcmicropdf417--
+% --REQUIRES micropdf417--
+% --DESC: HIBC MicroPDF417
+% --EXAM: A123BJC5D6E71
+% --EXOP:
+% --RNDR: renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+dup /micropdf417 dup /uk.co.terryburton.bwipp findresource put
+begin
+/hibcmicropdf417 {
+
+    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
+    /columns 2 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
+
+    /columns columns cvi def
+
+    /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 micropdf417
+    options (dontdraw) true put
+    options (columns) columns put
+    /args barcode options //micropdf417 exec def
+
+    args (opt) options put
+    args
+ 
+    dontdraw not //renmatrix if
+
+    end
+
+} bind def
+/hibcmicropdf417 dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER hibcmicropdf417--
+
+% --BEGIN ENCODER hibcqrcode--
+% --REQUIRES qrcode--
+% --DESC: HIBC QR Code
+% --EXAM: A123BJC5D6E71
+% --EXOP:
+% --RNDR: renmatrix
+/setpacking where {pop currentpacking true setpacking} if
+1 dict
+dup /renmatrix dup /uk.co.terryburton.bwipp findresource put
+dup /qrcode dup /uk.co.terryburton.bwipp findresource put
+begin
+/hibcqrcode {
+
+    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 qrcode
+    options (dontdraw) true put
+    /args barcode options //qrcode exec def
+
+    args (opt) options put
+    args
+ 
+    dontdraw not //renmatrix if
+
+    end
+
+} bind def
+/hibcqrcode dup load /uk.co.terryburton.bwipp defineresource pop
+end
+/setpacking where {pop setpacking} if
+% --END ENCODER hibcqrcode--
+
 % --END TEMPLATE--

Modified: branches/ScribusOIF/scribus/plugins/barcodegenerator/barcodegenerator.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16257&path=/branches/ScribusOIF/scribus/plugins/barcodegenerator/barcodegenerator.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/barcodegenerator/barcodegenerator.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/barcodegenerator/barcodegenerator.cpp Sat Jan 15 16:45:22 2011
@@ -330,7 +330,7 @@
 		opts += " includecheckintext";
 	if (ui.includeCheck->isChecked() & ui.includeCheck->isEnabled())
 		opts += " includecheck";
-	QString comm("15 10 moveto (%1) (%2) %3");
+	QString comm("15 10 moveto (%1) (%2) /%3 /uk.co.terryburton.bwipp findresource exec");
 	comm = comm.arg(ui.codeEdit->text()).arg(opts).arg(map[ui.bcCombo->currentText()].command);
 	comm = psCommand + comm;
 	QFile f(psFile);

Modified: branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16257&path=/branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Sat Jan 15 16:45:22 2011
@@ -3400,7 +3400,7 @@
 	currItem->setStartArrowScale(attrs.valueAsInt("startArrowScale", 100));
 	currItem->setEndArrowScale(attrs.valueAsInt("endArrowScale", 100));
 	currItem->NamedLStyle = attrs.valueAsString("NAMEDLST", "");
-	currItem->isBookmark  = attrs.valueAsInt("BOOKMARK");
+	currItem->isBookmark  = attrs.valueAsInt("BOOKMARK", 0);
 	if ((currItem->isBookmark) && (doc->BookMarks.count() == 0))
 		doc->OldBM = true;
 	currItem->setImageFlippedH( attrs.valueAsInt("FLIPPEDH", 0));
@@ -3409,8 +3409,8 @@
 	currItem->ClipEdited = attrs.valueAsInt("CLIPEDIT", 0);
 	currItem->setFillColor(Pcolor);
 	currItem->setLineColor(Pcolor2);
-	currItem->setFillShade(attrs.valueAsInt("SHADE"));
-	currItem->setLineShade(attrs.valueAsInt("SHADE2"));
+	currItem->setFillShade(attrs.valueAsInt("SHADE", 100));
+	currItem->setLineShade(attrs.valueAsInt("SHADE2", 100));
 
 	ParagraphStyle pstyle;
 	if (attrs.hasAttribute("LINESP"))
@@ -3485,7 +3485,7 @@
 			currItem->itemText.setDefaultStyle(defStyle);
 		}
 	}
-	currItem->setRotation( attrs.valueAsDouble("ROT") );
+	currItem->setRotation( attrs.valueAsDouble("ROT", 0.0) );
 	currItem->setTextToFrameDist(attrs.valueAsDouble("EXTRA", 1.0),
 								attrs.valueAsDouble("REXTRA", 1.0),
 								attrs.valueAsDouble("TEXTRA", 1.0),
@@ -3495,7 +3495,7 @@
 	currItem->PLineArt  = Qt::PenStyle(attrs.valueAsInt("PLINEART", 0));
 	currItem->PLineEnd  = Qt::PenCapStyle(attrs.valueAsInt("PLINEEND", 0));
 	currItem->PLineJoin = Qt::PenJoinStyle(attrs.valueAsInt("PLINEJOIN", 0));
-	currItem->setPrintEnabled( attrs.valueAsInt("PRINTABLE"));
+	currItem->setPrintEnabled( attrs.valueAsInt("PRINTABLE", 1));
 	currItem->setIsAnnotation( attrs.valueAsInt("ANNOTATION", 0));
 	currItem->annotation().setType( attrs.valueAsInt("ANTYPE", 0));
 	QString AnName = attrs.valueAsString("ANNAME","");
@@ -3586,7 +3586,7 @@
 	currItem->textPathFlipped = attrs.valueAsBool("textPathFlipped", false);
 	if ( attrs.hasAttribute("TEXTFLOWMODE") )
 		currItem->setTextFlowMode((PageItem::TextFlowMode) attrs.valueAsInt("TEXTFLOWMODE", 0));
-	else if ( attrs.valueAsInt("TEXTFLOW") )
+	else if ( attrs.valueAsInt("TEXTFLOW", 0) != 0)
 	{
 		if (attrs.valueAsInt("TEXTFLOW2", 0))
 			currItem->setTextFlowMode(PageItem::TextFlowUsesBoundingBox);
@@ -3597,13 +3597,12 @@
 	}
 	else
 		currItem->setTextFlowMode(PageItem::TextFlowDisabled);
-	currItem->DashOffset = attrs.valueAsDouble("DASHOFF", 0.0);
 	currItem->setReversed(attrs.valueAsBool("REVERS", false));
 	currItem->setLocked (attrs.valueAsBool("LOCK", false));
 	currItem->setSizeLocked(attrs.valueAsBool("LOCKR", false));
-	currItem->setFillTransparency(attrs.valueAsDouble("TransValue", 0.0));
 	currItem->fillRule    = attrs.valueAsBool("fillRule", true);
 	currItem->doOverprint = attrs.valueAsBool("doOverprint", false);
+	currItem->setFillTransparency(attrs.valueAsDouble("TransValue", 0.0));
 	if (attrs.hasAttribute("TransValueS"))
 		currItem->setLineTransparency(attrs.valueAsDouble("TransValueS", 0.0));
 	else
@@ -3632,6 +3631,7 @@
 	}
 	else
 		currItem->DashValues.clear();
+	currItem->DashOffset = attrs.valueAsDouble("DASHOFF", 0.0);
 
 	tmp = "";
 	if (attrs.hasAttribute("NUMPO"))
@@ -3648,7 +3648,10 @@
 		}
 	}
 	else
+	{
 		currItem->PoLine.resize(0);
+		currItem->PoLine.parseSVG(attrs.valueAsString("path"));
+	}
 
 	tmp = "";
 	if (attrs.hasAttribute("NUMCO"))
@@ -3664,6 +3667,8 @@
 			currItem->ContourLine.setPoint(cx, xf, yf);
 		}
 	}
+	else if (attrs.hasAttribute("copath"))
+		currItem->ContourLine.parseSVG(attrs.valueAsString("copath"));
 	else
 		currItem->ContourLine = currItem->PoLine.copy();
 

Modified: branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16257&path=/branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp Sat Jan 15 16:45:22 2011
@@ -490,8 +490,10 @@
 			docu.writeAttribute("RGB",m_Doc->PageColors[itc.key()].nameRGB());
 		else
 			docu.writeAttribute("CMYK",m_Doc->PageColors[itc.key()].nameCMYK());
-		docu.writeAttribute("Spot",static_cast<int>(m_Doc->PageColors[itc.key()].isSpotColor()));
-		docu.writeAttribute("Register",static_cast<int>(m_Doc->PageColors[itc.key()].isRegistrationColor()));
+		if (m_Doc->PageColors[itc.key()].isSpotColor())
+			docu.writeAttribute("Spot",static_cast<int>(m_Doc->PageColors[itc.key()].isSpotColor()));
+		if (m_Doc->PageColors[itc.key()].isRegistrationColor())
+			docu.writeAttribute("Register",static_cast<int>(m_Doc->PageColors[itc.key()].isRegistrationColor()));
 	}
 	
 }
@@ -1421,13 +1423,18 @@
 			docu.writeAttribute("YPOS", item->yPos());
 		}
 		SetItemProps(docu, item, baseDir, true);
-		docu.writeAttribute("OnMasterPage", item->OnMasterPage);
-		docu.writeAttribute("ImageClip", item->pixm.imgInfo.usedPath);
-		docu.writeAttribute("ImageRes", item->pixm.imgInfo.lowResType);
-		docu.writeAttribute("Pagenumber", item->pixm.imgInfo.actualPageNumber);
-		docu.writeAttribute("isInline", static_cast<int>(item->isEmbedded));
-		docu.writeAttribute("fillRule", static_cast<int>(item->fillRule));
-		docu.writeAttribute("doOverprint", static_cast<int>(item->doOverprint));
+		if (!item->OnMasterPage.isEmpty())
+			docu.writeAttribute("OnMasterPage", item->OnMasterPage);
+		if (!item->pixm.imgInfo.usedPath.isEmpty())
+			docu.writeAttribute("ImageClip", item->pixm.imgInfo.usedPath);
+		if (item->pixm.imgInfo.lowResType != 1)
+			docu.writeAttribute("ImageRes", item->pixm.imgInfo.lowResType);
+		if (item->isEmbedded)
+			docu.writeAttribute("isInline", 1);
+		if (!item->fillRule)
+			docu.writeAttribute("fillRule", 0);
+		if (item->doOverprint)
+			docu.writeAttribute("doOverprint", 1);
 		docu.writeAttribute("gXpos", item->gXpos);
 		docu.writeAttribute("gYpos", item->gYpos);
 		docu.writeAttribute("gWidth", item->gWidth);
@@ -1535,9 +1542,9 @@
 			docu.writeAttribute("pMirrorYS" , mirrorY);
 			docu.writeAttribute("pAtPathS" , atPath);
 		}
-		docu.writeAttribute("GRTYPM", item->GrMask);
 		if (item->GrMask > 0)
 		{
+			docu.writeAttribute("GRTYPM", item->GrMask);
 			docu.writeAttribute("GRSTARTXM", item->GrMaskStartX);
 			docu.writeAttribute("GRSTARTYM", item->GrMaskStartY);
 			docu.writeAttribute("GRENDXM", item->GrMaskEndX);
@@ -1570,7 +1577,8 @@
 			docu.writeAttribute("ALIGN", item->itemText.defaultStyle().alignment());
 		
 		docu.writeAttribute("LAYER", item->LayerID);
-		docu.writeAttribute("BOOKMARK", item->isBookmark ? 1 : 0);
+		if (item->isBookmark)
+			docu.writeAttribute("BOOKMARK", 1);
 
 		if (item->asTextFrame() || item->asPathText() || item->asImageFrame())
 		{
@@ -1787,33 +1795,48 @@
 
 void Scribus150Format::SetItemProps(ScXmlStreamWriter& docu, PageItem* item, const QString& baseDir, bool newFormat)
 {
-	double xf, yf;
+//	double xf, yf;
 	QString tmp, tmpy;
 	if (newFormat)
 		docu.writeAttribute("OwnPage", item->OwnPage);
 	docu.writeAttribute("PTYPE",item->realItemType());
 	docu.writeAttribute("WIDTH",item->width());
 	docu.writeAttribute("HEIGHT",item->height());
-	docu.writeAttribute("RADRECT",item->cornerRadius());
+	if (item->cornerRadius() != 0)
+		docu.writeAttribute("RADRECT",item->cornerRadius());
 	docu.writeAttribute("FRTYPE", item->FrameType);
 	docu.writeAttribute("CLIPEDIT", item->ClipEdited ? 1 : 0);
-	docu.writeAttribute("GRTYP",item->GrType);
-	docu.writeAttribute("GRTYPS",item->GrTypeStroke);
-	docu.writeAttribute("ROT",item->rotation());
-	docu.writeAttribute("PRINTABLE", item->printEnabled() ? 1 : 0);
-	docu.writeAttribute("FLIPPEDH", item->imageFlippedH());
-	docu.writeAttribute("FLIPPEDV", item->imageFlippedV());
+	if (item->GrType != 0)
+		docu.writeAttribute("GRTYP",item->GrType);
+	if (item->GrTypeStroke != 0)
+		docu.writeAttribute("GRTYPS",item->GrTypeStroke);
+	if (item->rotation() != 0)
+		docu.writeAttribute("ROT",item->rotation());
+	if (!item->printEnabled())
+		docu.writeAttribute("PRINTABLE", 0);
+	if (item->imageFlippedH())
+		docu.writeAttribute("FLIPPEDH", 1);
+	if (item->imageFlippedV())
+		docu.writeAttribute("FLIPPEDV", 1);
 	if (!(item->isGroup() || item->isSymbol()))
 	{
 		docu.writeAttribute("PWIDTH",item->lineWidth());
-		docu.writeAttribute("PCOLOR",item->fillColor());
-		docu.writeAttribute("PCOLOR2",item->lineColor());
-		docu.writeAttribute("NAMEDLST",item->NamedLStyle);
-		docu.writeAttribute("SHADE",item->fillShade());
-		docu.writeAttribute("SHADE2",item->lineShade());
-		docu.writeAttribute("PLINEART",item->PLineArt);
-		docu.writeAttribute("PLINEEND", item->PLineEnd);
-		docu.writeAttribute("PLINEJOIN", item->PLineJoin);
+		if (item->fillColor() != CommonStrings::None)
+			docu.writeAttribute("PCOLOR",item->fillColor());
+		if (item->fillShade() != 100)
+			docu.writeAttribute("SHADE",item->fillShade());
+		if (item->lineColor() != CommonStrings::None)
+			docu.writeAttribute("PCOLOR2",item->lineColor());
+		if (item->lineShade() != 100)
+			docu.writeAttribute("SHADE2",item->lineShade());
+		if (!item->NamedLStyle.isEmpty())
+			docu.writeAttribute("NAMEDLST",item->NamedLStyle);
+		if (item->PLineArt != 0)
+			docu.writeAttribute("PLINEART",item->PLineArt);
+		if (item->PLineEnd != 0)
+			docu.writeAttribute("PLINEEND", item->PLineEnd);
+		if (item->PLineJoin != 0)
+			docu.writeAttribute("PLINEJOIN", item->PLineJoin);
 	}
 	if (item->asRegularPolygon())
 	{
@@ -1874,16 +1897,16 @@
 		docu.writeAttribute("ANPLACE", item->annotation().IPlace());
 		docu.writeAttribute("ANSCALE", item->annotation().ScaleW());
 	}
-	else
-		docu.writeAttribute("ANNOTATION",0);
-	docu.writeAttribute("ANNAME", !item->AutoName ? item->itemName() : QString(""));
+	if (!item->AutoName)
+		docu.writeAttribute("ANNAME", item->itemName());
 	// "TEXTFLOWMODE" succeed to "TEXTFLOW" "TEXTFLOW2" and "TEXTFLOW3" attributes
-	docu.writeAttribute("TEXTFLOWMODE", (int) item->textFlowMode() );
+	if (item->textFlowMode() != 0)
+		docu.writeAttribute("TEXTFLOWMODE", (int) item->textFlowMode() );
 	// Set "TEXTFLOW" "TEXTFLOW2" and "TEXTFLOW3" attributes for compatibility
 	// with versions prior to 1.3.4
-	docu.writeAttribute("TEXTFLOW" , item->textFlowAroundObject() ? 1 : 0);
-	docu.writeAttribute("TEXTFLOW2", item->textFlowUsesBoundingBox() ? 1 : 0);
-	docu.writeAttribute("TEXTFLOW3", item->textFlowUsesContourLine() ? 1 : 0);
+//	docu.writeAttribute("TEXTFLOW" , item->textFlowAroundObject() ? 1 : 0);
+//	docu.writeAttribute("TEXTFLOW2", item->textFlowUsesBoundingBox() ? 1 : 0);
+//	docu.writeAttribute("TEXTFLOW3", item->textFlowUsesContourLine() ? 1 : 0);
 	if (item->asTextFrame() || item->asPathText() || item->asImageFrame())
 	{
 		docu.writeAttribute("LOCALSCX",item->imageXScale());
@@ -1974,6 +1997,7 @@
 	if (((item->asImageFrame() && !(item->asLatexFrame())) || (item->asTextFrame())) && (!item->Pfile.isEmpty()))
 #endif
 	{
+		docu.writeAttribute("Pagenumber", item->pixm.imgInfo.actualPageNumber);
 		if (item->isInlineImage)
 		{
 			docu.writeAttribute("PFILE", "");
@@ -2013,20 +2037,18 @@
 		}
 	}
 #endif
-	else
-		docu.writeAttribute("PFILE","");
 	if (!item->Pfile2.isEmpty())
 		docu.writeAttribute("PFILE2",Path2Relative(item->Pfile2, baseDir));
-	else
-		docu.writeAttribute("PFILE2","");
 	if (!item->Pfile3.isEmpty())
 		docu.writeAttribute("PFILE3",Path2Relative(item->Pfile3, baseDir));
-	else
-		docu.writeAttribute("PFILE3","");
-	docu.writeAttribute("PRFILE",item->IProfile);
-	docu.writeAttribute("EPROF", item->EmProfile);
-	docu.writeAttribute("IRENDER",item->IRender);
-	docu.writeAttribute("EMBEDDED", item->UseEmbedded ? 1 : 0);
+	if (!item->IProfile.isEmpty())
+		docu.writeAttribute("PRFILE",item->IProfile);
+	if (!item->EmProfile.isEmpty())
+		docu.writeAttribute("EPROF", item->EmProfile);
+	if (item->IRender != 1)
+		docu.writeAttribute("IRENDER",item->IRender);
+	if (!item->UseEmbedded)
+		docu.writeAttribute("EMBEDDED", 0);
 	if (item->asImageFrame())
 	{
 		if (item->OverrideCompressionMethod)
@@ -2034,16 +2056,23 @@
 		if (item->OverrideCompressionQuality)
 			docu.writeAttribute("COMPRESSIONQUALITY", item->CompressionQualityIndex);
 	}
-	docu.writeAttribute("LOCK", item->locked() ? 1 : 0);
-	docu.writeAttribute("LOCKR", item->sizeLocked() ? 1 : 0);
-	docu.writeAttribute("REVERS", item->reversed() ? 1 : 0);
-	docu.writeAttribute("TransValue", item->fillTransparency());
-	docu.writeAttribute("TransValueS", item->lineTransparency());
-	docu.writeAttribute("TransBlend", item->fillBlendmode());
-	docu.writeAttribute("TransBlendS", item->lineBlendmode());
-	docu.writeAttribute("isTableItem", static_cast<int>(item->isTableItem));
+	if (item->locked())
+		docu.writeAttribute("LOCK", 1);
+	if (item->sizeLocked())
+		docu.writeAttribute("LOCKR", 1);
+	if (item->reversed())
+		docu.writeAttribute("REVERS", 1);
+	if (item->fillTransparency() != 0)
+		docu.writeAttribute("TransValue", item->fillTransparency());
+	if (item->lineTransparency() != 0)
+		docu.writeAttribute("TransValueS", item->lineTransparency());
+	if (item->fillBlendmode() != 0)
+		docu.writeAttribute("TransBlend", item->fillBlendmode());
+	if (item->lineBlendmode() != 0)
+		docu.writeAttribute("TransBlendS", item->lineBlendmode());
 	if (item->isTableItem)
 	{
+		docu.writeAttribute("isTableItem", 1);
 		docu.writeAttribute("TopLine", static_cast<int>(item->TopLine));
 		docu.writeAttribute("LeftLine", static_cast<int>(item->LeftLine));
 		docu.writeAttribute("RightLine", static_cast<int>(item->RightLine));
@@ -2071,34 +2100,29 @@
 		docu.writeAttribute("groupWidth", item->groupWidth);
 		docu.writeAttribute("groupHeight", item->groupHeight);
 	}
-	docu.writeAttribute("NUMDASH", static_cast<int>(item->DashValues.count()));
-	QString dlp = "";
-	QVector<double>::Iterator dax;
-	for (dax = item->DashValues.begin(); dax != item->DashValues.end(); ++dax)
-		dlp += tmp.setNum((*dax)) + " ";
-	docu.writeAttribute("DASHS", dlp);
-	docu.writeAttribute("DASHOFF", item->DashOffset);
-	docu.writeAttribute("NUMPO",item->PoLine.size());
-	QString polp = "";
-	for (uint nxx=0; nxx<item->PoLine.size(); ++nxx)
-	{
-		item->PoLine.point(nxx, &xf, &yf);
-		polp += tmp.setNum(xf) + " " + tmpy.setNum(yf) + " ";
-	}
-	docu.writeAttribute("POCOOR", polp);
-	docu.writeAttribute("NUMCO",item->ContourLine.size());
-	QString colp = "";
-	for (uint nxx=0; nxx<item->ContourLine.size(); ++nxx)
-	{
-		item->ContourLine.point(nxx, &xf, &yf);
-		colp += tmp.setNum(xf) + " " + tmpy.setNum(yf) + " ";
-	}
-	docu.writeAttribute("COCOOR", colp);
+	if (item->DashValues.count() != 0)
+	{
+		docu.writeAttribute("NUMDASH", static_cast<int>(item->DashValues.count()));
+		QString dlp = "";
+		QVector<double>::Iterator dax;
+		for (dax = item->DashValues.begin(); dax != item->DashValues.end(); ++dax)
+			dlp += tmp.setNum((*dax)) + " ";
+		docu.writeAttribute("DASHS", dlp);
+		docu.writeAttribute("DASHOFF", item->DashOffset);
+	}
+	docu.writeAttribute("path", item->PoLine.svgPath(!item->isPolyLine()));
+	QString colp = item->ContourLine.svgPath(true);
+	if (!colp.isEmpty())
+		docu.writeAttribute("copath", colp);
 	if (item->asLine() || item->asPolyLine())
 	{
-		docu.writeAttribute("startArrowIndex", item->startArrowIndex());
-		docu.writeAttribute("endArrowIndex", item->endArrowIndex());
-		docu.writeAttribute("startArrowScale", item->startArrowScale());
-		docu.writeAttribute("endArrowScale", item->endArrowScale());
-	}
-}
+		if (item->startArrowIndex() != 0)
+			docu.writeAttribute("startArrowIndex", item->startArrowIndex());
+		if (item->endArrowIndex() != 0)
+			docu.writeAttribute("endArrowIndex", item->endArrowIndex());
+		if (item->startArrowScale() != 100)
+			docu.writeAttribute("startArrowScale", item->startArrowScale());
+		if (item->endArrowScale() != 100)
+			docu.writeAttribute("endArrowScale", item->endArrowScale());
+	}
+}

Modified: branches/ScribusOIF/scribus/plugins/import/ps/importps.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16257&path=/branches/ScribusOIF/scribus/plugins/import/ps/importps.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/import/ps/importps.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/import/ps/importps.cpp Sat Jan 15 16:45:22 2011
@@ -552,6 +552,8 @@
 						ite->setFillTransparency(1.0 - Opacity);
 						ite->setTextFlowMode(PageItem::TextFlowDisabled);
 						m_Doc->AdjustItemSize(ite);
+						if (ite->itemType() == PageItem::Polygon)
+							ite->ContourLine = ite->PoLine.copy();
 						if ((groupStack.count() != 0) && (groupStackP.count() != 0))
 							groupStackP.top().append(ite);
 						Elements.append(ite);
@@ -596,6 +598,8 @@
 						ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
 						ite->setLineTransparency(1.0 - Opacity);
 						m_Doc->AdjustItemSize(ite);
+						if (ite->itemType() == PageItem::Polygon)
+							ite->ContourLine = ite->PoLine.copy();
 						ite->setLineWidth(LineW);
 						ite->setTextFlowMode(PageItem::TextFlowDisabled);
 						if ((groupStack.count() != 0) && (groupStackP.count() != 0))
@@ -628,6 +632,7 @@
 						ite->setWidthHeight(wh.x(),wh.y());
 						ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
 						m_Doc->AdjustItemSize(ite, true);
+						ite->ContourLine = ite->PoLine.copy();
 						ite->setItemName( tr("Group%1").arg(m_Doc->GroupCounter));
 						ite->AutoName = false;
 						ite->setTextFlowMode(PageItem::TextFlowDisabled);
@@ -657,6 +662,7 @@
 							ite->setWidthHeight(wh.x(),wh.y());
 							ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
 							m_Doc->AdjustItemSize(ite, true);
+							ite->ContourLine = ite->PoLine.copy();
 							ite->setItemName( tr("Group%1").arg(m_Doc->GroupCounter));
 							ite->AutoName = false;
 							ite->setTextFlowMode(PageItem::TextFlowDisabled);

Modified: branches/ScribusOIF/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16257&path=/branches/ScribusOIF/scribus/scribus.cpp
==============================================================================
--- branches/ScribusOIF/scribus/scribus.cpp (original)
+++ branches/ScribusOIF/scribus/scribus.cpp Sat Jan 15 16:45:22 2011
@@ -129,7 +129,6 @@
 #include "scribuswin.h"
 #include "selection.h"
 #include "serializer.h"
-#include "stencilreader.h"
 #include "ui/about.h"
 #include "ui/aboutplugins.h"
 #include "ui/aligndistribute.h"

Modified: branches/ScribusOIF/scribus/ui/contextmenu.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16257&path=/branches/ScribusOIF/scribus/ui/contextmenu.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/contextmenu.cpp (original)
+++ branches/ScribusOIF/scribus/ui/contextmenu.cpp Sat Jan 15 16:45:22 2011
@@ -31,7 +31,7 @@
 #include "scribusdoc.h"
 #include "ui/scmwmenumanager.h"
 #include "undomanager.h"
-#include "canvasmode_legacy.h"
+#include "canvasmode_normal.h"
 
 // #include "util.h" //just for tdebug
 

Modified: branches/ScribusOIF/scribus/ui/modetoolbar.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16257&path=/branches/ScribusOIF/scribus/ui/modetoolbar.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/modetoolbar.cpp (original)
+++ branches/ScribusOIF/scribus/ui/modetoolbar.cpp Sat Jan 15 16:45:22 2011
@@ -124,7 +124,7 @@
 
 void ModeToolBar::GetPolyProps()
 {
-	PolygonProps* dia = new PolygonProps(this, m_ScMW->doc->itemToolPrefs().polyCorners, m_ScMW->doc->itemToolPrefs().polyFactor, m_ScMW->doc->itemToolPrefs().polyUseFactor, m_ScMW->doc->itemToolPrefs().polyRotation, m_ScMW->doc->itemToolPrefs().polyCurvature, m_ScMW->doc->itemToolPrefs().polyInnerRot, m_ScMW->doc->itemToolPrefs().polyOuterCurvature);
+	PolygonProps* dia = new PolygonProps(m_ScMW, m_ScMW->doc->itemToolPrefs().polyCorners, m_ScMW->doc->itemToolPrefs().polyFactor, m_ScMW->doc->itemToolPrefs().polyUseFactor, m_ScMW->doc->itemToolPrefs().polyRotation, m_ScMW->doc->itemToolPrefs().polyCurvature, m_ScMW->doc->itemToolPrefs().polyInnerRot, m_ScMW->doc->itemToolPrefs().polyOuterCurvature);
 	if (dia->exec())
 	{
 		dia->getValues(&m_ScMW->doc->itemToolPrefs().polyCorners, &m_ScMW->doc->itemToolPrefs().polyFactor, &m_ScMW->doc->itemToolPrefs().polyUseFactor, &m_ScMW->doc->itemToolPrefs().polyRotation, &m_ScMW->doc->itemToolPrefs().polyCurvature, &m_ScMW->doc->itemToolPrefs().polyInnerRot, &m_ScMW->doc->itemToolPrefs().polyOuterCurvature);

Modified: branches/ScribusOIF/win32/vc8/Scribus.vcproj
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16257&path=/branches/ScribusOIF/win32/vc8/Scribus.vcproj
==============================================================================
--- branches/ScribusOIF/win32/vc8/Scribus.vcproj (original)
+++ branches/ScribusOIF/win32/vc8/Scribus.vcproj Sat Jan 15 16:45:22 2011
@@ -555,10 +555,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\scribus\annotation.cpp"
-				>
-			</File>
-			<File
 				RelativePath="..\..\scribus\ui\applytemplatedialog.cpp"
 				>
 			</File>
@@ -2060,10 +2056,6 @@
 			</File>
 			<File
 				RelativePath="..\..\scribus\ui\splash.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\..\scribus\stencilreader.cpp"
 				>
 			</File>
 			<File
@@ -11188,10 +11180,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\scribus\stencilreader.h"
-				>
-			</File>
-			<File
 				RelativePath="..\..\scribus\ui\storyeditor.h"
 				>
 				<FileConfiguration




More information about the scribus-commit mailing list