Australia Post 4-State

Australia Post 4-state customer barcode in PHP: format control code, sorting code, code examples and SVG output

A two-digit Format Control Code opens the payload and says what follows it: 11 for a sorting code alone, 59 and 62 for a sorting code with customer information, 00 for the reply paid form, which is only valid with a zero sorting code. Eight digits of sorting code come next, then the customer information the FCC allows.

Capacity is counted in bars. The N table spends 2 bars on a digit and the C table 3 on an alphanumeric character, so FCC 59 holds 8 digits or 5 characters, and FCC 62 holds 15 or 10.

Type Token

ItemValue
Type tokenAUSPOST
Enum caseBarcodeType::AUSPOST
FamilyPostal
StandardAustralia Post Customer Barcode
Class\Com\Tecnick\Barcode\Type\Linear\AustraliaPost

Input

ItemValue
Character setdigits for the FCC and the sorting code; the N or C table for the customer information
Length10 digits, plus customer information up to 16 bars for FCC 59 or 31 bars for FCC 62
CheckReed-Solomon check symbols, computed by the library
Extra parameters1 (see below)

Extra Parameters

Appended to the type token after commas, as in AUSPOST,N.

PositionMeaningValuesDefault
1customer information tableC alphanumeric at 3 bars per character, N numeric at 2 bars per digitC

Examples

FCC 62 with alphanumeric customer information

<?php

require_once __DIR__ . '/vendor/autoload.php';

$barcode = new \Com\Tecnick\Barcode\Barcode();
$bobj = $barcode->getBarcodeObj(
    type: 'AUSPOST',
    code: '6254516251ABC123',
    width: -3,
    height: -30,
    color: 'black',
    padding: [0, 0, 0, 0],
)->setBackgroundColor('white');

echo $bobj->getInlineSvgCode();

Australia Post 4-State barcode encoding 6254516251ABC123

The numeric table, 15 digits of customer information

$bobj = $barcode->getBarcodeObj(
    type: 'AUSPOST,N',
    code: '6262545162123456789012345',
    width: -3,
    height: -30,
    color: 'black',
    padding: [0, 0, 0, 0],
)->setBackgroundColor('white');

Australia Post 4-State barcode encoding 6262545162123456789012345

Errors

These payloads raise \Com\Tecnick\Barcode\Exception:

PayloadMessage
12254516251Unsupported Format Control Code: 12
625451625The code must start with the 2 digit Format Control Code and the 8 digit sorting code
5962545162ABCDEFThe customer information is too long: 18 bars (maximum 16)

See Also