Search in sources :

Example 1 with BarcodeQRCode

use of com.itextpdf.barcodes.BarcodeQRCode in project betca-tpv-core by miw-upm.

the class PdfCoreBuilder method qrCode.

public PdfCoreBuilder qrCode(String code) {
    BarcodeQRCode barcodeQRCode = new BarcodeQRCode(code.trim());
    Image qcCodeImage = new Image(barcodeQRCode.createFormXObject(this.document.getPdfDocument()));
    qcCodeImage.setHorizontalAlignment(HorizontalAlignment.CENTER);
    qcCodeImage.setWidthPercent(QR_CODE_PERCENT);
    this.document.add(qcCodeImage);
    Paragraph paragraph = new Paragraph(code);
    paragraph.setTextAlignment(TextAlignment.CENTER);
    this.document.add(paragraph);
    return this;
}
Also used : BarcodeQRCode(com.itextpdf.barcodes.BarcodeQRCode) Image(com.itextpdf.layout.element.Image) Paragraph(com.itextpdf.layout.element.Paragraph)

Example 2 with BarcodeQRCode

use of com.itextpdf.barcodes.BarcodeQRCode in project betca-tpv-spring by miw-upm.

the class PdfTicketBuilder method qrCode.

public PdfTicketBuilder qrCode(String code) {
    BarcodeQRCode qrcode = new BarcodeQRCode(code.trim());
    Image qrcodeImage = new Image(qrcode.createFormXObject(this.getDocument().getPdfDocument()));
    qrcodeImage.setHorizontalAlignment(HorizontalAlignment.CENTER);
    qrcodeImage.setWidthPercent(50);
    this.getDocument().add(qrcodeImage);
    Paragraph paragraph = new Paragraph("Ref. " + code);
    paragraph.setTextAlignment(TextAlignment.CENTER);
    this.getDocument().add(paragraph);
    return this;
}
Also used : BarcodeQRCode(com.itextpdf.barcodes.BarcodeQRCode) Image(com.itextpdf.layout.element.Image) Paragraph(com.itextpdf.layout.element.Paragraph)

Aggregations

BarcodeQRCode (com.itextpdf.barcodes.BarcodeQRCode)2 Image (com.itextpdf.layout.element.Image)2 Paragraph (com.itextpdf.layout.element.Paragraph)2