When I set codeTextLocation=ABOVE, the resulting image contains the code text and the swiss cross is placed at the center of the whole image rather than the center of only the barcode. The resulting image is attached.
barcode.png (3.1 KB)
The test code is as follows:
@Test
public void testSwissQr() throws IOException
{
SwissQRCodetext swissQRCode = new SwissQRCodetext();
// Bill Details
swissQRCode.getBill().setVersion(QrBillStandardVersion.V2_0);
swissQRCode.getBill().setAccount("CH9300762011623852957");
swissQRCode.getBill().setAmount(12.34);
swissQRCode.getBill().setCurrency("CHF");
swissQRCode.getBill().setReference("reference");
swissQRCode.getBill().setBillInformation("bill information");
swissQRCode.getBill().setUnstructuredMessage("some message");
// Creditor Address
Address creditorAddress = new Address();
creditorAddress.setName("Creditor Name");
creditorAddress.setPostalCode("1234");
creditorAddress.setTown("Creditor Town");
creditorAddress.setCountryCode("CH");
swissQRCode.getBill().setCreditor(creditorAddress);
// Debtor Address
Address debtorAddress = new Address();
debtorAddress.setName("Debtor Name");
debtorAddress.setPostalCode("4321");
debtorAddress.setTown("Debtor Town");
debtorAddress.setCountryCode("CH");
swissQRCode.getBill().setDebtor(debtorAddress);
ComplexBarcodeGenerator swissQRGenerator = new ComplexBarcodeGenerator(swissQRCode);
swissQRGenerator.getParameters().getBarcode().getCodeTextParameters().setLocation(CodeLocation.ABOVE);
BufferedImage barcodeImg = swissQRGenerator.generateBarCodeImage();
File imageFile = new File("barcode.png").getAbsoluteFile();
ImageIO.write(barcodeImg, "png", imageFile);
System.out.println("wrote barcode image: " + imageFile.getAbsolutePath());
}