0% found this document useful (0 votes)
179 views14 pages

PDF 417 Barcode

The document provides detailed information about the PDF417 barcode, including its structure, error correction capabilities, data compaction methods, and configurable parameters. It also covers the integration of PDF417 barcode fonts with various applications, including Microsoft Excel, Crystal Reports, and .NET SDKs. Additionally, it includes instructions for using the Font Encoder and sample usage in C# for generating PDF417 barcodes.

Uploaded by

Kadri Ahmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
179 views14 pages

PDF 417 Barcode

The document provides detailed information about the PDF417 barcode, including its structure, error correction capabilities, data compaction methods, and configurable parameters. It also covers the integration of PDF417 barcode fonts with various applications, including Microsoft Excel, Crystal Reports, and .NET SDKs. Additionally, it includes instructions for using the Font Encoder and sample usage in C# for generating PDF417 barcodes.

Uploaded by

Kadri Ahmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

2D Barcode Fonts

PDF417 Barcode

http://barcoderesource.com/pdf417barcode.shtml

Copyright (c) 2009-2022, ConnectCode


All Rights Reserved.
ConnectCode accepts no responsibility for any adverse affect that may result from undertaking our
training.

Microsoft and Microsoft Excel are registered trademarks of Microsoft Corporation. All other product
names are trademarks, registered trademarks, or service marks of their respective owners
Table of Contents

1. PDF417 Barcode .................................................................................................................... 1-1


1.1 PDF417 Barcode........................................................................................................ 1-1
1.2 Error Correction .......................................................................................................... 1-1
1.3 Data Compaction ....................................................................................................... 1-1
1.3.1 Auto Data Compaction .................................................................................. 1-1
1.4 Parameters of the PDF417 Barcode .......................................................................... 1-2
1.4.1 Row Height.................................................................................................... 1-2
1.4.2 Number of Columns ...................................................................................... 1-2
1.4.3 Error Correction Level ................................................................................... 1-2
1.4.4 Truncate ........................................................................................................ 1-3
1.5 PDF417 Barcode Fonts ............................................................................................. 1-3
2. Font Encoder ......................................................................................................................... 2-4
3. .NET Standard SDK ............................................................................................................... 3-5
3.1 .NET Standard PDF417 Library ................................................................................. 3-5
4. .NET SDK ............................................................................................................................... 4-6
4.1 .NET Framework 4.0 Notes ....................................................................................... 4-7
5. Integrating with Crystal Reports ......................................................................................... 5-8
5.1 Tutorial for creating the PDF417 Barcode in Crystal Reports ................................... 5-8
6. Access/Excel VBA Integration ........................................................................................... 6-11
6.1 Importing the VB macros to Access ......................................................................... 6-11
6.1.1 Notes on using the PDF417 Barcode Font in Microsoft Access ................. 6-11
6.2 Importing the VB macros to Excel ............................................................................ 6-11
6.3 VBA Function Description ........................................................................................ 6-12

Pg ii
PDF417 Barcode
1. PDF417 Barcode
1.1 PDF417 Barcode
PDF417 barcode is one of the earliest and most widely used 2-dimensional barcode. It is a stacked
barcode composed of rows of linear barcode. Being a 2-dimensional barcode allows it to carry
more information than the 1-dimensional barcodes.

“PDF” stands for Portable Data File. The “417” derives from the fact that each encoded codeword
in the barcode is represented by four bars and four spaces. The total width of each codeword is
17-module wide and thus the “17” in the name.

1.2 Error Correction


Besides being able to pack more data, the PDF417 barcode provides additional redundancy by
using a correction technique known as the Reed Solomon error correction. This allows the barcode
to be partially damaged without causing any loss of data. Under the industry specifications, a total
of 9 levels of error corrections are supported. The higher the level of error correction, the more
redundancy the barcode has. However, it also means that more areas from the barcode will need
to be used for error correction and resulting in less data to be encoded into the barcode.

1.3 Data Compaction


The PDF417 barcode supports the following compaction mode. Different compaction mode allows
different types of data to be encoded optimally into the barcode.

• Binary - Data Bytes. A maximum of 1.2 bytes per codeword.


• Text - Text Characters e.g. ASCII 32 to ASCII 127. A maximum of 2 characters per
codeword.
• Numbers -Digits from 0..9. A maximum of 2.9 digits per codeword.

1.3.1 Auto Data Compaction


ConnectCode provides automatic compaction based on the above compaction mode according to
the AIMS industry specifications. The algorithm used first scans the data and decides automatically
which compaction mode to use. On top of that, the data can sometimes consist of a combination of
binary data, text and numbers data. In this case, the algorithm will automatically switch between
the different modes to provide the maximum compaction.

Pg 1-1
PDF417 Barcode
1.4 Parameters of the PDF417 Barcode
The following list the different configurable parameters of the PDF417 barcode. If you are new to
this barcode, it is recommended that you use the default or automatic settings mentioned below.

1.4.1 Row Height


The Row Height of the PDF417 Barcode is specified as a multiple over the column width. For
example, "3x" means the row is 3 times the height of the column width. This specification of row
height is according to the industry specifications.

• 3x - This is the default row height supported. It is also the most commonly used row
height.
• 4x - The row height is 4 times the column width.

1.4.2 Number of Columns


A PDF417 barcode will typically expand vertically by adding rows to accommodate more data.
However, the barcode can also be expanded horizontally by expanding the number of columns.
The diagram below shows a PDF417 barcode with 1 column. You probably see 3 columns below,
but it is considered 1 data column.

The PDF417 barcode encoded with the same data but with 2 columns is shown in the diagram
below.

Supported Columns

• 1..30
• Auto - This is the recommended setting if you have not used the PDF417 barcode before.
The ConnectCode PDF417 Barcode will automatically detect the optimal columns according
to industry specifications.

1.4.3 Error Correction Level


The list below shows all the error correction level supported by the PDF417 barcode. A higher error
correction level will mean a more robust barcode that can withstand more damage. However it will
also means that less data can be encoded into the barcode.

• 0 - Support 2 error codewords. This is the minimum Error Correction Level.


• 1 - Support 4 error codewords.
• 2 - Support 8 error codewords.
• 3 - Support 16 error codewords.
• 4 - Support 32 error codewords.
• 5 - Support 64 error codewords.
• 6 - Support 128 error codewords.
• 7 - Support 256 error codewords.
• 8 - Support 512 error codewords. This is the maximum Error Correction Level.
• Auto - This is the recommended settings if you have not used the PDF417 barcode before.
The ConnectCode PDF417 Barcode will automatically detect the optimal Error Level.

Pg 1-2
PDF417 Barcode
1.4.4 Truncate

The right-hand side of the PDF417 barcode can be truncated (removed) without causing any loss
of data. This allows the creation of a barcode that takes up smaller amount of space than a normal
PDF417 barcode. The diagram below shows a Truncated PDF417 Barcode.

1.5 PDF417 Barcode Fonts


The following are the list of barcode fonts used by the PDF417 barcode. Different types of fonts have
been designed for different types of applications. This is to achieve the most optimal scanning
possible.

Reporting Fonts

Font Name Description Recommended Type of


Sizes Applications
CCodePDF417_S3 PDF417 Barcode with a row Crystal Reports,
height of 3x the column Font Size 14..20 other reporting
(CCodePDF417_S3_Trial width. tools and Microsoft
for the Trial version) Word 2000.
CCodePDF417_S4 PDF417 Barcode with a row
height of 4x the column
(CCodePDF417_S4_Trial width.
for the Trial version)

Application Integration Fonts

Font Name Description Recommended Type of


Sizes Applications
CCodePDF417_S3X PDF417 Barcode with a row Wordpad,
height of 3x the column Font Size 2..10 Microsoft Word
(CCodePDF417_S3X_Trial width. 2003 (or onwards)
for the Trial version) (Half point size and Visual Studio
CCodePDF417_S4X PDF417 Barcode with a row such as 2.5 is also .Net Applications
height of 4x the column supported)
(CCodePDF417_S4X_Trial width.
for the Trial version)

Note
1. You may see spaces between multiple Rows when you use the PDF417 barcode fonts in
Microsoft Excel. This is due to the way Microsoft Excel handles multiple lines of text in a
cell. The spaces can be easily removed by copying the resulting output, or barcode, into
Microsoft Word before printing them. Please note that it is not possible to remove the
spaces within Excel. This is a problem inherent in all barcode font products.

2. You may not see your application or tools listed above. It does not means the barcode
fonts cannot be used by your project/product. You can try out the two fonts above and will
most likely be able to find a suitable one. Alternatively, you can contact us for suggestions.

Pg 1-3
PDF417 Barcode
2. Font Encoder
The PDF417 Barcode Font package in ConnectCode comes bundled with a Font Encoder that allows
you to encode the barcode quickly and easily. This is useful if you will like to encode a single
barcode to be pasted into your brochure, packaging or product items. The Encoder supports all the
different parameters as described in the sections above.

The Row Height, Columns, Truncate and Error Level are parameters that have been described in
the previous section and thus will not be described again here.

The Font Name and Font Size in the “Output” section can be changed after the PDF417 barcode is
created. This allows the height and the size of the barcode to be changed after the barcode is
created.

The “Show As Text” option allows you to see the text output of the barcode in a normal text font.
The “Copy Barcode” button allows the barcode to be copied onto the clipboard of Microsoft
Windows. This allows you to paste the barcode onto other applications easily.

Pg 2-4
PDF417 Barcode
3. .NET Standard SDK
.NET Framework is a software framework that is developed by Microsoft to run primarily on
Microsoft Windows. Over the years, the framework has been forked and enhanced to serve many
different purposes. For example, the Universal Windows Platform uses a specific set of APIs from
the .NET Framework to help programmers develop apps for the Windows Store. The .NET Core
Framework also uses a subset of APIs from the .NET Framework to support the development of
applications that can run on different operating systems such as Windows, Mac, and Linux.

.NET Standard is a specification of common APIs that are available on the different .NET
frameworks. By creating a class library (DLL) that targets the .NET Standard, a developer can be
assured that his library can be used or shared by projects developed on the various .NET
frameworks.

As of .NET Standard v2.0, the .Net Standard specification is implemented by the following
frameworks:

• .NET Core
• .NET Framework
• Mono
• Xamarin.iOS
• Xamarin.Android
• Universal Windows Platform
• .NET MAUI
• Windows App SDK

3.1 .NET Standard PDF417 Library

• Resource/NETStandard/netstandard2.0/NETStandardPDF416.dll

The PDF417 Barcode package includes a .NET Standard compliant PDF 417 class library
that targets the .NET Standard 2.0 specification. This library can be used by
projects developed on different .NET frameworks and when used together with ConnectCode
Barcode Fonts, generates barcodes of the highest quality that can meet the strictest
requirements of the auto-id industry.

Pg 3-5
PDF417 Barcode
4. .NET SDK
A .NET Barcode SDK is also bundled in the ConnectCode PDF417 Barcode Font package. This SDK
can be bundled in your applications if you have purchased the necessary distribution licenses.

Library Name

PDF417.dll

Namespace

ConnectCode.BarcodeFonts2D

Class Name

PDF417

Requirements

.NET 2.0 and onwards

Constructors and Functions

PDF417(String data, int rowHeight, int columns, int errorlevel, int truncate);

This is the constructor for the PDF417 barcode. It is used for initializing the PDF417 barcode.

data : The data input string to be encoded as a barcode.


columns : Number of Columns in the PDF417 barcode. 1..30 or 0 for Automatic
errorlevel : The Error Correction Level. 0..8 or -1 for Automatic
truncate : 0 for non truncated PDF417 barcode. 1 for truncated.

String Encode();

This function will encode the barcode based on the parameters specified in the constructor. The
result will be returned as a string.

int LengthExceeded();

The Encode() function might return an empty output string due to invalid inputs or if the length of
the data exceeded the length specified by the PDF417 specifications. A call to this function after
the Encode() function will allow you to determine whether the data length has exceeded.

int GetColumns();

During the creation of the PDF417 barcode, if the number of columns used is “Automatic”, the font
library will automatically determine the optimal columns. This function can be called after the
Encode() function to return the number of columns that is determined by the library.

Pg 4-6
PDF417 Barcode
int GetErrorLevel();

During the creation of the PDF417 barcode, if the error correction level used is “Automatic”, the
font library will automatically determine the optimal error correction level. This function can be
called after the Encode() function to return the error correction level that is determined by the
library.

Sample Usage (C#)

Using ConnectCode.BarcodeFonts2D;
.
.
.
PDF417 barcode = new PDF417("12345678",3,0,-1,0);
String result = barcode.Encode();
Font font = new Font("CCodePDF417_S3", 2);
richTextBox1.Text = outputstr; //private System.Windows.Forms.RichTextBox richTextBox1;
richTextBox1.SelectAll();
richTextBox1.SelectionFont = font;

Sample Visual Studio Project

1. Name - ConnectCode Encoder


2. Solution Name - ConnectCode.sln
3. Language - C#
4. Requirements - .Net 2.0 and onwards, Visual Studio 2005 and onwards.

4.1 .NET Framework 4.0 Notes


.NET Framework 4.0 includes and uses CLR 4.0. It does not automatically use its version of the
common language runtime to run applications that are built with earlier versions of .NET
Framework. This is unlike .Net 2.0-3.5 where the framework uses CLR 2.0 to run applications.
Basically, there is no version 3 of the CLR.

Hence, ConnectCode 2D Barcode SDK provides two sets of .Net DLLs for different versions of the
.Net Framework as shown below:

For .Net 2.0 to 3.5 please use the DLLs and samples in

• /Resource subdirectory
• /.Net Samples subdirectory

For .Net 4.0 please use the DLLs and samples in

• /Net4 subdirectory
• /Net4/.Net Samples subdirectory

Pg 4-7
PDF417 Barcode
5. Integrating with Crystal Reports

5.1 Tutorial for creating the PDF417 Barcode in Crystal Reports

Prerequisites

• Crystal Reports 2008 – Crystal Reports 2020


• ConnectCode PDF417 Barcode Fonts package

1. Launch Crystal Reports and create a blank report.

2. In the Field Explorer, create a new formula by right clicking Formula Field and selecting
New. Give the new formula a name (e.g. pdf417).

Pg 5-8
PDF417 Barcode
3. In Formula Workshop, set the syntax of the formula to 'Basic Syntax'.

4. Copy the formula for the PDF417 barcode from the CR_Formula.txt file (in the
Resource\CrystalReports folder) to the Crystal Report's Formula Editor.

5. Modify the 'data = "12345678' statement so that it connects to your data source. For
example, change the statement to data = { Employee.Name }.

6. Save the formula and drag it to your report to create a formula field. Expand the bounding
box of the field to ensure that there is enough space for the PDF417 barcode.

7. Set the font of the formula field to the “CCodePDF417_S3” and font size to 16.

Pg 5-9
PDF417 Barcode
8. Click on Print Preview to preview the PDF417 barcode.

Pg 5-10
PDF417 Barcode
6. Access/Excel VBA Integration

6.1 Importing the VB macros to Access

1. Launch Microsoft Access

2. Click on the menu Tools->Macro->Visual Basic Editor.

3. Click on the menu File->Import File...

4. Select the Encoder.bas file that is bundled with ConnectCode. This file is located in the
Resource sub directory of where ConnectCode is installed.

5. Click on Save followed by Close in the Visual Basic Editor

6.1.1 Notes on using the PDF417 Barcode Font in Microsoft Access


In Access, the Rich Text property in the textbox object used to display the PDF417 barcode need
to be enabled in order for the barcode to display correctly. To turn on the Rich Text option, please
follow the steps below:

1. In Access, select the textbox for the PDF417 barcode in the Design View.

2. Click on Properties->Data tab.

3. In the Text Format property, select Rich Text.

6.2 Importing the VB macros to Excel

1. Launch Microsoft Excel.

2. Click on the menu Tools->Macro->Visual Basic Editor.

3. Click on the menu File->Import File...

4. Select the Encoder.bas file that is bundled with ConnectCode. This file is located in the
Resource sub directory where ConnectCode is installed.

5. Click on Save followed by Close in the Visual Basic Editor.

Pg 6-11
PDF417 Barcode
6.3 VBA Function Description

Function Name

Encode_PDF417

Description

This function returns the encoded barcode string for the PDF417 barcode. Invalid characters from
the input will be automatically removed.

The font name to use with this barcode is CCodePDF417_S3.

Parameters

Param 1 - String value to be encoded as a barcode.


Param 2 - Number of Columns in the PDF417 barcode. 1..30 or 0 for Automatic.
Param 3 - The Error Correction Level. 0..8 or -1 for Automatic.
Param 3 - 0 for non truncated PDF417 barcode. 1 for truncated.

Important Notes

You may see spaces between multiple Rows when you use the PDF417 barcode fonts in Microsoft
Excel. This is due to the way Microsoft Excel handles multiple lines of text in a cell. The spaces can
be easily removed by copying the resulting output, or barcode, into Microsoft Word before printing
them. Please note that it is not possible to remove the spaces within Excel. This is a problem
inherent in all barcode font products.

Pg 6-12
PDF417 Barcode

You might also like