// step 3: we open the document
document.open();
// step 4: we add content to the document
PdfContentByte cb = writer.getDirectContent();
Barcode39 code39 = new Barcode39();
code39.setCode("CODE39-1234567890");
code39.setStartStopText(false);
LwgImage image39 = code39.createImageWithBarcode(cb, null, null);
Barcode39 code39ext = new Barcode39();
code39ext.setCode("The willows.");
code39ext.setStartStopText(false);
code39ext.setExtended(true);
LwgImage image39ext = code39ext.createImageWithBarcode(cb, null, null);
Barcode128 code128 = new Barcode128();
code128.setCode("1Z234786 hello");
LwgImage image128 = code128.createImageWithBarcode(cb, null, null);
BarcodeEAN codeEAN = new BarcodeEAN();
codeEAN.setCodeType(Barcode.EAN13);