Advanced 2D code use cases

Deutsche Post DP Matrix, Data Matrix Industry, rainbow colored QR Code (9.1)

pdToolbox 9.1 comes with a number of extended capabilities that makes it possible to create barcodes and matrix codes for all kinds of industries and use cases. This article illustrates the possible use of the barcode and matrix code creation in pdfToolbox in the form of several interesting examples.

Note: These examples make use of a couple of advanced features that are not feasible with the "Place barcode" fixup, but require use of the more advanced "Place dynamic content" fixup and custom written HTML and JavaScript.

pdfToolbox Library with pre-configured example fixups

Please feel free to download and import the pdfToolbox Library provided below:

After import you will find the examples below in the Fixups area of pdfToolbox.

Example: Deutsche Post DP Matrix code examples

Deutsche Post DP Matrix 2D codes have to follow very strict specification. It is based upon DataMatrix codes, combined with a number of Deutsche Post specific rules.

The example fixup provided creates two variants of such a Deutsche Post DP Matrix code in the upper left of every page of the currently open document.

At the core of custom HTML template is the following code:

		<object class="barcode_object"  type="application/barcode" > 
			<param name="type" value="Data Matrix">
			<param name="data" value="***insert data!***">
			<param name="modulewidth" value="0.423mm">
			<param name="dm_format" value="PostMatrix">
				<!-- **empty string**, UCCEAN, Industry, _Macro05, Reader, PostMatrix -->
			<param name="dm_size" value="22x22">
				<!-- **empty string**, 10x10, 12x12, 14x14, 16x16, 18x18, 
						20x20, 22x22, 24x24, 26x26, 32x32, 36x36, 40x40, 
						44x44, 48x48, 52x52, 64x64, 72x72, 80x80, 88x88, 
						96x96, 104x104, 120x120, 132x132, 144x144, 8x18, 
						8x32, 12x26, 12x36, 16x36, 16x48					-->
			<param name="dm_enforcebinaryencoding" value="false">
				<!-- **false**, true-->
			<param name="dm_rectangular" value="false">
				<!-- **false**, true-->
		</object>

Applying this code with proper CSS styling will put a Deutsche Post DP Matrix code in the upper left corner on the pages of the currently open PDF :

Example: DataMatrix Industry 2D code 16x48

DataMatrix codes come in various flavors specific to the sector where they are used. For certain industry uses a sub-type "Industry" exists, that uses a rectangular form not a square form of DataMatrix codes

The example fixup provided creates one variants of 16x48 cells, and places it in the lower left of every page of the currently open document.

At the core of custom HTML template is the following code:

<object class="barcode_object"  type="application/barcode" > 
	<param name="type" value="Data Matrix">
	<param name="data" value="Actual data"> <!-- <<== Actual data must go here -->
	<param name="modulewidth" value="0.25577mm"> 
	<param name="dm_format" value="Industry">
	<param name="dm_rectangular" value="true">
	<param name="dm_size" value="16x48">
<!-- 		
	<param name="dm_size" value="16x48">
	supported values:
	**empty string**, 10x10, 12x12, 14x14, 16x16, 18x18, 20x20, 22x22, 24x24, 
	26x26, 32x32, 36x36, 40x40, 44x44, 48x48, 52x52, 64x64, 72x72, 80x80, 88x88, 
	96x96, 104x104, 120x120, 132x132, 144x144, 8x18, 8x32, 12x26, 12x36, 16x36, 16x48
-->
</object>

Applying this code with proper CSS styling will put a DataMatrix Industry 2D code 16x48 in the lower left corner on the pages of the currently open PDF:

Example: Rainbow colored QR Code with your name

QR codes have many uses. This example illustrates a concept that won't be acceptable when it comes to maximizing readability of codes in an industrial environment, but can still put to good uses in some creative scenarios. Be prepared though to accept that such codes will not conform to any of the applicable ISO standards. Still they can be scanned surprisingly well with your average smartphone barcode app or any up-to-date 2D code reader.

Note: The technique shown here can also be applied to any other type of barcode and matrix code.

The example fixup provided creates a rainbow color QR code with the name being entered upon executing the fixup.

At the core of custom HTML template is the following code:

<object id="barcode_object"		type="application/barcode" 
		style = "color: #eee;	color: -cchip-cmyk(0,0,0,0.1);
		background-color: pink; 
		background: linear-gradient(135deg, firebrick, red, orange, orange, green, blue, indigo, violet); "  
> 
	<param name="type" value="QR-Code">
	<param name="modulewidth" value="1mm">
	<param name="data" id="id_barcodevalue" value="fill in actual value<param name="swap_foreground_background" value="true">
	<param name="quietzoneleft" value="1">
	<param name="quietzoneright" value="1">
	<param name="quietzonetop" value="1">
	<param name="quietzonebottom" value="1">
	<param name="quietzoneunit" value="X">
</object>