Document Solutions for Excel, .NET Edition | Document Solutions
Features / Barcodes / PDF417
In This Topic
    PDF417
    In This Topic

    PDF417 barcode is a popular high-density, two-dimensional barcode with symbology that possesses the capability to encode up to 1108 bytes of information. This barcode comprises a stacked set of small barcodes and can encode up to 35 alphanumeric characters and 2,710 numeric characters. It is a stacked linear barcode format which is used in a variety of applications such as transport, identification cards, and inventory management.

    The below image displays PDF417 barcode in a PDF document.

    PDF417

    Formula definition

    You can set PDF417 in a worksheet using the following formula:

    =BC_PDF417(value, color, backgroudColor, errorCorrectionLevel, rows, columns, compact, quietZoneLeft, quietZoneRight, quietZoneTop, quietZoneBottom)

    Parameter

    Name Description
    value A string that represents encode on the symbol of PDF417.
    color A color that represents the barcode color. The default value is 'rgb(0,0,0)'.
    backgroundColor A color that represents the barcode backgroundcolor. The default value is 'rgb(255, 255, 255)'
    errorCorrectionLevel A string that represents the error correction level of PDF417. It has 'auto|0-8' values. The default value is 'auto'.
    rows A value that specifies the number of rows in the symbol. It has 'auto|3-90' values.The default value is 'auto'.
    columns A value that specifies the number of columns in the symbol. It has 'auto|1-30' values. The default value is 'auto'.
    compact Specifies whether it is a compact PDF417. The default value is 'false'.
    quietZoneLeft A value that represents the size of left quiet zone.
    quietZoneRight A value that represents the size of right quiet zone.
    quietZoneTop A value that represents the size of top quiet zone.
    quietZoneBottom A value that represents the size of bottom quiet zone.

    Using Code

    This example code sets PDF417 in the worksheet.

    C#
    Copy Code
    // Create a new workbook
    var workbook = new GrapeCity.Documents.Excel.Workbook();
    
    // Set worksheet layout and data
    IWorksheet worksheet = workbook.Worksheets[0];
    worksheet.Range["B:C"].ColumnWidth = 12;
    worksheet.Range["D:F"].ColumnWidth = 30;
    worksheet.Range["4:7"].RowHeight = 60;
    worksheet.Range["A:A"].ColumnWidth = 5;
    worksheet.Range["B2"].Value = "PDF417";
    worksheet.Range["B2:F2"].Merge(true);
    worksheet.Range["B3:F3"].Value = new object[,]{
        {"Server", "Data", "Defult", "Customer Padding", "Customer Columns Count"}
    };
    worksheet.Range["B4:C7"].HorizontalAlignment = HorizontalAlignment.Center;
    worksheet.Range["B4:C7"].VerticalAlignment = VerticalAlignment.Center;
    worksheet.Range["B2:F3"].HorizontalAlignment = HorizontalAlignment.Center;
    worksheet.Range["B2:F3"].VerticalAlignment = VerticalAlignment.Center;
    worksheet.Range["B4:C7"].Value = new object[,]
      {
        {"Police", "911"},
        {"Telephone Directory Assistance", "411"},
        { "Non-emergency Municipal Services", "311"},
        {"Travel Info Call 511", "511"}
      };
    worksheet.Range["B4:B7"].WrapText = true;
    worksheet.PageSetup.Orientation = PageOrientation.Landscape;
    worksheet.PageSetup.PrintGridlines = true;
    
    // Set formula
    for (var i = 4; i < 8; i++)
    {
       var value = "CONCAT(B" + i + ",\":\",C" + i + ")";
       worksheet.Range["D" + i].Formula = "=BC_PDF417" + "(" + value + ")";
       worksheet.Range["E" + i].Formula = "=BC_PDF417" + "(" + value + ", , , , , , , 0, 10, 5, 5)";
       worksheet.Range["F" + i].Formula = "=BC_PDF417" + "(" + value + ", , , , , 5)";
    }
    
    // Save to a pdf file
    workbook.Save("pdf417.pdf");