C#. PDF-417 Generator Data Encoding Tutorial
sample source code to input valid data and generate 2D PDF-417 images in C# .NET
C# PDF-417 Introduction
PDF-417, also known as Portable Data File 417, PDF 417, PDF417 Truncated, is a stacked linear barcode symbol format used in a variety of applications.
C# PDF-417 barcode provides a comprehensive solution for generating, drawing and rendering PDF-417 barcodes within C#.NET programs. High-quality PDF-417 barcodes can be saved into GIF, PNG, JPEG & BITMAP and supports to be recognized and read by the printer and scanners.
This document explains how to encode PDF-417 valid data in .NET programs using Visual C#.
OnBarcode C# Barcode Generator is designed to generate, create PDF-417 and other linear & 2d barcodes in Microsoft Word.
Here are some more tutorials for C# PDF-417 generation concerning size & image setting.
How to generate, print barcode using .NET, Java sdk library control with example project source code free download:
Encode PDF-417 Valid Character in C#.NET
PDF-417 valid character set:
Standard ASCII Characters: 0-127
Extended ASCII Characters: 128-255
Encode Text Character into PDF-417 Using C#.NET class
It permits all printable ASCII characters to be encoded, including uppercase and lowercase alphabetic, numeric& punctuation; and three ASCII control characters: HT or tab (ASCII value 9), LF or line feed (ASCII value 10), and CR or carriage return (ASCII value 13). The Text mode encodes up to 2 characters per codeword.
PDF417 barcode = new PDF417();
barcode.Data = "OnBarcode";
barcode.DataMode = PDF417DataMode.Text;
barcode.Format = ImageFormat.Png;
barcode.drawBarcode("c:/pdf417.png");
Encode Byte Characters into PDF-417 Using C#.NET class
It permits all 256 possible 8-bit byte values to be encoded (see default: ISO/IEC 8859-1). This includes all ASCII characters value 0 to 127 inclusive and provides for international character set support. The Byte mode enables a sequence of 8-bit bytes to be encoded into a sequence of codewords.
PDF417 barcode = new PDF417();
barcode.Data = "&%#$%&";
barcode.DataMode = PDF417DataMode.Byte;
barcode.Format = ImageFormat.Png;
barcode.drawBarcode("c:/pdf417.png");
Encode Numeric Characters into PDF-417 Using C#.NET class
It permits efficient encoding of numeric data strings. The Numeric mode enables groups of up to 15 codewords represent as many as 44 decimal digits.
PDF417 barcode = new PDF417();
barcode.Data = "12";
barcode.DataMode = PDF417DataMode.Numeric;
barcode.Format = ImageFormat.Png;
barcode.drawBarcode("c:/pdf417.png");
Modify PDF-417 Valid Length in C#.NET
PDF-417 is variable-length 2-dimensional barcodes. The storage capacity, see the table below:
Data Type |
Maximum Data Storage Capacity |
Text Data |
1,850 characters |
Byte Character |
1,108 characters |
Numeric Data |
2,710 characters |
PDF-417 barcode length can be specified by encoding different length of data, for example:
barcode.Data = "123"; // in 3-digit length
barcode.Data = "onbarcode.com"; // in 13-digit length
barcode.Data = "ABCDEFGhijklmnopqrstuvwxyz"; // in 26-digit length