Example usage for com.itextpdf.text Element ALIGN_TOP

List of usage examples for com.itextpdf.text Element ALIGN_TOP

Introduction

In this page you can find the example usage for com.itextpdf.text Element ALIGN_TOP.

Prototype

int ALIGN_TOP

To view the source code for com.itextpdf.text Element ALIGN_TOP.

Click Source Link

Document

A possible value for vertical alignment.

Usage

From source file:pdfMaker.MakePdfFile.java

public void createPdf(String mainTitle, String subTitle, String url, String userName,
        //String scanType,
        String comment,//from   w ww  .ja va2  s  . c o m
        //String thisPassCode,
        String passCodeA, String passCodeB, String fileDir, Boolean noBarCodePrint)
        throws IOException, DocumentException, RuntimeException {
    Document document = null;
    try {
        // step 1
        document = new Document(PageSize.A4, 60, 50, 50, 35);
        // step 2
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(fileDir));
        // step 3
        document.open();
        // step 4
        PdfContentByte cb = writer.getDirectContent();
        /*
         Properties props = new Properties();
         String jarPath = System.getProperty("java.class.path");
         String dirPath = jarPath.substring(0, jarPath.lastIndexOf(File.separator)+1);
         FontFactory.registerDirectory("/res");
         FontFactory.register("ipag.ttf");
         Font ipaGothic = FontFactory.getFont("ipag", BaseFont.IDENTITY_H, 
         BaseFont.EMBEDDED, 10); //10 is the size
                
         InputStream is = getClass().getResourceAsStream("/res/ipag.ttf");
         */

        Properties props = new Properties();
        String jarPath = System.getProperty("java.class.path");
        String dirPath = jarPath.substring(0, jarPath.lastIndexOf(File.separator) + 1);
        System.out.println(jarPath);
        System.out.println(dirPath);
        System.out.println(System.getProperty("user.dir"));

        Font ipaGothic = new Font(BaseFont.createFont(System.getProperty("user.dir") + "\\res\\ipag.ttf",
                BaseFont.IDENTITY_H, BaseFont.EMBEDDED), 11);

        //?(2)
        PdfPTable pdfPTable = new PdfPTable(2);

        pdfPTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
        pdfPTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        pdfPTable.getDefaultCell().setFixedHeight(150);

        pdfPTable.setWidthPercentage(100f);

        int pdfPTableWidth[] = { 10, 90 };
        pdfPTable.setWidths(pdfPTableWidth);

        PdfPCell cell_1_1 = new PdfPCell(new Paragraph("??", ipaGothic));
        cell_1_1.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell_1_1.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell_1_1.setFixedHeight(50);
        PdfPCell cell_1_2 = new PdfPCell(new Paragraph(mainTitle, ipaGothic));
        cell_1_2.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell_1_2.setHorizontalAlignment(Element.ALIGN_CENTER);

        PdfPCell cell_2_1 = new PdfPCell(new Paragraph("", ipaGothic));
        cell_2_1.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell_2_1.setHorizontalAlignment(Element.ALIGN_CENTER);
        PdfPCell cell_2_2 = new PdfPCell(new Paragraph(subTitle, ipaGothic));
        cell_2_2.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell_2_2.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell_2_2.setFixedHeight(50);
        pdfPTable.addCell(cell_1_1);
        pdfPTable.addCell(cell_1_2);
        pdfPTable.addCell(cell_2_1);
        pdfPTable.addCell(cell_2_2);

        PdfPCell cellUrlKey = new PdfPCell(new Paragraph("?", ipaGothic));
        cellUrlKey.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellUrlKey.setHorizontalAlignment(Element.ALIGN_CENTER);
        cellUrlKey.setRowspan(2);
        pdfPTable.addCell(cellUrlKey);

        PdfPCell cellUrlValue = new PdfPCell(new Paragraph(url, ipaGothic));
        cellUrlValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellUrlValue.setHorizontalAlignment(Element.ALIGN_CENTER);
        cellUrlValue.setFixedHeight(50);
        pdfPTable.addCell(cellUrlValue);

        /*  */
        //cellUrlValue.getImage();
        writer.getDirectContent().addImage(cellUrlValue.getImage(), 100, 100, 100, 100, 100, 100);

        if (url.length() != 0 && !noBarCodePrint) {
            /* ?
             BarcodeQRCode qr = new BarcodeQRCode(url, 50, 50, null);
             PdfPCell cellUrlValueQr = new PdfPCell(qr.getImage());
             cellUrlValueQr.setVerticalAlignment(Element.ALIGN_MIDDLE);
             cellUrlValueQr.setHorizontalAlignment(Element.ALIGN_CENTER);
             cellUrlValueQr.setFixedHeight(80);
             pdfPTable.addCell(cellUrlValueQr);
             */
            Image image = ZxingUti.getQRCode(url); //  SHIFT_JIS
            com.itextpdf.text.Image iTextImage = com.itextpdf.text.Image.getInstance(image, null);
            PdfPCell cell = new PdfPCell(iTextImage);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setFixedHeight(100);
            pdfPTable.addCell(cell); //  SIFT_JIS
        } else {
            PdfPCell cellUrlValueQr = new PdfPCell(new Paragraph("", ipaGothic));
            cellUrlValueQr.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cellUrlValueQr.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellUrlValueQr.setFixedHeight(80);
            pdfPTable.addCell(cellUrlValueQr);
        }

        PdfPCell cellUserNameKey = new PdfPCell(new Paragraph("", ipaGothic));
        cellUserNameKey.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellUserNameKey.setHorizontalAlignment(Element.ALIGN_CENTER);
        cellUserNameKey.setRowspan(2);
        pdfPTable.addCell(cellUserNameKey);

        PdfPCell cellUserNameValue = new PdfPCell(new Paragraph(userName, ipaGothic));
        cellUserNameValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellUserNameValue.setHorizontalAlignment(Element.ALIGN_CENTER);
        cellUserNameValue.setFixedHeight(30);
        pdfPTable.addCell(cellUserNameValue);

        if (userName.length() != 0 && !noBarCodePrint) {
            Barcode128 code128 = new Barcode128();
            code128.setCode(userName);
            code128.setFont(ipaGothic.getBaseFont());
            code128.setBarHeight(40f);
            PdfPCell cellUserNameValueBc = new PdfPCell(code128.createImageWithBarcode(cb, null, null));
            cellUserNameValueBc.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cellUserNameValueBc.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellUserNameValueBc.setFixedHeight(80);
            pdfPTable.addCell(cellUserNameValueBc);
        } else {
            PdfPCell cellUserNameValueBc = new PdfPCell(new Paragraph("---", ipaGothic));
            cellUserNameValueBc.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cellUserNameValueBc.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellUserNameValueBc.setFixedHeight(80);
            pdfPTable.addCell(cellUserNameValueBc);
        }

        PdfPCell cellPassCodeKey = new PdfPCell(new Paragraph("?", ipaGothic));
        cellPassCodeKey.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellPassCodeKey.setHorizontalAlignment(Element.ALIGN_CENTER);
        cellPassCodeKey.setRowspan(3);
        pdfPTable.addCell(cellPassCodeKey);

        PdfPCell cellPassCodeValue = new PdfPCell(new Paragraph(passCodeA + passCodeB, ipaGothic));
        cellPassCodeValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellPassCodeValue.setHorizontalAlignment(Element.ALIGN_CENTER);
        cellPassCodeValue.setFixedHeight(30);
        pdfPTable.addCell(cellPassCodeValue);

        if (passCodeA.length() != 0 && !noBarCodePrint) {
            Barcode128 code128 = new Barcode128();
            code128.setCode(passCodeA);
            code128.setFont(ipaGothic.getBaseFont());
            code128.setBarHeight(40f);
            PdfPCell cellPassCodeA_Bc = new PdfPCell(code128.createImageWithBarcode(cb, null, null));
            cellPassCodeA_Bc.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cellPassCodeA_Bc.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellPassCodeA_Bc.setFixedHeight(80);
            pdfPTable.addCell(cellPassCodeA_Bc);
        } else {
            PdfPCell cellPassCodeA_Bc = new PdfPCell(new Paragraph("---", ipaGothic));
            cellPassCodeA_Bc.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cellPassCodeA_Bc.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellPassCodeA_Bc.setFixedHeight(80);
            pdfPTable.addCell(cellPassCodeA_Bc);
        }

        if (passCodeB.length() != 0 && !noBarCodePrint) {
            Barcode128 code128 = new Barcode128();
            code128.setCode(passCodeB);
            code128.setFont(ipaGothic.getBaseFont());
            code128.setBarHeight(40f);
            PdfPCell cellPassCodeB_Bc = new PdfPCell(code128.createImageWithBarcode(cb, null, null));
            cellPassCodeB_Bc.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cellPassCodeB_Bc.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellPassCodeB_Bc.setFixedHeight(80);
            pdfPTable.addCell(cellPassCodeB_Bc);
        } else {
            PdfPCell cellPassCodeB_Bc = new PdfPCell(new Paragraph("---", ipaGothic));
            cellPassCodeB_Bc.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cellPassCodeB_Bc.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellPassCodeB_Bc.setFixedHeight(80);
            pdfPTable.addCell(cellPassCodeB_Bc);
        }

        PdfPCell cellCommentKey = new PdfPCell(new Paragraph("?", ipaGothic));
        cellCommentKey.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellCommentKey.setHorizontalAlignment(Element.ALIGN_CENTER);
        pdfPTable.addCell(cellCommentKey);

        PdfPCell cellCommentValue = new PdfPCell(new Paragraph(comment, ipaGothic));
        cellCommentValue.setVerticalAlignment(Element.ALIGN_TOP);
        cellCommentValue.setHorizontalAlignment(Element.ALIGN_LEFT);
        cellCommentValue.setFixedHeight(150);
        pdfPTable.addCell(cellCommentValue);

        PdfPCell cellIssueKey = new PdfPCell(new Paragraph("", ipaGothic));
        cellIssueKey.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellIssueKey.setHorizontalAlignment(Element.ALIGN_CENTER);
        pdfPTable.addCell(cellIssueKey);

        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm");
        String strDate = sdf.format(cal.getTime());
        PdfPCell cellIssueValue = new PdfPCell(new Paragraph(strDate, ipaGothic));
        cellIssueValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellIssueValue.setHorizontalAlignment(Element.ALIGN_CENTER);
        cellIssueValue.setFixedHeight(20);
        pdfPTable.addCell(cellIssueValue);

        //??
        document.add(pdfPTable);
        /*
                
         // CODE 128
         document.add(new Paragraph("?? : " + mainTitle, ipaGothic));
         document.add(new Paragraph(" : " + subTitle, ipaGothic));
         document.add(new Paragraph("-------------------------------------------------------"));
         document.add(new Paragraph(" " + strDate));
         document.add(new Paragraph("-------------------------------------------------------"));
                
                
         BaseFont bf = BaseFont.createFont(BaseFont.COURIER, BaseFont.WINANSI, BaseFont.EMBEDDED);
         Font font = new Font(bf, 12);
         document.add(new Paragraph("", ipaGothic));
         document.add(new Paragraph(url, ipaGothic));
         code128.setCode(url);
         code128.setFont(bf);
         code128.setX(1);
         //document.add(code128.createImageWithBarcode(cb, null, null));
                
         document.add(new Paragraph("USER", ipaGothic));
         if (userName.length() != 0) {
         document.add(new Paragraph(userName, ipaGothic));
         code128.setCode(userName);
         code128.setFont(bf);
         code128.setBarHeight(40f);
         document.add(code128.createImageWithBarcode(cb, null, null));
         }
                
         document.add(new Paragraph("CODE", ipaGothic));
         if (passCode.length() != 0) {
         document.add(new Paragraph(passCode, ipaGothic));
         code128.setCode(passCode);
         code128.setFont(bf);
         document.add(code128.createImageWithBarcode(cb, null, null));
         }
                
         document.add(new Paragraph("?", ipaGothic));
         document.add(new Paragraph(comment, ipaGothic));
         */
        // step 5
        document.close();
    } catch (RuntimeException ex) {
        document.close();
        throw ex;

    }
}

From source file:psManage.StructSheet.java

public void createPdf(String mainTitle, String subTitle, String url, String userName,
        //String scanType,
        String comment,//from   w ww  .j  av a  2s  .c o m
        //String thisPassCode,
        String passCodeA, String passCodeB, String fileDir, Boolean noBarCodePrint)
        throws IOException, DocumentException, RuntimeException {
    Document document = null;
    try {
        // step 1
        document = new Document(PageSize.A4, 60, 50, 50, 35);
        // step 2
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(fileDir));
        // step 3
        document.open();
        // step 4
        PdfContentByte cb = writer.getDirectContent();
        /*
         Properties props = new Properties();
         String jarPath = System.getProperty("java.class.path");
         String dirPath = jarPath.substring(0, jarPath.lastIndexOf(File.separator)+1);
         FontFactory.registerDirectory("/res");
         FontFactory.register("ipag.ttf");
         Font ipaGothic = FontFactory.getFont("ipag", BaseFont.IDENTITY_H, 
         BaseFont.EMBEDDED, 10); //10 is the size
                
         InputStream is = getClass().getResourceAsStream("/res/ipag.ttf");
         */

        Properties props = new Properties();
        String jarPath = System.getProperty("java.class.path");
        String dirPath = jarPath.substring(0, jarPath.lastIndexOf(File.separator) + 1);
        System.out.println(jarPath);
        System.out.println(dirPath);
        System.out.println(System.getProperty("user.dir"));

        Font ipaGothic = new Font(BaseFont.createFont(System.getProperty("user.dir") + "\\res\\ipag.ttf",
                BaseFont.IDENTITY_H, BaseFont.EMBEDDED), 11);

        Font ipaGothic14 = new Font(BaseFont.createFont(System.getProperty("user.dir") + "\\res\\ipag.ttf",
                BaseFont.IDENTITY_H, BaseFont.EMBEDDED), 14);

        //?(2)
        PdfPTable pdfPTable = new PdfPTable(2);

        pdfPTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
        pdfPTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        pdfPTable.getDefaultCell().setFixedHeight(150);

        pdfPTable.setWidthPercentage(100f);

        int pdfPTableWidth[] = { 10, 90 };
        pdfPTable.setWidths(pdfPTableWidth);

        PdfPCell cell_1_1 = new PdfPCell(new Paragraph("??", ipaGothic));
        cell_1_1.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell_1_1.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell_1_1.setFixedHeight(50);
        PdfPCell cell_1_2 = new PdfPCell(new Paragraph(mainTitle, ipaGothic));
        cell_1_2.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell_1_2.setHorizontalAlignment(Element.ALIGN_CENTER);

        PdfPCell cell_2_1 = new PdfPCell(new Paragraph("", ipaGothic));
        cell_2_1.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell_2_1.setHorizontalAlignment(Element.ALIGN_CENTER);
        PdfPCell cell_2_2 = new PdfPCell(new Paragraph(subTitle, ipaGothic));
        cell_2_2.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell_2_2.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell_2_2.setFixedHeight(50);
        pdfPTable.addCell(cell_1_1);
        pdfPTable.addCell(cell_1_2);
        pdfPTable.addCell(cell_2_1);
        pdfPTable.addCell(cell_2_2);

        PdfPCell cellUrlKey = new PdfPCell(new Paragraph("?", ipaGothic));
        cellUrlKey.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellUrlKey.setHorizontalAlignment(Element.ALIGN_CENTER);
        cellUrlKey.setRowspan(2);
        pdfPTable.addCell(cellUrlKey);

        PdfPCell cellUrlValue = new PdfPCell(new Paragraph(url, ipaGothic));
        Chunk chunk = new Chunk(url, ipaGothic); // ??????????????
        System.out.println("??" + chunk.getWidthPoint());
        cellUrlValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
        if (chunk.getWidthPoint() > 410) { // ??????????
            cellUrlValue.setHorizontalAlignment(Element.ALIGN_LEFT);
        } else { // ?????????
            cellUrlValue.setHorizontalAlignment(Element.ALIGN_CENTER);
        }

        cellUrlValue.setFixedHeight(50);
        pdfPTable.addCell(cellUrlValue);

        if (url.length() != 0 && !noBarCodePrint) {
            /* ?
             BarcodeQRCode qr = new BarcodeQRCode(url, 50, 50, null);
             PdfPCell cellUrlValueQr = new PdfPCell(qr.getImage());
             cellUrlValueQr.setVerticalAlignment(Element.ALIGN_MIDDLE);
             cellUrlValueQr.setHorizontalAlignment(Element.ALIGN_CENTER);
             cellUrlValueQr.setFixedHeight(80);
             pdfPTable.addCell(cellUrlValueQr);
             */
            Image image = ZxingUti.getQRCode(url); //  SHIFT_JIS
            com.itextpdf.text.Image iTextImage = com.itextpdf.text.Image.getInstance(image, null);
            PdfPCell cell = new PdfPCell(iTextImage);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setFixedHeight(100);
            pdfPTable.addCell(cell); //  SIFT_JIS
        } else {
            PdfPCell cellUrlValueQr = new PdfPCell(new Paragraph("", ipaGothic));
            cellUrlValueQr.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cellUrlValueQr.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellUrlValueQr.setFixedHeight(80);
            pdfPTable.addCell(cellUrlValueQr);
        }

        PdfPCell cellUserNameKey = new PdfPCell(new Paragraph("", ipaGothic));
        cellUserNameKey.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellUserNameKey.setHorizontalAlignment(Element.ALIGN_CENTER);
        cellUserNameKey.setRowspan(2);
        pdfPTable.addCell(cellUserNameKey);

        PdfPCell cellUserNameValue = new PdfPCell(new Paragraph(userName, ipaGothic14));
        cellUserNameValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellUserNameValue.setHorizontalAlignment(Element.ALIGN_CENTER);
        cellUserNameValue.setFixedHeight(30);
        pdfPTable.addCell(cellUserNameValue);

        if (userName.length() != 0 && !noBarCodePrint) {
            Barcode128 code128 = new Barcode128();
            code128.setCode(userName);
            code128.setFont(ipaGothic.getBaseFont());
            code128.setBarHeight(40f);
            PdfPCell cellUserNameValueBc = new PdfPCell(code128.createImageWithBarcode(cb, null, null));
            cellUserNameValueBc.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cellUserNameValueBc.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellUserNameValueBc.setFixedHeight(80);
            pdfPTable.addCell(cellUserNameValueBc);
        } else {
            PdfPCell cellUserNameValueBc = new PdfPCell(new Paragraph("---", ipaGothic));
            cellUserNameValueBc.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cellUserNameValueBc.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellUserNameValueBc.setFixedHeight(80);
            pdfPTable.addCell(cellUserNameValueBc);
        }

        PdfPCell cellPassCodeKey = new PdfPCell(new Paragraph("?", ipaGothic));
        cellPassCodeKey.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellPassCodeKey.setHorizontalAlignment(Element.ALIGN_CENTER);
        cellPassCodeKey.setRowspan(3);
        pdfPTable.addCell(cellPassCodeKey);

        PdfPCell cellPassCodeValue = new PdfPCell(new Paragraph(passCodeA + passCodeB, ipaGothic14));
        cellPassCodeValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellPassCodeValue.setHorizontalAlignment(Element.ALIGN_CENTER);
        cellPassCodeValue.setFixedHeight(30);
        pdfPTable.addCell(cellPassCodeValue);

        if (passCodeA.length() != 0 && !noBarCodePrint) {
            Barcode128 code128 = new Barcode128();
            code128.setCode(passCodeA);
            code128.setFont(ipaGothic.getBaseFont());
            code128.setBarHeight(40f);
            PdfPCell cellPassCodeA_Bc = new PdfPCell(code128.createImageWithBarcode(cb, null, null));
            cellPassCodeA_Bc.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cellPassCodeA_Bc.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellPassCodeA_Bc.setFixedHeight(80);
            pdfPTable.addCell(cellPassCodeA_Bc);
        } else {
            PdfPCell cellPassCodeA_Bc = new PdfPCell(new Paragraph("---", ipaGothic));
            cellPassCodeA_Bc.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cellPassCodeA_Bc.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellPassCodeA_Bc.setFixedHeight(80);
            pdfPTable.addCell(cellPassCodeA_Bc);
        }

        if (passCodeB.length() != 0 && !noBarCodePrint) {
            Barcode128 code128 = new Barcode128();
            code128.setCode(passCodeB);
            code128.setFont(ipaGothic.getBaseFont());
            code128.setBarHeight(40f);
            PdfPCell cellPassCodeB_Bc = new PdfPCell(code128.createImageWithBarcode(cb, null, null));
            cellPassCodeB_Bc.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cellPassCodeB_Bc.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellPassCodeB_Bc.setFixedHeight(80);
            pdfPTable.addCell(cellPassCodeB_Bc);
        } else {
            PdfPCell cellPassCodeB_Bc = new PdfPCell(new Paragraph("---", ipaGothic));
            cellPassCodeB_Bc.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cellPassCodeB_Bc.setHorizontalAlignment(Element.ALIGN_CENTER);
            cellPassCodeB_Bc.setFixedHeight(80);
            pdfPTable.addCell(cellPassCodeB_Bc);
        }

        PdfPCell cellCommentKey = new PdfPCell(new Paragraph("?", ipaGothic));
        cellCommentKey.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellCommentKey.setHorizontalAlignment(Element.ALIGN_CENTER);
        pdfPTable.addCell(cellCommentKey);

        PdfPCell cellCommentValue = new PdfPCell(new Paragraph(comment, ipaGothic));
        cellCommentValue.setVerticalAlignment(Element.ALIGN_TOP);
        cellCommentValue.setHorizontalAlignment(Element.ALIGN_LEFT);
        cellCommentValue.setFixedHeight(150);
        pdfPTable.addCell(cellCommentValue);

        PdfPCell cellIssueKey = new PdfPCell(new Paragraph("", ipaGothic));
        cellIssueKey.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellIssueKey.setHorizontalAlignment(Element.ALIGN_CENTER);
        pdfPTable.addCell(cellIssueKey);

        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm");
        String strDate = sdf.format(cal.getTime());
        PdfPCell cellIssueValue = new PdfPCell(new Paragraph(strDate, ipaGothic));
        cellIssueValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cellIssueValue.setHorizontalAlignment(Element.ALIGN_CENTER);
        cellIssueValue.setFixedHeight(20);
        pdfPTable.addCell(cellIssueValue);

        //??
        document.add(pdfPTable);
        /*
                
         // CODE 128
         document.add(new Paragraph("?? : " + mainTitle, ipaGothic));
         document.add(new Paragraph(" : " + subTitle, ipaGothic));
         document.add(new Paragraph("-------------------------------------------------------"));
         document.add(new Paragraph(" " + strDate));
         document.add(new Paragraph("-------------------------------------------------------"));
                
                
         BaseFont bf = BaseFont.createFont(BaseFont.COURIER, BaseFont.WINANSI, BaseFont.EMBEDDED);
         Font font = new Font(bf, 12);
         document.add(new Paragraph("", ipaGothic));
         document.add(new Paragraph(url, ipaGothic));
         code128.setCode(url);
         code128.setFont(bf);
         code128.setX(1);
         //document.add(code128.createImageWithBarcode(cb, null, null));
                
         document.add(new Paragraph("USER", ipaGothic));
         if (userName.length() != 0) {
         document.add(new Paragraph(userName, ipaGothic));
         code128.setCode(userName);
         code128.setFont(bf);
         code128.setBarHeight(40f);
         document.add(code128.createImageWithBarcode(cb, null, null));
         }
                
         document.add(new Paragraph("CODE", ipaGothic));
         if (passCode.length() != 0) {
         document.add(new Paragraph(passCode, ipaGothic));
         code128.setCode(passCode);
         code128.setFont(bf);
         document.add(code128.createImageWithBarcode(cb, null, null));
         }
                
         document.add(new Paragraph("?", ipaGothic));
         document.add(new Paragraph(comment, ipaGothic));
         */
        // step 5
        document.close();
    } catch (RuntimeException ex) {
        document.close();
        throw ex;

    }
}

From source file:ro.nextreports.engine.exporter.PdfExporter.java

License:Apache License

private PdfPCell renderPdfCell(BandElement bandElement, Object value, int gridRow, int rowSpan, int colSpan,
        boolean image, int column) {
    Map<String, Object> style = buildCellStyleMap(bandElement, value, gridRow, column, colSpan);

    FontFactoryImp fact = new FontFactoryImp();
    com.itextpdf.text.Font fnt;//  ww  w .j a  v a 2 s.c o  m
    if (bandElement != null) {
        fontName = (String) style.get(StyleFormatConstants.FONT_NAME_KEY);
        int size = ((Float) style.get(StyleFormatConstants.FONT_SIZE)).intValue();
        fnt = getFont(size);
    } else {
        fnt = getFont(10);
    }

    PdfPCell cell;
    if (image) {
        if (value == null) {
            cell = new PdfPCell(new Phrase(IMAGE_NOT_FOUND));
        } else {
            ImageBandElement ibe = (ImageBandElement) bandElement;
            try {
                byte[] imageBytes = getImage((String) value);
                cell = getImageCell(ibe, imageBytes, column, colSpan);
            } catch (Exception e) {
                cell = new PdfPCell(new Phrase(IMAGE_NOT_LOADED));
            }
        }
    } else if (bandElement instanceof HyperlinkBandElement) {
        Hyperlink hyperlink = ((HyperlinkBandElement) bandElement).getHyperlink();
        Anchor anchor = new Anchor(hyperlink.getText(), fnt);
        anchor.setReference(hyperlink.getUrl());
        Phrase ph = new Phrase();
        ph.add(anchor);
        cell = new PdfPCell(ph);
    } else if (bandElement instanceof ReportBandElement) {
        Report report = ((ReportBandElement) bandElement).getReport();
        ExporterBean eb = null;
        try {
            eb = getSubreportExporterBean(report);
            PdfExporter subExporter = new PdfExporter(eb);
            subExporter.export();
            PdfPTable innerTable = subExporter.getTable();
            cell = new PdfPCell(innerTable);
        } catch (Exception e) {
            cell = new PdfPCell();
            e.printStackTrace();
        } finally {
            if ((eb != null) && (eb.getResult() != null)) {
                eb.getResult().close();
            }
        }
    } else if ((bandElement instanceof VariableBandElement) && (VariableFactory
            .getVariable(((VariableBandElement) bandElement).getVariable()) instanceof TotalPageNoVariable)) {
        try {
            cell = new PdfPCell(Image.getInstance(total));
        } catch (BadElementException e) {
            cell = new PdfPCell(new Phrase("NA"));
        }

    } else if (bandElement instanceof ImageColumnBandElement) {
        try {
            String v = StringUtil.getValueAsString(value, null);
            if (StringUtil.BLOB.equals(v)) {
                cell = new PdfPCell(new Phrase(StringUtil.BLOB));
            } else {
                byte[] bytes = StringUtil.decodeImage(v);
                cell = getImageCell(bandElement, bytes, column, colSpan);
            }
        } catch (Exception e) {
            e.printStackTrace();
            cell = new PdfPCell(new Phrase(IMAGE_NOT_LOADED));
        }
    } else {
        String stringValue;
        if (style.containsKey(StyleFormatConstants.PATTERN)) {
            stringValue = StringUtil.getValueAsString(value, (String) style.get(StyleFormatConstants.PATTERN),
                    getReportLanguage());
        } else {
            stringValue = StringUtil.getValueAsString(value, null, getReportLanguage());
        }
        if (stringValue == null) {
            stringValue = "";
        }
        if (stringValue.startsWith("<html>")) {
            StringReader reader = new StringReader(stringValue);
            List<Element> elems = new ArrayList<Element>();
            try {
                elems = HTMLWorker.parseToList(reader, new StyleSheet());
                Phrase ph = new Phrase();
                for (int i = 0; i < elems.size(); i++) {
                    Element elem = (Element) elems.get(i);
                    ph.add(elem);
                }
                cell = new PdfPCell(ph);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                Phrase ph = new Phrase(stringValue, fnt);
                cell = new PdfPCell(ph);
            }

        } else {
            Phrase ph = new Phrase(stringValue, fnt);
            cell = new PdfPCell(ph);
        }
    }

    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    cell.setUseDescender(true); // needed for a cell without padding
    cell.setMinimumHeight(MINIMUM_HEIGHT); // needed if there is a row in which all cells are empty

    if (bandElement != null) {
        cell.setRotation(bandElement.getTextRotation());
    }

    if (colSpan > 1) {
        cell.setColspan(colSpan);
    }

    if (rowSpan > 1) {
        cell.setRowspan(rowSpan);
    }

    if (style != null) {

        updateFont(style, fnt);

        if (style.containsKey(StyleFormatConstants.BACKGROUND_COLOR)) {
            Color val = (Color) style.get(StyleFormatConstants.BACKGROUND_COLOR);
            cell.setBackgroundColor(new BaseColor(val));
        }
        if (style.containsKey(StyleFormatConstants.HORIZONTAL_ALIGN_KEY)) {
            if (StyleFormatConstants.HORIZONTAL_ALIGN_LEFT
                    .equals(style.get(StyleFormatConstants.HORIZONTAL_ALIGN_KEY))) {
                cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
            }
            if (StyleFormatConstants.HORIZONTAL_ALIGN_RIGHT
                    .equals(style.get(StyleFormatConstants.HORIZONTAL_ALIGN_KEY))) {
                cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
            }
            if (StyleFormatConstants.HORIZONTAL_ALIGN_CENTER
                    .equals(style.get(StyleFormatConstants.HORIZONTAL_ALIGN_KEY))) {
                cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
            }
        }

        if (style.containsKey(StyleFormatConstants.VERTICAL_ALIGN_KEY)) {
            if (StyleFormatConstants.VERTICAL_ALIGN_TOP
                    .equals(style.get(StyleFormatConstants.VERTICAL_ALIGN_KEY))) {
                cell.setVerticalAlignment(Element.ALIGN_TOP);
            }
            if (StyleFormatConstants.VERTICAL_ALIGN_MIDDLE
                    .equals(style.get(StyleFormatConstants.VERTICAL_ALIGN_KEY))) {
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            }
            if (StyleFormatConstants.VERTICAL_ALIGN_BOTTOM
                    .equals(style.get(StyleFormatConstants.VERTICAL_ALIGN_KEY))) {
                cell.setVerticalAlignment(Element.ALIGN_BOTTOM);
            }
        }

        if (style.containsKey(StyleFormatConstants.PADDING_LEFT)) {
            Float val = (Float) style.get(StyleFormatConstants.PADDING_LEFT);
            cell.setPaddingLeft(val);
        }
        if (style.containsKey(StyleFormatConstants.PADDING_RIGHT)) {
            Float val = (Float) style.get(StyleFormatConstants.PADDING_RIGHT);
            cell.setPaddingRight(val);
        }
        if (style.containsKey(StyleFormatConstants.PADDING_TOP)) {
            Float val = (Float) style.get(StyleFormatConstants.PADDING_TOP);
            cell.setPaddingTop(val);
        }
        if (style.containsKey(StyleFormatConstants.PADDING_BOTTOM)) {
            Float val = (Float) style.get(StyleFormatConstants.PADDING_BOTTOM);
            cell.setPaddingBottom(val);
        }
        cell.setBorderWidth(0);

        if (style.containsKey(StyleFormatConstants.BORDER_LEFT)) {
            Float val = (Float) style.get(StyleFormatConstants.BORDER_LEFT);
            cell.setBorderWidthLeft(val / 2);
            Color color = (Color) style.get(StyleFormatConstants.BORDER_LEFT_COLOR);
            cell.setBorderColorLeft(new BaseColor(color));
        }
        if (style.containsKey(StyleFormatConstants.BORDER_RIGHT)) {
            Float val = (Float) style.get(StyleFormatConstants.BORDER_RIGHT);
            cell.setBorderWidthRight(val / 2);
            Color color = (Color) style.get(StyleFormatConstants.BORDER_RIGHT_COLOR);
            cell.setBorderColorRight(new BaseColor(color));
        }
        if (style.containsKey(StyleFormatConstants.BORDER_TOP)) {
            Float val = (Float) style.get(StyleFormatConstants.BORDER_TOP);
            cell.setBorderWidthTop(val / 2);
            Color color = (Color) style.get(StyleFormatConstants.BORDER_TOP_COLOR);
            cell.setBorderColorTop(new BaseColor(color));
        }
        if (style.containsKey(StyleFormatConstants.BORDER_BOTTOM)) {
            Float val = (Float) style.get(StyleFormatConstants.BORDER_BOTTOM);
            cell.setBorderWidthBottom(val / 2);
            Color color = (Color) style.get(StyleFormatConstants.BORDER_BOTTOM_COLOR);
            cell.setBorderColorBottom(new BaseColor(color));
        }

        // for subreports we use default no wrap
        if (cell.getTable() == null) {
            cell.setNoWrap(true);
            if (bandElement != null) {
                if (bandElement.isWrapText()) {
                    cell.setNoWrap(false);
                }
            }
        }

        // to see a background image all cells must not have any background!
        if (bean.getReportLayout().getBackgroundImage() != null) {
            cell.setBackgroundColor(null);
        }
    }
    return cell;
}

From source file:se.billes.pdf.renderer.model.text.TableParagraph.java

License:Open Source License

@Override
public void onRender(PdfPCell cell) throws PdfRenderException {

    PdfPTable table = new PdfPTable(widths.length);

    try {//w  w  w  .  j a va 2s . co m
        table.setTotalWidth(getTotalWidthsAsPs());
        table.setLockedWidth(true);
        table.setSpacingAfter(0f);

        for (AbstractParagraph tableCell : cells) {

            PdfPCell c = new PdfPCell();
            float[] padding = new float[] { 0f, 0f, 0f, 0f };
            if (tableCell instanceof TableCell) {
                padding = ((TableCell) tableCell).getPadding();
            }
            c.setBorderWidth(0f);
            c.setLeft(0);
            c.setTop(0);
            c.setRight(0);
            c.setBottom(0);
            c.setUseAscender(true);
            c.setIndent(0);
            c.setHorizontalAlignment(Element.ALIGN_LEFT);
            c.setVerticalAlignment(Element.ALIGN_TOP);
            c.setPaddingLeft(SizeFactory.millimetersToPostscriptPoints(padding[0]));
            c.setPaddingBottom(SizeFactory.millimetersToPostscriptPoints(padding[3]));
            c.setPaddingRight(SizeFactory.millimetersToPostscriptPoints(padding[2]));
            c.setPaddingTop(SizeFactory.millimetersToPostscriptPoints(padding[1]));
            c.setBorder(0);
            tableCell.onRender(c);

            table.addCell(c);

        }
        cell.addElement(table);
    } catch (Exception e) {
        throw new PdfRenderException(e);
    }
}

From source file:se.inera.intyg.intygstyper.fk7263.pdf.PdfAbstractGenerator.java

License:Open Source License

protected void mark(PdfStamper pdfStamper, String watermarkText, int startX, int startY, int height, int width)
        throws DocumentException, IOException {
    PdfContentByte addOverlay;/*w  w w.jav a2 s.c o m*/
    addOverlay = pdfStamper.getOverContent(1);
    addOverlay.saveState();
    addOverlay.setColorFill(CMYKColor.WHITE);
    addOverlay.setColorStroke(CMYKColor.RED);
    addOverlay.rectangle(startX, startY, width, height);
    addOverlay.stroke();
    addOverlay.restoreState();

    // Do text
    addOverlay = pdfStamper.getOverContent(1);
    ColumnText ct = new ColumnText(addOverlay);
    BaseFont bf = BaseFont.createFont();
    Font font = new Font(bf, WATERMARK_FONTSIZE);
    int llx = startX + WATERMARK_TEXT_PADDING;
    int lly = startY + WATERMARK_TEXT_PADDING;
    int urx = llx + width - 2 * WATERMARK_TEXT_PADDING;
    int ury = lly + height - 2 * WATERMARK_TEXT_PADDING;
    Phrase phrase = new Phrase(watermarkText, font);
    ct.setSimpleColumn(phrase, llx, lly, urx, ury, WATERMARK_FONTSIZE, Element.ALIGN_LEFT | Element.ALIGN_TOP);
    ct.go();
}

From source file:zeugnis.ZeugnisPDF.java

private PdfPCell title2(String s, int colspan, float minheight, float pad) {
    PdfPCell retCell = new PdfPCell(new Phrase(s, NORMAL_FONT));
    retCell.setColspan(colspan);/*  w  ww.  ja  va 2  s .c  om*/
    retCell.setFixedHeight(50f);
    retCell.setVerticalAlignment(Element.ALIGN_TOP);
    retCell.setPadding(pad);
    retCell.setHorizontalAlignment(Element.ALIGN_LEFT);
    return retCell;
}

From source file:zeugnis.ZeugnisPDF.java

/***
 * Erzeugt cell mit Selten/Wechselnd/berwiegend
 * @param s//from w ww.j  a  v a 2  s. c o m
 * @param pad
 * @return 
 */
private PdfPCell seweue(String s, float pad) {
    PdfPCell retCell = new PdfPCell(new Phrase(s, TINY_FONT));
    retCell.setVerticalAlignment(Element.ALIGN_TOP);
    retCell.setPadding(pad);
    retCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    return retCell;
}

From source file:zeugnis.ZeugnisPDF.java

/***
 * Erzeugt ein table Objekt das Arbeits- und Sozialverhalten
 * @param table//  w  ww  .  j  av  a 2s.  c o m
 * @param verhalten
 * @param pad
 * @return
 * @throws IOException
 * @throws BadElementException 
 */
private PdfPTable asVerhalten(PdfPTable table, ArrayList verhalten, float pad)
        throws IOException, BadElementException {
    Integer mH = 15;
    for (Integer i = 0; i < verhalten.size(); i++) {
        PdfPCell cell2;
        cell2 = new PdfPCell(new Phrase(((TableItem) verhalten.get(i)).getText(), TINY_FONT));
        //cell2ATitle.setColspan(4);
        cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell2.setMinimumHeight(mH);
        cell2.setPadding(pad);
        cell2.setHorizontalAlignment(Element.ALIGN_LEFT);
        //cell2ATitle.setBorder(Rectangle.NO_BORDER);

        PdfPCell selection = new PdfPCell(
                checkCross(getSymbol1(), pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.BOX));
        PdfPCell cell2bewertungX;
        //            cell2bewertungX = new PdfPCell(new Phrase("x" ,TINY_FONT));
        cell2bewertungX = selection;
        //cell2ATitle.setColspan(4);
        cell2bewertungX.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell2bewertungX.setMinimumHeight(mH);
        cell2bewertungX.setPadding(pad);
        cell2bewertungX.setHorizontalAlignment(Element.ALIGN_CENTER);
        //cell2ATitle.setBorder(Rectangle.NO_BORDER);

        PdfPCell cell2bewertung;
        cell2bewertung = new PdfPCell(new Phrase("", TINY_FONT));
        //cell2ATitle.setColspan(4);
        cell2bewertung.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell2bewertung.setMinimumHeight(mH);
        cell2bewertung.setPadding(pad);
        cell2bewertung.setHorizontalAlignment(Element.ALIGN_CENTER);
        //cell2ATitle.setBorder(Rectangle.NO_BORDER);

        table.addCell(cell2);
        switch (((TableItem) verhalten.get(i)).getBewertung()) {
        case 0:
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            break;
        case 1:
            table.addCell(cell2bewertungX);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            break;
        case 2:
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertungX);
            table.addCell(cell2bewertung);
            ;
            break;
        case 3:
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertungX);
            break;
        default:
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            break;
        }
    }
    return table;
}

From source file:zeugnis.ZeugnisPDF.java

/***
 * Erzeugt eine Liste mit Kriterien und Bewertungsspalten
 * @param table/* w  w  w  . j a  va  2 s. c  o m*/
 * @param lernbereich
 * @param pad
 * @return
 * @throws IOException
 * @throws BadElementException 
 */
private PdfPTable lernbereiche(PdfPTable table, ArrayList lernbereich, float pad)
        throws IOException, BadElementException {
    for (Integer i = 0; i < lernbereich.size(); i++) {
        PdfPCell cell2;
        cell2 = new PdfPCell(new Phrase(((TableItem) lernbereich.get(i)).getText(), TINY_FONT));
        cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell2.setPadding(pad);
        cell2.setHorizontalAlignment(Element.ALIGN_LEFT);

        PdfPCell cell2bewertungX;
        PdfPCell selection = new PdfPCell(
                checkCross(getSymbol2(), pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.BOX));
        //            cell2bewertungX = new PdfPCell(new Phrase("x" ,TINY_FONT));
        cell2bewertungX = selection;
        cell2bewertungX.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell2bewertungX.setPadding(pad);
        cell2bewertungX.setHorizontalAlignment(Element.ALIGN_CENTER);

        PdfPCell cell2bewertung;
        cell2bewertung = new PdfPCell(new Phrase("", TINY_FONT));
        cell2bewertung.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell2bewertung.setPadding(pad);
        cell2bewertung.setHorizontalAlignment(Element.ALIGN_CENTER);

        table.addCell(cell2);
        switch (((TableItem) lernbereich.get(i)).getBewertung()) {
        case 0:
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            break;
        case 4:
            table.addCell(cell2bewertungX);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            break;
        case 5:
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertungX);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            ;
            break;
        case 6:
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertungX);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            break;
        case 7:
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertungX);
            table.addCell(cell2bewertung);
            break;
        case 8:
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertungX);
            break;
        default:
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            table.addCell(cell2bewertung);
            break;
        }
    }
    return table;
}

From source file:zeugnis.ZeugnisPDF.java

/**
* Erzeugt das Zeugnis PDF in einem definierten Ordner
* @throws IOException// w w w .j a  va  2s  .  c o m
* @throws DocumentException
* @throws SQLException 
*/
public void CreatePDF() throws IOException, DocumentException, SQLException {
    float pad = 6.0f;

    // Einige Strings fr die Ausgabe...
    String Schuljahr = "Schuljahr " + Integer.toString(schuljahr) + "/" + Integer.toString(schuljahr + 1);
    String Halbjahr;
    if (halbjahr == 1) {
        Halbjahr = "1. Halbjahr";
    } else {
        Halbjahr = "1. und 2. Halbjahr";
    }
    String Klasse = "Klasse " + klasse;

    String Tage = "Versumte Unterrichtstage im " + Halbjahr + ": " + String.valueOf(fehltage)
            + " davon unentschuldigt: " + String.valueOf(fehltageohne);
    String Unterschriften1 = "________________________________________\n\n Klassenlehrerin / Klassenlehrer";
    String Unterschriften2 = "________________________________________\n\n Schulleiterin / Schulleiter";
    String Unterschriften3 = "________________________________________\n\n Unterschrift einer/eines Erziehungsberechtigten";
    String DatumLine = "________________________________________\n\n Ausstellungsort und Datum";

    //    String Datum = "Datum: " + currDate;
    String Datum = currDate;

    String AundS = "Arbeits- und Sozialverhalten";
    String ATitle = "Arbeitsverhalten\n\n" + vorname + "...";
    String STitle = "Sozialverhalten\n\n" + vorname + "...";
    String Selten = "selten";
    String Wechselnd = "wechselnd";
    String Ueberwiegend = "berwiegend";

    String Erklaerungen = "Erklrungen";
    String BewertungsstufenAS = "Bewertungsstufen fr das Arbeits- und Sozialverhalten:";
    String Symbole = "Symbolerluterungen fr die Unterrichtsfcher:";

    String Sym0 = "Das Thema wurde noch nicht bearbeitet";
    String Sym1 = "Die Kompetenz ist in Anstzen vorhanden";
    String Sym2 = "Die Kompetenz ist grundlegend gesichert";
    String Sym3 = "Die Kompetenz ist weitgehend gesichert";
    String Sym4 = "Die Kompetenz ist gesichert";

    String deutschS = "Deutsch ";
    String matheS = "Mathematik ";
    String sachunterrichtS = "Sachunterricht ";
    String musikS = "Musik ";
    String religionS = "Religion ";
    String kunstS = "Kunst ";
    String sportS = "Sport ";
    String textilS = "Textiles Gestalten ";
    String werkenS = "Werken ";
    String englischS = "Englisch ";

    //        String jStufe   = "Jahrgangsstufe "+ Gui.getSClass().substring(0, 1);
    String jStufe = "";
    String sz = "Sprechen und Zuhren\n\n" + vorname + "...";
    String sch = "Schreiben\n\n" + vorname + "...";
    String les = "Lesen - mit Texten und Medien umgehen\n\n" + vorname + "...";
    String sp = "Sprache und Sprachgebrauch untersuchen\n\n" + vorname + "...";
    String zo = "Zahlen und Operationen\n\n" + vorname + "...";
    String gm = "Gren und Messen\n\n" + vorname + "...";
    String rf = "Raum und Form\n\n" + vorname + "...";
    String su = vorname + "...";

    // Ausgabedokument erzeugen
    Document doc = new Document(PageSize.A4, 50, 50, 20, 30);
    PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream(file));

    // Fr header und footer
    TableHeader event = new TableHeader();
    event.setHeader("");
    writer.setPageEvent(event);

    doc.open();
    // Logo
    //        URL url = this.getClass().getResource("pics/GSBrelingen.jpg");
    URL url = this.getClass().getResource("pics/GSKopfLogo300.png");
    Image img = Image.getInstance(url);
    double moremargin = doc.getPageSize().getWidth() * 0.0;
    float scaler = ((doc.getPageSize().getWidth() - doc.leftMargin() - doc.rightMargin() - (float) moremargin)
            / img.getWidth()) * 100;
    img.scalePercent(scaler * 0.7f);

    // Seite 1 *************************************************************
    // Tablestruktur aufbauen...
    PdfPTable table1 = new PdfPTable(new float[] { 36, 28, 36 });
    table1.setWidthPercentage(100);

    PdfPCell cell1Logo;
    cell1Logo = new PdfPCell(img);
    cell1Logo.setColspan(3);
    cell1Logo.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell1Logo.setBorder(Rectangle.NO_BORDER);

    // Adresse
    PdfPCell cell1Adresse;
    cell1Adresse = new PdfPCell(new Phrase(
            "Grundschule Brelingen  Schulstrae 10  30900 Wedemark  GS.Brelingen@Wedemark.de",
            SMALL_FONT));
    cell1Adresse.setColspan(3);
    cell1Adresse.setFixedHeight(30f);
    cell1Adresse.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell1Adresse.setBorder(Rectangle.NO_BORDER);

    //Zeugnis
    PdfPCell cell1Zeugnis;
    cell1Zeugnis = new PdfPCell(new Phrase("Zeugnis", BIG_FONT));
    cell1Zeugnis.setColspan(3);
    cell1Zeugnis.setFixedHeight(40f);
    cell1Zeugnis.setVerticalAlignment(Element.ALIGN_BOTTOM);
    cell1Zeugnis.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell1Zeugnis.setBorder(Rectangle.NO_BORDER);

    //Schuljahr
    PdfPCell cell1Schuljahr;
    cell1Schuljahr = new PdfPCell(new Phrase(Schuljahr, BIGGER_FONT));
    cell1Schuljahr.setFixedHeight(30f);
    cell1Schuljahr.setVerticalAlignment(Element.ALIGN_BOTTOM);
    cell1Schuljahr.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell1Schuljahr.setBorder(Rectangle.NO_BORDER);

    //Halbjahr
    PdfPCell cell1Halbjahr;
    cell1Halbjahr = new PdfPCell(new Phrase(Halbjahr, BIGGER_FONT));
    cell1Halbjahr.setFixedHeight(30f);
    cell1Halbjahr.setVerticalAlignment(Element.ALIGN_BOTTOM);
    cell1Halbjahr.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell1Halbjahr.setBorder(Rectangle.NO_BORDER);

    //Klasse
    PdfPCell cell1Klasse;
    cell1Klasse = new PdfPCell(new Phrase(Klasse, BIGGER_FONT));
    cell1Klasse.setFixedHeight(30f);
    cell1Klasse.setVerticalAlignment(Element.ALIGN_BOTTOM);
    cell1Klasse.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell1Klasse.setBorder(Rectangle.NO_BORDER);

    //Name
    PdfPCell cell1Name;
    cell1Name = new PdfPCell(new Phrase(vorname + " " + name, NAME_FONT));
    cell1Name.setColspan(3);
    cell1Name.setFixedHeight(40f);
    cell1Name.setVerticalAlignment(Element.ALIGN_BOTTOM);
    cell1Name.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell1Name.setBorder(Rectangle.NO_BORDER);

    //Geboren
    PdfPCell cell1Geboren;
    cell1Geboren = new PdfPCell(new Phrase("geboren am " + gebdatum + " in " + gebort, NORMAL_FONT));
    cell1Geboren.setColspan(3);
    cell1Geboren.setFixedHeight(20f);
    cell1Geboren.setVerticalAlignment(Element.ALIGN_TOP);
    cell1Geboren.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell1Geboren.setBorder(Rectangle.NO_BORDER);

    //Tage
    PdfPCell cell1Tage;
    cell1Tage = new PdfPCell(new Phrase(Tage, SMALL_FONT));
    cell1Tage.setColspan(3);
    cell1Tage.setFixedHeight(50f);
    cell1Tage.setVerticalAlignment(Element.ALIGN_TOP);
    cell1Tage.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell1Tage.setBorder(Rectangle.NO_BORDER);

    //Lernentwicklung
    Paragraph lern = new Paragraph();
    Paragraph bem = new Paragraph();
    PdfPTable table = new PdfPTable(1);
    Phrase lernTitle = new Phrase(lernentwicklungTitle, SMALLBOLDITALIC2_FONT);
    Phrase bemTitle = new Phrase(bemerkungenTitle, SMALLBOLDITALIC2_FONT);
    Phrase lernText = new Phrase(lernentwicklung, SMALL2_FONT);
    Phrase bemText = new Phrase(bemerkungen, SMALL2_FONT);
    if (lernentwicklung.isEmpty()) {
        ;
    } else {
        lern.add(lernTitle);
    }
    if (bemerkungen.isEmpty()) {
        ;
    } else {
        bem.add(bemTitle);
    }
    lern.add(lernText);
    bem.add(bemText);
    PdfPCell le = new PdfPCell(lern);
    PdfPCell be = new PdfPCell(bem);

    le.setVerticalAlignment(Element.ALIGN_TOP);
    be.setVerticalAlignment(Element.ALIGN_BOTTOM);
    le.setBorder(Rectangle.NO_BORDER);
    be.setBorder(Rectangle.NO_BORDER);
    table.addCell(le);
    table.addCell(be);
    PdfPCell cell1Lernentwicklung;
    cell1Lernentwicklung = new PdfPCell(table);
    cell1Lernentwicklung.setColspan(3);
    cell1Lernentwicklung.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell1Lernentwicklung.setFixedHeight(350f);
    cell1Lernentwicklung.setPadding(pad);
    //        cell1Lernentwicklung.setBorder(Rectangle.NO_BORDER);

    // Unterschriften
    PdfPCell cell1Unterschriften1;
    cell1Unterschriften1 = new PdfPCell(new Phrase(Unterschriften1, MICRO_FONT));
    //cell1Unterschriften.setColspan(3);
    cell1Unterschriften1.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell1Unterschriften1.setVerticalAlignment(Element.ALIGN_BOTTOM);
    cell1Unterschriften1.setFixedHeight(70f);
    cell1Unterschriften1.setBorder(Rectangle.NO_BORDER);

    PdfPCell cell1Empty;
    cell1Empty = new PdfPCell(new Phrase("", SMALL_FONT));
    //cell1Unterschriften.setColspan(3);
    cell1Empty.setFixedHeight(70f);
    cell1Empty.setBorder(Rectangle.NO_BORDER);

    PdfPCell cell1Unterschriften2;
    cell1Unterschriften2 = new PdfPCell(new Phrase(Unterschriften2, MICRO_FONT));
    //cell1Unterschriften2.setColspan(2);
    cell1Unterschriften2.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell1Unterschriften2.setVerticalAlignment(Element.ALIGN_BOTTOM);
    cell1Unterschriften2.setFixedHeight(70f);
    cell1Unterschriften2.setBorder(Rectangle.NO_BORDER);

    PdfPCell cell1Datum;
    if (Gui.isOverwriteDateSelected()) {
        if (Gui.getOverwriteDate().isEmpty()) {
            Datum = "     ......................";
        } else {
            Datum = Gui.getOverwriteDate();
        }
    }
    Phrase p1 = new Phrase("Brelingen, den " + Datum + "\n", SMALL_FONT);
    Phrase p2 = new Phrase(DatumLine, MICRO_FONT);
    Paragraph par1 = new Paragraph(p1);
    par1.add(p2);
    cell1Datum = new PdfPCell(par1);
    //cell1Datum.addElement(p1);
    //cell1Datum.addElement(p2);
    //cell1Unterschriften.setColspan(3);
    cell1Datum.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell1Datum.setVerticalAlignment(Element.ALIGN_BOTTOM);
    cell1Datum.setFixedHeight(60f);
    cell1Datum.setBorder(Rectangle.NO_BORDER);

    PdfPCell cell1Gesehen;
    cell1Gesehen = new PdfPCell(new Phrase("", NORMAL_FONT));
    cell1Gesehen.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell1Gesehen.setVerticalAlignment(Element.ALIGN_CENTER);
    //cell1Unterschriften.setColspan(3);
    cell1Gesehen.setFixedHeight(60f);
    cell1Gesehen.setBorder(Rectangle.NO_BORDER);

    PdfPCell cell1Unterschriften3;
    Phrase p3 = new Phrase("gesehen:                                             \u00a0\n", TINY_FONT);
    Phrase p4 = new Phrase(Unterschriften3, MICRO_FONT);
    Paragraph par2 = new Paragraph(p3);
    par2.add(p4);
    cell1Unterschriften3 = new PdfPCell(par2);
    //cell1Unterschriften3.setColspan(2);
    cell1Unterschriften3.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell1Unterschriften3.setVerticalAlignment(Element.ALIGN_BOTTOM);
    cell1Unterschriften3.setFixedHeight(60f);
    cell1Unterschriften3.setBorder(Rectangle.NO_BORDER);

    table1.addCell(cell1Logo);
    table1.addCell(cell1Adresse);
    table1.addCell(cell1Zeugnis);
    table1.addCell(cell1Schuljahr);
    table1.addCell(cell1Halbjahr);
    table1.addCell(cell1Klasse);
    table1.addCell(cell1Name);
    table1.addCell(cell1Geboren);
    table1.addCell(cell1Tage);
    table1.addCell(cell1Lernentwicklung);
    table1.addCell(cell1Unterschriften1);
    table1.addCell(cell1Empty);
    table1.addCell(cell1Unterschriften2);
    table1.addCell(cell1Datum);
    table1.addCell(cell1Gesehen);
    table1.addCell(cell1Unterschriften3);

    doc.add(table1);

    doc.newPage();

    // Seite 2 *************************************************************
    String head = vorname + " " + name + ", geboren am " + gebdatum;
    event.setHeader(head);
    // Tablestruktur aufbauen...
    pad = 3.0f;
    PdfPTable table2 = new PdfPTable(4);
    table2.setWidths(new float[] { 58, 14, 14, 14 });
    table2.setWidthPercentage(100);

    PdfPCell cell2Header = emptyLine(4, 10f);
    PdfPCell cell2AundS = new PdfPCell(title1(AundS, 4, 35f));
    PdfPCell cell2ATitle = new PdfPCell(title2(ATitle, 1, 50f, pad));

    PdfPCell cell2Selten = new PdfPCell(seweue(Selten, pad));
    PdfPCell cell2Wechselnd = new PdfPCell(seweue(Wechselnd, pad));
    PdfPCell cell2Ueberwiegend = new PdfPCell(seweue(Ueberwiegend, pad));

    table2.addCell(cell2Header);
    table2.addCell(cell2AundS);
    table2.addCell(cell2ATitle);
    table2.addCell(cell2Selten);
    table2.addCell(cell2Wechselnd);
    table2.addCell(cell2Ueberwiegend);

    table2 = asVerhalten(table2, aVerhalten, pad);

    PdfPCell cell2KommentarA;
    cell2KommentarA = new PdfPCell(new Paragraph(textArbeit, TINYITALIC_FONT));
    cell2KommentarA.setColspan(4);
    cell2KommentarA.setBorder(Rectangle.LEFT | Rectangle.RIGHT);
    cell2KommentarA.setPadding(pad);
    cell2KommentarA.setHorizontalAlignment(Element.ALIGN_LEFT);
    table2.addCell(cell2KommentarA);

    PdfPCell cell2BewertungA;
    if (vorname.endsWith("s") || vorname.endsWith("x") || vorname.endsWith("z")) {
        cell2BewertungA = new PdfPCell(
                new Phrase(vorname + "' Arbeitsverhalten " + noteArbeitString, NORMAL_FONT));
    } else {
        cell2BewertungA = new PdfPCell(
                new Phrase(vorname + "s Arbeitsverhalten " + noteArbeitString, NORMAL_FONT));
    }
    cell2BewertungA.setColspan(4);
    cell2BewertungA.setVerticalAlignment(Element.ALIGN_MIDDLE);
    //cell2BewertungA.setFixedHeight(45f);
    cell2BewertungA.setPadding(pad);
    cell2BewertungA.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell2BewertungA.setBorder(Rectangle.LEFT | Rectangle.BOTTOM | Rectangle.RIGHT);
    table2.addCell(cell2BewertungA);

    table2.addCell(emptyLine(4, 15f));

    PdfPCell cell2STitle = new PdfPCell(title2(STitle, 1, 50f, pad));

    table2.addCell(cell2STitle);
    table2.addCell(cell2Selten);
    table2.addCell(cell2Wechselnd);
    table2.addCell(cell2Ueberwiegend);

    table2 = asVerhalten(table2, sVerhalten, pad);

    PdfPCell cell2KommentarS;
    cell2KommentarS = new PdfPCell(new Paragraph(textSozial, TINYITALIC_FONT));
    cell2KommentarS.setColspan(4);
    cell2KommentarS.setBorder(Rectangle.LEFT | Rectangle.RIGHT);
    cell2KommentarS.setPadding(pad);
    cell2KommentarS.setHorizontalAlignment(Element.ALIGN_LEFT);
    table2.addCell(cell2KommentarS);

    PdfPCell cell2BewertungS;
    if (vorname.endsWith("s") || vorname.endsWith("x") || vorname.endsWith("z")) {
        cell2BewertungS = new PdfPCell(
                new Phrase(vorname + "' Sozialverhalten " + noteSozialString, NORMAL_FONT));
    } else {
        cell2BewertungS = new PdfPCell(
                new Phrase(vorname + "s Sozialverhalten " + noteSozialString, NORMAL_FONT));
    }
    cell2BewertungS.setColspan(4);
    cell2BewertungS.setVerticalAlignment(Element.ALIGN_MIDDLE);
    //cell2BewertungA.setFixedHeight(45f);
    cell2BewertungS.setPadding(pad);
    cell2BewertungS.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell2BewertungS.setBorder(Rectangle.LEFT | Rectangle.BOTTOM | Rectangle.RIGHT);
    table2.addCell(cell2BewertungS);

    table2.addCell(emptyLine(4, 15f));

    // Tablestruktur aufbauen...
    // Legende...
    PdfPTable table2a = new PdfPTable(4);
    table2a.setWidths(new float[] { 3, 50, 8, 44 });
    table2a.setWidthPercentage(100);

    PdfPCell cell2Erklaerungen;
    Chunk chunk1 = new Chunk(Erklaerungen, NORMAL_FONT);
    chunk1.setUnderline(1.5f, -1);
    cell2Erklaerungen = new PdfPCell((new Phrase(chunk1)));
    cell2Erklaerungen.setColspan(4);
    cell2Erklaerungen.setFixedHeight(20f);
    cell2Erklaerungen.setVerticalAlignment(Element.ALIGN_TOP);
    cell2Erklaerungen.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell2Erklaerungen.setBorder(Rectangle.NO_BORDER);
    table2a.addCell(cell2Erklaerungen);

    PdfPCell cell2BewertungsstufenAS;
    cell2BewertungsstufenAS = new PdfPCell(new Phrase(BewertungsstufenAS, SMALL_BOLD_FONT));
    cell2BewertungsstufenAS.setColspan(2);
    cell2BewertungsstufenAS.setVerticalAlignment(Element.ALIGN_TOP);
    cell2BewertungsstufenAS.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell2BewertungsstufenAS.setBorder(Rectangle.NO_BORDER);
    table2a.addCell(cell2BewertungsstufenAS);

    PdfPCell cell2Symbole;
    cell2Symbole = new PdfPCell(new Phrase(Symbole, SMALL_BOLD_FONT));
    cell2Symbole.setColspan(2);
    cell2Symbole.setVerticalAlignment(Element.ALIGN_TOP);
    cell2Symbole.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell2Symbole.setBorder(Rectangle.NO_BORDER);
    table2a.addCell(cell2Symbole);

    float height = 20.0f;
    PdfPCell cell2Bewertungsstufen1;
    PdfPCell cell2Item;

    cell2Item = new PdfPCell(new Phrase(""));
    cell2Bewertungsstufen1 = new PdfPCell(new Phrase("\"" + asBewertungen[0] + "\"", SMALL_FONT));
    //cell2Bewertungsstufen1.setColspan(2);
    cell2Bewertungsstufen1.setMinimumHeight(height);
    cell2Bewertungsstufen1.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell2Bewertungsstufen1.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell2Bewertungsstufen1.setBorder(Rectangle.NO_BORDER);
    cell2Item.setBorder(Rectangle.NO_BORDER);
    table2a.addCell(cell2Item);
    table2a.addCell(cell2Bewertungsstufen1);

    //        PdfPCell cell2Sym0img;
    //        cell2Sym0img = new PdfPCell(new Phrase("--",SMALL_FONT));
    //        //cell2Bewertungsstufen1.setColspan(1);
    //        cell2Sym0img.setVerticalAlignment(Element.ALIGN_MIDDLE);
    //        cell2Sym0img.setHorizontalAlignment(Element.ALIGN_RIGHT);
    //        cell2Sym0img.setBorder(Rectangle.NO_BORDER);
    //        table2a.addCell(cell2Sym0img);

    table2a.addCell(kreisViertel(0, pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.NO_BORDER));

    PdfPCell cell2Sym0;
    cell2Sym0 = new PdfPCell(new Phrase(Sym0, SMALL_FONT));
    //cell2Bewertungsstufen1.setColspan(1);
    cell2Sym0.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell2Sym0.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell2Sym0.setBorder(Rectangle.NO_BORDER);
    table2a.addCell(cell2Sym0);

    PdfPCell cell2Bewertungsstufen2;
    cell2Bewertungsstufen2 = new PdfPCell(new Phrase("\"" + asBewertungen[1] + "\"", SMALL_FONT));
    //cell2Bewertungsstufen2.setColspan(2);
    cell2Bewertungsstufen2.setMinimumHeight(height);
    cell2Bewertungsstufen2.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell2Bewertungsstufen2.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell2Bewertungsstufen2.setBorder(Rectangle.NO_BORDER);
    cell2Item.setBorder(Rectangle.NO_BORDER);
    table2a.addCell(cell2Item);
    table2a.addCell(cell2Bewertungsstufen2);

    table2a.addCell(kreisViertel(1, pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.NO_BORDER));

    PdfPCell cell2Sym1;
    cell2Sym1 = new PdfPCell(new Phrase(Sym1, SMALL_FONT));
    //cell2Bewertungsstufen1.setColspan(1);
    cell2Sym1.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell2Sym1.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell2Sym1.setBorder(Rectangle.NO_BORDER);
    table2a.addCell(cell2Sym1);

    PdfPCell cell2Bewertungsstufen3;
    cell2Bewertungsstufen3 = new PdfPCell(new Phrase("\"" + asBewertungen[2] + "\"", SMALL_FONT));
    //cell2Bewertungsstufen3.setColspan(2);
    cell2Bewertungsstufen3.setMinimumHeight(height);
    cell2Bewertungsstufen3.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell2Bewertungsstufen3.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell2Bewertungsstufen3.setBorder(Rectangle.NO_BORDER);
    table2a.addCell(cell2Item);
    table2a.addCell(cell2Bewertungsstufen3);

    table2a.addCell(kreisViertel(2, pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.NO_BORDER));

    PdfPCell cell2Sym2;
    cell2Sym2 = new PdfPCell(new Phrase(Sym2, SMALL_FONT));
    //cell2Bewertungsstufen1.setColspan(1);
    cell2Sym2.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell2Sym2.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell2Sym2.setBorder(Rectangle.NO_BORDER);
    table2a.addCell(cell2Sym2);

    PdfPCell cell2Bewertungsstufen4;
    cell2Bewertungsstufen4 = new PdfPCell(new Phrase("\"" + asBewertungen[3] + "\"", SMALL_FONT));
    //cell2Bewertungsstufen4.setColspan(2);
    cell2Bewertungsstufen4.setMinimumHeight(height);
    cell2Bewertungsstufen4.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell2Bewertungsstufen4.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell2Bewertungsstufen4.setBorder(Rectangle.NO_BORDER);
    table2a.addCell(cell2Item);
    table2a.addCell(cell2Bewertungsstufen4);

    table2a.addCell(kreisViertel(3, pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.NO_BORDER));

    PdfPCell cell2Sym3;
    cell2Sym3 = new PdfPCell(new Phrase(Sym3, SMALL_FONT));
    //cell2Bewertungsstufen1.setColspan(1);
    cell2Sym3.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell2Sym3.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell2Sym3.setBorder(Rectangle.NO_BORDER);
    table2a.addCell(cell2Sym3);

    PdfPCell cell2Bewertungsstufen5;
    cell2Bewertungsstufen5 = new PdfPCell(new Phrase("\"" + asBewertungen[4] + "\"", SMALL_FONT));
    //cell2Bewertungsstufen5.setColspan(2);
    cell2Bewertungsstufen5.setMinimumHeight(height);
    cell2Bewertungsstufen5.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell2Bewertungsstufen5.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell2Bewertungsstufen5.setBorder(Rectangle.NO_BORDER);
    table2a.addCell(cell2Item);
    table2a.addCell(cell2Bewertungsstufen5);

    table2a.addCell(kreisViertel(4, pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.NO_BORDER));

    PdfPCell cell2Sym4;
    cell2Sym4 = new PdfPCell(new Phrase(Sym4, SMALL_FONT));
    //cell2Bewertungsstufen1.setColspan(1);
    cell2Sym4.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell2Sym4.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell2Sym4.setBorder(Rectangle.NO_BORDER);
    table2a.addCell(cell2Sym4);

    doc.add(table2);
    doc.add(table2a);

    doc.newPage();

    // Seite 3 *************************************************************
    // Tablestruktur aufbauen...
    pad = 3f;
    PdfPTable table3 = new PdfPTable(6);
    table3.setWidths(new float[] { 60, 8, 8, 8, 8, 8 });
    table3.setWidthPercentage(100);

    PdfPCell cell3Header = emptyLine(6, 10f);
    PdfPCell cell3Deutsch;
    cell3Deutsch = new PdfPCell(new Phrase(deutschS + jStufe, NORMAL_BOLD_FONT));
    cell3Deutsch.setColspan(6);
    cell3Deutsch.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell3Deutsch.setFixedHeight(35f);
    cell3Deutsch.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell3Deutsch.setBorder(Rectangle.NO_BORDER);

    // Sprechen und Zuhren 
    PdfPCell cell3sz;
    cell3sz = new PdfPCell(new Phrase(sz, NORMAL_FONT));
    //cell2ATitle.setColspan(4);
    cell3sz.setVerticalAlignment(Element.ALIGN_TOP);
    cell3sz.setFixedHeight(50f);
    cell3sz.setPadding(pad);
    cell3sz.setHorizontalAlignment(Element.ALIGN_LEFT);
    //cell2ATitle.setBorder(Rectangle.NO_BORDER);

    PdfPCell cell3Leer;
    //        cell3Leer = new PdfPCell(new Phrase("--",TINY_FONT));
    cell3Leer = new PdfPCell(kreisViertel(0, pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.BOX));
    //cell2ATitle.setColspan(4);
    cell3Leer.setVerticalAlignment(Element.ALIGN_MIDDLE);
    //cell2ATitle.setFixedHeight(30f);
    cell3Leer.setPadding(pad);
    cell3Leer.setHorizontalAlignment(Element.ALIGN_CENTER);
    //cell2ATitle.setBorder(Rectangle.NO_BORDER);

    table3.addCell(cell3Header);
    table3.addCell(cell3Deutsch);
    table3.addCell(cell3sz);
    table3.addCell(cell3Leer);
    table3.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table3.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table3.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table3.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

    table3 = lernbereiche(table3, sprechenZL, pad);

    // Schreiben 
    PdfPCell cell3EmptyLine;
    cell3EmptyLine = new PdfPCell(new Phrase("", NORMAL_BOLD_FONT));
    cell3EmptyLine.setColspan(6);
    cell3EmptyLine.setFixedHeight(15f);
    cell3EmptyLine.setBorder(Rectangle.NO_BORDER);

    cell3sz = new PdfPCell(new Phrase(sch, NORMAL_FONT));
    cell3sz.setVerticalAlignment(Element.ALIGN_TOP);
    cell3sz.setFixedHeight(50f);
    cell3sz.setPadding(pad);
    cell3sz.setHorizontalAlignment(Element.ALIGN_LEFT);

    //        cell3Leer = new PdfPCell(new Phrase("--",TINY_FONT));
    cell3Leer = new PdfPCell(kreisViertel(0, pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.BOX));
    cell3Leer.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell3Leer.setPadding(pad);
    cell3Leer.setHorizontalAlignment(Element.ALIGN_CENTER);

    table3.addCell(cell3EmptyLine);
    table3.addCell(cell3sz);
    table3.addCell(cell3Leer);
    table3.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table3.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table3.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table3.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

    table3 = lernbereiche(table3, schreibenZL, pad);

    // Lesen - mit Texten und Medien umgehen
    cell3EmptyLine = new PdfPCell(new Phrase("", NORMAL_BOLD_FONT));
    cell3EmptyLine.setColspan(6);
    cell3EmptyLine.setFixedHeight(15f);
    cell3EmptyLine.setBorder(Rectangle.NO_BORDER);

    cell3sz = new PdfPCell(new Phrase(les, NORMAL_FONT));
    cell3sz.setVerticalAlignment(Element.ALIGN_TOP);
    cell3sz.setFixedHeight(50f);
    cell3sz.setPadding(pad);
    cell3sz.setHorizontalAlignment(Element.ALIGN_LEFT);

    //        cell3Leer = new PdfPCell(new Phrase("--",TINY_FONT));
    cell3Leer = new PdfPCell(kreisViertel(0, pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.BOX));
    cell3Leer.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell3Leer.setPadding(pad);
    cell3Leer.setHorizontalAlignment(Element.ALIGN_CENTER);

    table3.addCell(cell3EmptyLine);
    table3.addCell(cell3sz);
    table3.addCell(cell3Leer);
    table3.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table3.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table3.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table3.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

    table3 = lernbereiche(table3, lesenZL, pad);

    // Sprache und Sprachgebrauch untersuchen
    cell3EmptyLine = new PdfPCell(new Phrase("", NORMAL_BOLD_FONT));
    cell3EmptyLine.setColspan(6);
    cell3EmptyLine.setFixedHeight(15f);
    cell3EmptyLine.setBorder(Rectangle.NO_BORDER);

    cell3sz = new PdfPCell(new Phrase(sp, NORMAL_FONT));
    cell3sz.setVerticalAlignment(Element.ALIGN_TOP);
    cell3sz.setFixedHeight(50f);
    cell3sz.setPadding(pad);
    cell3sz.setHorizontalAlignment(Element.ALIGN_LEFT);

    //        cell3Leer = new PdfPCell(new Phrase("--",TINY_FONT));
    cell3Leer = new PdfPCell(kreisViertel(0, pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.BOX));
    cell3Leer.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell3Leer.setPadding(pad);
    cell3Leer.setHorizontalAlignment(Element.ALIGN_CENTER);

    table3.addCell(cell3EmptyLine);
    table3.addCell(cell3sz);
    table3.addCell(cell3Leer);
    table3.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table3.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table3.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table3.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

    table3 = lernbereiche(table3, sprachZL, pad);

    doc.add(table3);
    doc.newPage();

    // Seite 4 *************************************************************
    // Tablestruktur aufbauen...
    pad = 3f;
    PdfPTable table4 = new PdfPTable(6);
    table4.setWidths(new float[] { 60, 8, 8, 8, 8, 8 });
    table4.setWidthPercentage(100);

    PdfPCell cell4Header = emptyLine(6, 10f);

    PdfPCell cell4Mathe;
    cell4Mathe = new PdfPCell(new Phrase(matheS + jStufe, NORMAL_BOLD_FONT));
    cell4Mathe.setColspan(6);
    cell4Mathe.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell4Mathe.setFixedHeight(35f);
    cell4Mathe.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell4Mathe.setBorder(Rectangle.NO_BORDER);

    // Zahlen und Operationen 
    PdfPCell cell4zo;
    cell4zo = new PdfPCell(new Phrase(zo, NORMAL_FONT));
    //cell2ATitle.setColspan(4);
    cell4zo.setVerticalAlignment(Element.ALIGN_TOP);
    cell4zo.setFixedHeight(50f);
    cell4zo.setPadding(pad);
    cell4zo.setHorizontalAlignment(Element.ALIGN_LEFT);
    //cell2ATitle.setBorder(Rectangle.NO_BORDER);

    PdfPCell cell4Leer;
    //        cell4Leer = new PdfPCell(new Phrase("--",TINY_FONT));
    cell4Leer = new PdfPCell(kreisViertel(0, pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.BOX));
    //cell2ATitle.setColspan(4);
    cell4Leer.setVerticalAlignment(Element.ALIGN_MIDDLE);
    //cell2ATitle.setFixedHeight(30f);
    cell4Leer.setPadding(pad);
    cell4Leer.setHorizontalAlignment(Element.ALIGN_CENTER);
    //cell2ATitle.setBorder(Rectangle.NO_BORDER);

    table4.addCell(cell4Header);
    table4.addCell(cell4Mathe);
    table4.addCell(cell4zo);
    table4.addCell(cell4Leer);
    table4.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table4.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table4.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table4.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

    table4 = lernbereiche(table4, zahlenZL, pad);

    PdfPCell cell4EmptyLine;
    cell4EmptyLine = new PdfPCell(new Phrase("", NORMAL_BOLD_FONT));
    cell4EmptyLine.setColspan(6);
    cell4EmptyLine.setFixedHeight(15f);
    cell4EmptyLine.setBorder(Rectangle.NO_BORDER);

    // Gren und Messen
    PdfPCell cell4gm;
    cell4gm = new PdfPCell(new Phrase(gm, NORMAL_FONT));
    //cell2ATitle.setColspan(4);
    cell4gm.setVerticalAlignment(Element.ALIGN_TOP);
    cell4gm.setFixedHeight(50f);
    cell4gm.setPadding(pad);
    cell4gm.setHorizontalAlignment(Element.ALIGN_LEFT);
    //cell2ATitle.setBorder(Rectangle.NO_BORDER);

    //        cell4Leer = new PdfPCell(new Phrase("--",TINY_FONT));
    cell4Leer = new PdfPCell(kreisViertel(0, pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.BOX));
    cell4Leer.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell4Leer.setPadding(pad);
    cell4Leer.setHorizontalAlignment(Element.ALIGN_CENTER);

    table4.addCell(cell4EmptyLine);
    table4.addCell(cell4gm);
    table4.addCell(cell4Leer);
    table4.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table4.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table4.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table4.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

    table4 = lernbereiche(table4, groessenZL, pad);

    // Raum und Form

    PdfPCell cell4rf;
    cell4rf = new PdfPCell(new Phrase(rf, NORMAL_FONT));
    cell4rf.setVerticalAlignment(Element.ALIGN_TOP);
    cell4rf.setFixedHeight(50f);
    cell4rf.setPadding(pad);
    cell4rf.setHorizontalAlignment(Element.ALIGN_LEFT);

    //        cell4Leer = new PdfPCell(new Phrase("--",TINY_FONT));
    cell4Leer = new PdfPCell(kreisViertel(0, pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.BOX));
    cell4Leer.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell4Leer.setPadding(pad);
    cell4Leer.setHorizontalAlignment(Element.ALIGN_CENTER);

    table4.addCell(emptyLine(6, 15f));
    table4.addCell(cell4rf);
    table4.addCell(cell4Leer);
    table4.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table4.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table4.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
    table4.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

    table4 = lernbereiche(table4, raumZL, pad);

    doc.add(table4);
    doc.newPage();

    // *****************************************************************************************************
    if (Gui.getSClass().substring(0, 1).endsWith("1") || Gui.getSClass().substring(0, 1).endsWith("2")) {

        // Seite 5 *************************************************************
        // Tablestruktur aufbauen...
        pad = 3f;
        PdfPTable table5 = new PdfPTable(6);
        table5.setWidths(new float[] { 60, 8, 8, 8, 8, 8 });
        table5.setWidthPercentage(100);

        PdfPCell cell5Header = emptyLine(6, 10f);

        // *********************************************************************
        // Sachunterricht
        // *********************************************************************
        PdfPCell cell5Sachunterricht;
        cell5Sachunterricht = new PdfPCell(new Phrase(sachunterrichtS + jStufe, NORMAL_BOLD_FONT));
        cell5Sachunterricht.setColspan(6);
        cell5Sachunterricht.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell5Sachunterricht.setFixedHeight(35f);
        cell5Sachunterricht.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell5Sachunterricht.setBorder(Rectangle.NO_BORDER);

        PdfPCell cell5su;
        cell5su = new PdfPCell(new Phrase(su, NORMAL_FONT));
        cell5su.setVerticalAlignment(Element.ALIGN_TOP);
        cell5su.setFixedHeight(30f);
        cell5su.setPadding(pad);
        cell5su.setHorizontalAlignment(Element.ALIGN_LEFT);

        PdfPCell cell5Leer;
        cell5Leer = new PdfPCell(kreisViertel(0, pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.BOX));
        cell5Leer.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell5Leer.setPadding(pad);
        cell5Leer.setHorizontalAlignment(Element.ALIGN_CENTER);

        table5.addCell(cell5Header);
        table5.addCell(cell5Sachunterricht);
        table5.addCell(cell5su);
        table5.addCell(cell5Leer);
        table5.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

        table5 = lernbereiche(table5, sachunterrichtZL, pad);

        table5.addCell(emptyLine(6, 15f));

        // *********************************************************************
        // Sport
        // *********************************************************************
        PdfPCell cell5Sport;
        cell5Sport = new PdfPCell(new Phrase(sportS + jStufe, NORMAL_BOLD_FONT));
        cell5Sport.setColspan(6);
        cell5Sport.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell5Sport.setFixedHeight(35f);
        cell5Sport.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell5Sport.setBorder(Rectangle.NO_BORDER);

        table5.addCell(cell5Sport);
        table5.addCell(cell5su);
        table5.addCell(cell5Leer);
        table5.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

        table5 = lernbereiche(table5, sportZL, pad);

        table5.addCell(emptyLine(6, 15f));

        // *********************************************************************
        // Religion
        // *********************************************************************
        PdfPCell cell5Religion;
        cell5Religion = new PdfPCell(new Phrase(religionS + jStufe, NORMAL_BOLD_FONT));
        cell5Religion.setColspan(6);
        cell5Religion.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell5Religion.setFixedHeight(35f);
        cell5Religion.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell5Religion.setBorder(Rectangle.NO_BORDER);

        cell5su = new PdfPCell(new Phrase(su, NORMAL_FONT));
        cell5su.setVerticalAlignment(Element.ALIGN_TOP);
        cell5su.setFixedHeight(30f);
        cell5su.setPadding(pad);
        cell5su.setHorizontalAlignment(Element.ALIGN_LEFT);

        cell5Leer = new PdfPCell(kreisViertel(0, pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.BOX));
        cell5Leer.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell5Leer.setPadding(pad);
        cell5Leer.setHorizontalAlignment(Element.ALIGN_CENTER);

        table5.addCell(cell5Religion);
        table5.addCell(cell5su);
        table5.addCell(cell5Leer);
        table5.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

        table5 = lernbereiche(table5, religionZL, pad);

        table5.addCell(emptyLine(6, 15f));

        // *********************************************************************
        // Musik
        // *********************************************************************
        PdfPCell cell5Musik;
        cell5Musik = new PdfPCell(new Phrase(musikS + jStufe, NORMAL_BOLD_FONT));
        cell5Musik.setColspan(6);
        cell5Musik.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell5Musik.setFixedHeight(35f);
        cell5Musik.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell5Musik.setBorder(Rectangle.NO_BORDER);

        cell5su = new PdfPCell(new Phrase(su, NORMAL_FONT));
        cell5su.setVerticalAlignment(Element.ALIGN_TOP);
        cell5su.setFixedHeight(30f);
        cell5su.setPadding(pad);
        cell5su.setHorizontalAlignment(Element.ALIGN_LEFT);

        cell5Leer = new PdfPCell(kreisViertel(0, pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.BOX));
        cell5Leer.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell5Leer.setPadding(pad);
        cell5Leer.setHorizontalAlignment(Element.ALIGN_CENTER);

        table5.addCell(cell5Musik);
        table5.addCell(cell5su);
        table5.addCell(cell5Leer);
        table5.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

        table5 = lernbereiche(table5, musikZL, pad);

        table5.addCell(emptyLine(6, 15f));

        // *********************************************************************
        // Kunst
        // *********************************************************************
        PdfPCell cell5Kunst;
        cell5Kunst = new PdfPCell(new Phrase(kunstS + jStufe, NORMAL_BOLD_FONT));
        cell5Kunst.setColspan(6);
        cell5Kunst.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell5Kunst.setFixedHeight(35f);
        cell5Kunst.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell5Kunst.setBorder(Rectangle.NO_BORDER);

        table5.addCell(cell5Kunst);
        table5.addCell(cell5su);
        table5.addCell(cell5Leer);
        table5.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

        table5 = lernbereiche(table5, kunstZL, pad);

        table5.addCell(emptyLine(6, 15f));

        doc.add(table5); // Ende Seite 5 fr 1. und 2. Klasse
    } else { // Anfang Seite 5 fr 3. und 4. Klasse
        // Seite 5a *************************************************************
        doc.newPage(); // Tablestruktur aufbauen...
        pad = 3f;
        PdfPTable table5a = new PdfPTable(6);
        table5a.setWidths(new float[] { 60, 8, 8, 8, 8, 8 });
        table5a.setWidthPercentage(100);

        PdfPCell cell5Header = emptyLine(6, 10f);

        // *********************************************************************
        // Sachunterricht
        // *********************************************************************
        PdfPCell cell5Sachunterricht;
        cell5Sachunterricht = new PdfPCell(new Phrase(sachunterrichtS + jStufe, NORMAL_BOLD_FONT));
        cell5Sachunterricht.setColspan(6);
        cell5Sachunterricht.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell5Sachunterricht.setFixedHeight(35f);
        cell5Sachunterricht.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell5Sachunterricht.setBorder(Rectangle.NO_BORDER);

        PdfPCell cell5su;
        cell5su = new PdfPCell(new Phrase(su, NORMAL_FONT));
        cell5su.setVerticalAlignment(Element.ALIGN_TOP);
        cell5su.setFixedHeight(30f);
        cell5su.setPadding(pad);
        cell5su.setHorizontalAlignment(Element.ALIGN_LEFT);

        PdfPCell cell5Leer;
        cell5Leer = new PdfPCell(kreisViertel(0, pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.BOX));
        cell5Leer.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell5Leer.setPadding(pad);
        cell5Leer.setHorizontalAlignment(Element.ALIGN_CENTER);

        table5a.addCell(cell5Header);
        table5a.addCell(cell5Sachunterricht);
        table5a.addCell(cell5su);
        table5a.addCell(cell5Leer);
        table5a.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5a.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5a.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5a.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

        table5a = lernbereiche(table5a, sachunterrichtZL, pad);

        table5a.addCell(emptyLine(6, 15f));

        // *********************************************************************
        // Englisch
        // *********************************************************************
        PdfPCell cell5Englisch;
        cell5Englisch = new PdfPCell(new Phrase(englischS + jStufe, NORMAL_BOLD_FONT));
        cell5Englisch.setColspan(6);
        cell5Englisch.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell5Englisch.setFixedHeight(35f);
        cell5Englisch.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell5Englisch.setBorder(Rectangle.NO_BORDER);

        table5a.addCell(cell5Englisch);
        table5a.addCell(cell5su);
        table5a.addCell(cell5Leer);
        table5a.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5a.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5a.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5a.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

        table5a = lernbereiche(table5a, englischZL, pad);

        table5a.addCell(emptyLine(6, 15f));

        // *********************************************************************
        // Sport
        // *********************************************************************
        PdfPCell cell5Sport;
        cell5Sport = new PdfPCell(new Phrase(sportS + jStufe, NORMAL_BOLD_FONT));
        cell5Sport.setColspan(6);
        cell5Sport.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell5Sport.setFixedHeight(35f);
        cell5Sport.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell5Sport.setBorder(Rectangle.NO_BORDER);

        table5a.addCell(cell5Sport);
        table5a.addCell(cell5su);
        table5a.addCell(cell5Leer);
        table5a.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5a.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5a.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table5a.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

        table5a = lernbereiche(table5a, sportZL, pad);

        table5a.addCell(emptyLine(6, 15f));

        doc.add(table5a);

        // Seite 6 *************************************************************
        doc.newPage();
        // Tablestruktur aufbauen...
        PdfPTable table6 = new PdfPTable(6);
        pad = 3f;
        table6.setWidths(new float[] { 60, 8, 8, 8, 8, 8 });
        table6.setWidthPercentage(100);

        PdfPCell cell6Header = emptyLine(6, 10f);

        // *********************************************************************
        // Religion
        // *********************************************************************
        PdfPCell cell6Religion;
        cell6Religion = new PdfPCell(new Phrase(religionS + jStufe, NORMAL_BOLD_FONT));
        cell6Religion.setColspan(6);
        cell6Religion.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell6Religion.setFixedHeight(35f);
        cell6Religion.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell6Religion.setBorder(Rectangle.NO_BORDER);

        PdfPCell cell6su;
        cell6su = new PdfPCell(new Phrase(su, NORMAL_FONT));
        cell6su.setVerticalAlignment(Element.ALIGN_TOP);
        cell6su.setFixedHeight(30f);
        cell6su.setPadding(pad);
        cell6su.setHorizontalAlignment(Element.ALIGN_LEFT);

        PdfPCell cell6Leer;
        cell6Leer = new PdfPCell(kreisViertel(0, pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.BOX));
        cell6Leer.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell6Leer.setPadding(pad);
        cell6Leer.setHorizontalAlignment(Element.ALIGN_CENTER);

        table6.addCell(cell6Religion);
        table6.addCell(cell6su);
        table6.addCell(cell6Leer);
        table6.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table6.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table6.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table6.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

        table6 = lernbereiche(table6, religionZL, pad);

        table6.addCell(emptyLine(6, 15f));

        // *********************************************************************
        // Musik
        // *********************************************************************
        PdfPCell cell6Musik;
        cell6Musik = new PdfPCell(new Phrase(musikS + jStufe, NORMAL_BOLD_FONT));
        cell6Musik.setColspan(6);
        cell6Musik.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell6Musik.setFixedHeight(35f);
        cell6Musik.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell6Musik.setBorder(Rectangle.NO_BORDER);

        cell6su = new PdfPCell(new Phrase(su, NORMAL_FONT));
        cell6su.setVerticalAlignment(Element.ALIGN_TOP);
        cell6su.setFixedHeight(30f);
        cell6su.setPadding(pad);
        cell6su.setHorizontalAlignment(Element.ALIGN_LEFT);

        cell6Leer = new PdfPCell(kreisViertel(0, pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.BOX));
        cell6Leer.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell6Leer.setPadding(pad);
        cell6Leer.setHorizontalAlignment(Element.ALIGN_CENTER);

        table6.addCell(cell6Musik);
        table6.addCell(cell6su);
        table6.addCell(cell6Leer);
        table6.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table6.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table6.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table6.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

        table6 = lernbereiche(table6, musikZL, pad);

        table6.addCell(emptyLine(6, 15f));

        // *********************************************************************
        // Kunst
        // *********************************************************************
        PdfPCell cell6Kunst;
        cell6Kunst = new PdfPCell(new Phrase(kunstS + jStufe, NORMAL_BOLD_FONT));
        cell6Kunst.setColspan(6);
        cell6Kunst.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell6Kunst.setFixedHeight(35f);
        cell6Kunst.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell6Kunst.setBorder(Rectangle.NO_BORDER);

        table6.addCell(cell6Kunst);
        table6.addCell(cell6su);
        table6.addCell(cell6Leer);
        table6.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table6.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table6.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table6.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

        table6 = lernbereiche(table6, kunstZL, pad);

        table6.addCell(emptyLine(6, 15f));

        doc.add(table6);
        // Seite 7 *************************************************************
        doc.newPage();
        // Tablestruktur aufbauen...
        PdfPTable table7 = new PdfPTable(6);
        pad = 3f;
        table7.setWidths(new float[] { 60, 8, 8, 8, 8, 8 });
        table7.setWidthPercentage(100);

        PdfPCell cell7Header = emptyLine(6, 10f);

        table7.addCell(cell7Header);

        PdfPCell cell7su;
        cell7su = new PdfPCell(new Phrase(su, NORMAL_FONT));
        cell7su.setVerticalAlignment(Element.ALIGN_TOP);
        cell7su.setFixedHeight(30f);
        cell7su.setPadding(pad);
        cell7su.setHorizontalAlignment(Element.ALIGN_LEFT);

        PdfPCell cell7Leer;
        cell7Leer = new PdfPCell(kreisViertel(0, pad, Element.ALIGN_RIGHT, Element.ALIGN_TOP, Rectangle.BOX));
        cell7Leer.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell7Leer.setPadding(pad);
        cell7Leer.setHorizontalAlignment(Element.ALIGN_CENTER);

        // *********************************************************************
        // Textil
        // *********************************************************************
        PdfPCell cell7Textil;
        cell7Textil = new PdfPCell(new Phrase(textilS + jStufe, NORMAL_BOLD_FONT));
        cell7Textil.setColspan(6);
        cell7Textil.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell7Textil.setFixedHeight(35f);
        cell7Textil.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell7Textil.setBorder(Rectangle.NO_BORDER);

        table7.addCell(cell7Textil);
        table7.addCell(cell7su);
        table7.addCell(cell7Leer);
        table7.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table7.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table7.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table7.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

        table7 = lernbereiche(table7, textilZL, pad);

        table7.addCell(emptyLine(6, 15f));

        // *********************************************************************
        // Werken
        // *********************************************************************
        PdfPCell cell7Werken;
        cell7Werken = new PdfPCell(new Phrase(werkenS + jStufe, NORMAL_BOLD_FONT));
        cell7Werken.setColspan(6);
        cell7Werken.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell7Werken.setFixedHeight(35f);
        cell7Werken.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell7Werken.setBorder(Rectangle.NO_BORDER);

        table7.addCell(cell7Werken);
        table7.addCell(cell7su);
        table7.addCell(cell7Leer);
        table7.addCell(kreisViertel(1, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table7.addCell(kreisViertel(2, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table7.addCell(kreisViertel(3, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));
        table7.addCell(kreisViertel(4, pad, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, Rectangle.BOX));

        table7 = lernbereiche(table7, werkenZL, pad);

        table7.addCell(emptyLine(6, 15f));

        doc.add(table7);
    }
    doc.addTitle("Zeugnis");
    doc.addAuthor("Grundschule Brelingen");
    doc.addCreationDate();
    doc.addSubject("Zeugnis");
    doc.close();
    writer.close();
}