Document Solutions for Excel, Java 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 QRCode.
    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.

    Java
    Copy Code
    // Create a new workbook
    Workbook workbook = new Workbook();
    // Set worksheet layout and data
    IWorksheet worksheet = workbook.getWorksheets().get(0);
    worksheet.getRange("B:C").setColumnWidth(12);
    worksheet.getRange("D:F").setColumnWidth(30);
    worksheet.getRange("4:7").setRowHeight(60);
    worksheet.getRange("A:A").setColumnWidth(5);
    worksheet.getRange("B2").setValue("Data Matrix");
    worksheet.getRange("B2:F2").setMergeCells(true);
    worksheet.getRange("B3:F3").setValue(
            new Object[][] { { "Server", "Data", "Default", "Customer Padding", "Customer Columns Count" } });
    worksheet.getRange("B4:C7").setHorizontalAlignment(HorizontalAlignment.Center);
    worksheet.getRange("B4:C7").setVerticalAlignment(VerticalAlignment.Center);
    worksheet.getRange("B2:F3").setHorizontalAlignment(HorizontalAlignment.Center);
    worksheet.getRange("B2:F3").setVerticalAlignment(VerticalAlignment.Center);
    worksheet.getRange("B4:C7")
            .setValue(new Object[][] { { "Police", "911" }, { "Telephone Directory Assistance", "411" },
                    { "Non-emergency Municipal Services", "311" }, { "Travel Info Call 511", "511" } });
    worksheet.getRange("B4:B7").setWrapText(true);
    worksheet.getPageSetup().setOrientation(PageOrientation.Landscape);
    worksheet.getPageSetup().setPrintGridlines(true);
    // Set formula
    for (int i = 4; i < 8; i++) {
        String value = "CONCAT(B" + i + ",\":\",C" + i + ")";
        worksheet.getRange("D" + i).setFormula("=BC_PDF417" + "(" + value + ")");
        worksheet.getRange("E" + i).setFormula("=BC_PDF417" + "(" + value + ", , , , , , , 0, 10, 5, 5)");
        worksheet.getRange("F" + i).setFormula("=BC_PDF417" + "(" + value + ", , , , , 5)");
    }
    
    // Save to an pdf file
    workbook.save("PDF417.pdf");