Example usage for com.itextpdf.kernel.geom PageSize A6

List of usage examples for com.itextpdf.kernel.geom PageSize A6

Introduction

In this page you can find the example usage for com.itextpdf.kernel.geom PageSize A6.

Prototype

PageSize A6

To view the source code for com.itextpdf.kernel.geom PageSize A6.

Click Source Link

Usage

From source file:wbs.jsf1.pdf.LottoReceiptBean0.java

public byte[] createPdfFrom(Lottoschein lottoschein) {
    try {/*w  w w. j  a  va  2 s. co m*/
        zahlen = lottoschein;

        ByteArrayOutputStream pdfStream = new ByteArrayOutputStream();
        PdfWriter writer = new PdfWriter(pdfStream);
        PdfDocument pdf = new PdfDocument(writer);
        PageSize pageSize = new PageSize(PageSize.A6);
        Document document = new Document(pdf, pageSize);
        document.setMargins(20, 20, 40, 20);
        PdfFont font = PdfFontFactory.createFont(FontConstants.HELVETICA);
        PdfFont bold = PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD);
        // Header
        document.add(getHeaderTable());
        // Lottozahlen auflisten
        document.add(getZiehungsDatenTable(font, bold));
        // Losnummer
        document.add(getLosnummerTable(font, bold));
        // Spieltage
        document.add(getSpieltageTable(font, bold));
        // Laufzeit
        document.add(getLaufzeitTable(font, bold));
        // Betrag
        document.add(getBetragTable(font, bold));
        document.close();
        LOG.log(Level.INFO, "PDF succesfully created.");
        return pdfStream.toByteArray();
    } catch (IOException ex) {
        Logger.getLogger(LottoReceiptBean0.class.getName()).log(Level.SEVERE, "pdf creation problem", ex);
    }
    return null;
}