mPDF

Barcodes

NB Quiet zones - The barcode object includes space to the right/left or top/bottom only when the specification states a \'quiet zone\' or \'light margin\'. All the examples below also have CSS property set on the barcode object i.e. padding: 1.5mm;

EAN-13 Barcodes (EAN-2 and EAN-5)

NB EAN-13, UPC-A, UPC-E, and EAN-8 may all include an additional bar code(EAN-2 and EAN-5) to the right of the main bar code (see below).

A nominal height and width for these barcodes is defined by the specification. \'size\' will scale both the height and width. Values between 0.8 and 2 are allowed (i.e. 80% to 200% of the nominal size). \'height\' can also be varied as a factor of 1; this is applied after the scaling factor used for \'size\'.

CODE DESCRIPTION BARCODE
EAN13 Standard EAN-13 barcode. Accepts 12 or 13 characters (creating checksum digit if required). [0-9] numeric only.
ISBN Standard EAN-13 barcode with \'ISBN\' number shown above [shown at height="0.66"]
ISSN Standard EAN-13 barcode with \'ISSN\' number shown above [shown at size="0.8"]

EAN-8, UPC-A and UPC-E Barcodes

UPC-A, UPC-E, EAN-13, and EAN-8 may all include an additional bar code(EAN-2 and EAN-5) to the right of the main bar code (see below).

A nominal height and width for these barcodes is defined by the specification. \'size\' will scale both the height and width. Values between 0.8 and 2 are allowed (i.e. 80% to 200% of the nominal size). \'height\' can also be varied as a factor of 1; this is applied after the scaling factor used for \'size\'.

CODE DESCRIPTION BARCODE
UPCA UPC-A barcode. This is a subset of the EAN-13. (098277211236) Accepts 11 or 12 characters (creating checksum digit if required). [0-9] numeric only
UPCE UPC-E barcode. Requires the UPC-A code to be entered as above (e.g. 042100005264 to give 425261). NB mPDF will die with an error message if the code is not valid, as only some UPC-A codes can be converted into valid UPC-E codes. UPC-E doesn\'t have a check digit encoded explicity, rather the check digit is encoded in the parity of the other six characters. The check digit that is encoded is the check digit from the original UPC-A barcode.
EAN8 EAN-8. Accepts 7 or 8 characters (creating checksum digit if required). [0-9] numeric only

EAN-2 and EAN-5 supplements, and combined forms

UPC-A, UPC-E, EAN-13, and EAN-8 may all include an additional bar code(EAN-2 and EAN-5) to the right of the main bar code.

CODE DESCRIPTION BARCODE
EAN2 EAN-2 supplement barcode. mPDF does not generate EAN-5 barcode on its own; see supplements below. Used to denote an issue of a periodical. EAN-2 supplement accepts 2 digits [0-9] only, EAN-5 five.
EAN5 EAN-5 supplement barcode. mPDF does not generate EAN-5 barcode on its own; see supplements below. Usually used in conjunction with EAN-13 for the price of books. 90000 is the code for no price.
EAN13P2 Standard EAN-13 barcode with 2-digit UPC supplement (07)
ISBNP2 Standard EAN-13 barcode with \'ISBN\' number shown above, and 2-digit EAN-2 supplement
ISSNP2 Standard EAN-13 barcode with \'ISSN\' number shown above, and 2-digit EAN-2 supplement
UPCAP2 UPC-A barcode with 2-digit EAN-2 supplement. This is a subset of the EAN-13.
UPCEP2 UPC-E barcode with 2-digit EAN-2 supplement.
EAN8P2 EAN-8 barcode with 2-digit EAN-2 supplement
EAN13P5 Standard EAN-13 barcode with 5-digit UPC supplement (90000)
ISBNP5 Standard EAN-13 barcode with \'ISBN\' number shown above, and 5-digit EAN-5 supplement
ISSNP5 Standard EAN-13 barcode with \'ISSN\' number shown above, and 5-digit EAN-5 supplement
UPCAP5 UPC-A barcode with 5-digit EAN-5 supplement. This is a subset of the EAN-13
UPCEP5 UPC-E barcode with 5-digit EAN-5 supplement. (042100005264 90000)
EAN8P5 EAN-8 barcode with 5-digit EAN-5 supplement (55123457 90000)

Postcode Barcodes

These all have sizes fixed by their specification. Although they can be altered using \'size\' it is not recommended. \'height\' is ignored.

CODE DESCRIPTION BARCODE
IMB Intelligent Mail Barcode - also known as: USPS OneCode 4-State Customer Barcode, OneCode 4CB, USPS 4CB, 4-CB, 4-State Customer Barcode, USPS OneCode Solution Barcode. (01234567094987654321-01234567891) Accepts: Up to 31 digits (required 20-digit Tracking Code, and up to 11-digit Routing Code; this may be 0, 5, 9, or 11 digits). If the Routing code is included, it should be spearated by a hyphen - like this example.
RM4SCC Royal Mail 4-state Customer barcode (SN34RD1A). Accepts: max. 9 characters. Valid characters: [A-Z,0-9] Checksum digit: automatic.
KIX Dutch KIX version of Royal Mail 4-state Customer barcode (SN34RD1A). Valid characters: [A-Z,0-9]. Checksum digit: automatic.
POSTNET POSTNET barcode. Accepts 5, 9 or 11 digits. Valid characters: [0-9]. Checksum digit: automatic.
PLANET PLANET barcode. Accepts 11 or 13 digits. Valid characters: [0-9]. Checksum digit: automatic.

Variable width Barcodes

These barcodes are all of variable length depending on the code entered. There is no recommended maximum size for any of these specs, but all recommend a minimum X-dimension (width of narrowest bar) as 7.5mil (=0.19mm). The default used here is twice the minimum i.e. X-dim = 0.38mm.

The specifications give a minimum height of 15% of the barcode length (which can be variable). The bar height in mPDF is set to a default value of 10mm.

\'size\' will scale the barcode in both dimensions. mPDF will accept any number, but bear in mind that size="0.5" will set the bar width to the minimum. The \'height\' attribute further allows scaling - this factor is applied to already scaled barcode. Thus size="2" height="0.5" will give a barcode twice the default width (X-dim=0.76mm) and at the default height set in mPDF i.e. 10mm.

CODE DESCRIPTION BARCODE
C128A CODE 128 A. Valid characters: [A-Z uppercase and control chars ASCII 0-31]. Checksum digit: automatic.
C128B CODE 128 B. Valid characters: [Upper / Lower Case + All ASCII Printable Characters]. Checksum digit: automatic.
C128C CODE 128 C. Valid characters: [0-9]. Must be an even number of digits. Checksum digit: automatic.
EAN128C [A/B/C] EAN128 (A, B, and C). Specified variant of Code 128, utilising an FNC1 start code. Also known as UCC/EAN-128 or GS1-128. Valid characters: [cf. Code 128]. Checksum digit: automatic.
C39 CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9. Valid characters: [0-9 A-Z \'-\' . Space $/+%]
C39+ CODE 39 + CHECKSUM. Checksum digit: automatic.
C39E CODE 39 EXTENDED. Valid characters: [ASCII-characters between 0..127]
C39E+ CODE 39 EXTENDED + CHECKSUM. Checksum digit: automatic.
S25 Standard 2 of 5. Valid characters: [0-9]
S25+ Standard 2 of 5 + CHECKSUM. Valid characters: [0-9]. Checksum digit: automatic.
I25 Interleaved 2 of 5. Valid characters: [0-9]
I25+ Interleaved 2 of 5 + CHECKSUM. Valid characters: [0-9]. Checksum digit: automatic.
I25B Interleaved 2 of 5 with bearer bars. Valid characters: [0-9]
I25B+ Interleaved 2 of 5 + CHECKSUM with bearer bars. Valid characters: [0-9]. Checksum digit: automatic.
C93 CODE 93 - USS-93 (extended). Valid characters: [ASCII-characters between 0..127]. Checksum digits: automatic.
MSI MSI. Modified Plessey. Valid characters: [0-9]
MSI+ MSI + CHECKSUM (module 11). Checksum digit: automatic.
CODABAR CODABAR. Valid characters: [0-9 \'-\' $:/.+ ABCD] ABCD are used as stop and start characters e.g. A34698735B
CODE11 CODE 11. Valid characters: [0-9 and \'-\']. Checksum digits: 1 (or 2 if length of code is > 10 characters) - automatic.

Useful links

http://www.adams1.com

http://www.tec-it.com/Download/PDF/Barcode_Reference_EN.pdf

http://www.tec-it.com/en/support/knowbase/symbologies/barcode-overview/linear/Default.aspx

http://www.gs1uk.org/downloads/bar_code/Bar%20coding%20getting%20it%20right.pdf

http://web.archive.org/web/19990501035133/http://www.uc-council.org/d36-d.htm (EAN2 and EAN5)

http://www.barcodeisland.com/ean13.phtml (UPC-A)

http://www.idautomation.com/fonts/postnet/#Specifications

http://www.outputlinks.com/sites/AFP/ibm_bcocafaq.pdf

https://ribbs.usps.gov/intelligentmail_mailpieces/documents/tech_guides/USPSIMB_Tech_Resource_Guide.pdf (Intelligent Mail)

http://www.mailsorttechnical.com/downloads_mailsort_user_guide.cfm

http://www.mailsorttechnical.com/docs/mug_jun_2009/MUG_10_2008_Mailsort_700.pdf page 20

Human-readable text

Human-readable text is only produced as part of the barcode object in EAN-13, ISBN, ISSN, EAN-8, UPC-A and UPC-E. Here is an example to add text to a barcode:
<div style="position:fixed; right: 50mm; top: 60mm; border: 0.2mm solid #000000; text-align: center; padding: 0.5mm; padding-top: 2mm;">
<barcode code="00034698735346987355" type="EAN128C" /><br />
<div style="font-family: ocrb;">(00) 0346987 35346987 355</div>
</div>

(00) 0346987 35346987 355
'; //============================================================== //============================================================== include("../mpdf.php"); $mpdf=new mPDF('','','','',20,15,25,25,10,10); $mpdf->WriteHTML($html); $mpdf->Output(); exit; ?>