header2.add(new LineSeparator((float) 0.8, 100, BaseColor.BLACK, Element.ALIGN_CENTER, 12));
Paragraph adresse = new Paragraph();
//adresse.add(new Paragraph(" ", new Font(Font.FontFamily.TIMES_ROMAN, 8)));
float[] relSize = {3, 2};
PdfPTable table = new PdfPTable(relSize);
table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
table.setWidthPercentage(100);
Font adressFont = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL);
table.addCell("");
table.addCell("");
table.addCell("");
table.addCell(new Phrase("Matthias M�ller Computerservice", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)));
table.addCell("");
table.addCell(new Phrase("Rheingoldstr. 38a", adressFont));
table.addCell(anrede);
table.addCell(new Phrase("56329 St. Goar", adressFont));
table.addCell(vorname+" "+nachname);
table.addCell("");
table.addCell(strasse);
table.addCell(new Phrase("Telefon: 0 67 41 / 20 74 06", adressFont));
table.addCell(plz+" "+ort);
table.addCell(new Phrase("Mobil: 01 52 / 09 80 91 92", adressFont));
table.addCell("");
//Mail
Phrase adressPh = new Phrase();
adressPh.add(new Chunk("E-Mail: ", adressFont));
Anchor emailLink = new Anchor("kontakt@muellerpc.de", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.UNDERLINE, new BaseColor(Color.BLUE)));
emailLink.setReference("mailto:kontakt@muellerpc.de");
adressPh.add(emailLink);
table.addCell(adressPh);
table.addCell("");
table.addCell("");
table.addCell("");
table.addCell(new Phrase("Datum: "+adressDate.format(date)+"", adressFont));
adresse.add(table);
Paragraph main = new Paragraph();
main.add(new Paragraph(" "));
main.add(new Paragraph("Gehaltsabrechnung "+monat.format(date), new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)));
//anfang main
float[] relSizeMain = {1,1,1,1,1};
PdfPTable tableMain = new PdfPTable(relSizeMain);
tableMain.getDefaultCell().setBorder(Rectangle.BOX);
PdfPCell cH1 = new PdfPCell(new Phrase("Krankenkasse", mainBigFont));
cH1.setHorizontalAlignment(Element.ALIGN_CENTER);
tableMain.addCell(cH1);
PdfPCell cH2 = new PdfPCell(new Phrase("Bundesland", mainBigFont));
cH2.setHorizontalAlignment(Element.ALIGN_CENTER);
tableMain.addCell(cH2);
PdfPCell cH3 = new PdfPCell(new Phrase("Religion", mainBigFont));
cH3.setHorizontalAlignment(Element.ALIGN_CENTER);
tableMain.addCell(cH3);
PdfPCell cH4 = new PdfPCell(new Phrase("Geb. Datum", mainBigFont));
cH4.setHorizontalAlignment(Element.ALIGN_CENTER);
tableMain.addCell(cH4);
PdfPCell cH5 = new PdfPCell(new Phrase("Kinder", mainBigFont));
cH5.setHorizontalAlignment(Element.ALIGN_CENTER);
tableMain.addCell(cH5);
tableMain.setHeaderRows(1);
tableMain.addCell(krankenkasse);
tableMain.addCell(bundesland);
tableMain.addCell(religion);
tableMain.addCell(abrechnDate.format(gebDate));
tableMain.addCell(""+kinder);
float[] relSizeMainGehalt = {12,3,8,8};
PdfPTable tableMainGehalt = new PdfPTable(relSizeMainGehalt);
tableMainGehalt.getDefaultCell().setBorder(Rectangle.BOX);
PdfPCell cA1 = new PdfPCell(new Phrase("Ab-/Bez�ge", mainBigFont));
cA1.setHorizontalAlignment(Element.ALIGN_CENTER);
tableMainGehalt.addCell(cA1);
PdfPCell cA2 = new PdfPCell(new Phrase("%", mainBigFont));
cA2.setHorizontalAlignment(Element.ALIGN_CENTER);
tableMainGehalt.addCell(cA2);
PdfPCell cA3 = new PdfPCell(new Phrase("Teilbetr�ge", mainBigFont));
cA3.setHorizontalAlignment(Element.ALIGN_CENTER);
tableMainGehalt.addCell(cA3);
PdfPCell cA4 = new PdfPCell(new Phrase("Gesamtbetrag", mainBigFont));
cA4.setHorizontalAlignment(Element.ALIGN_CENTER);
tableMainGehalt.addCell(cA4);
tableMainGehalt.setHeaderRows(1);
tableMainGehalt.addCell("Bruttogehalt");
tableMainGehalt.addCell("");
PdfPCell c = new PdfPCell(new Phrase(df.format(bruttogehalt)));
c.setHorizontalAlignment(Element.ALIGN_RIGHT);
tableMainGehalt.addCell(c);
tableMainGehalt.addCell("");
tableMainGehalt.addCell("+ Sonstige Bez�ge");
tableMainGehalt.addCell("");
c = new PdfPCell(new Phrase(df.format(sonstBezug)));
c.setHorizontalAlignment(Element.ALIGN_RIGHT);
tableMainGehalt.addCell(c);
tableMainGehalt.addCell("");
tableMainGehalt.addCell("- Sonstige Abz�ge");
tableMainGehalt.addCell("");
c = new PdfPCell(new Phrase(df.format(sonstAbzug)));
c.setHorizontalAlignment(Element.ALIGN_RIGHT);
tableMainGehalt.addCell(c);
tableMainGehalt.addCell("");
PdfPCell c6 = new PdfPCell(new Phrase("= Zu versteuerndes Einkommen"));
c6.setBorderWidthBottom(1);
tableMainGehalt.addCell(c6);
PdfPCell c7 = new PdfPCell(new Phrase(""));
c7.setBorderWidthRight(0);
c7.setBorderWidthLeft(0);
c7.setBorderWidthBottom(1);
tableMainGehalt.addCell(c7);
PdfPCell c8 = new PdfPCell(new Phrase(""));
c8.setBorderWidthRight(0);
c8.setBorderWidthBottom(1);
tableMainGehalt.addCell(c8);
PdfPCell c9 = new PdfPCell(new Phrase(df.format(zuVersteuerndesEinkommen)));
c9.setBorderWidthBottom(1);
c9.setHorizontalAlignment(Element.ALIGN_RIGHT);
tableMainGehalt.addCell(c9);
tableMainGehalt.addCell("- Lohnsteuer");
tableMainGehalt.addCell("");
c = new PdfPCell(new Phrase(df.format(lohnsteuer)));
c.setHorizontalAlignment(Element.ALIGN_RIGHT);
tableMainGehalt.addCell(c);
tableMainGehalt.addCell("");
tableMainGehalt.addCell("- Kirchensteuer");
c = new PdfPCell(new Phrase(pf.format(prozentKirchensteuer)+" %"));
c.setHorizontalAlignment(Element.ALIGN_RIGHT);
tableMainGehalt.addCell(c);
c = new PdfPCell(new Phrase(df.format(kirchensteuer)));
c.setHorizontalAlignment(Element.ALIGN_RIGHT);
tableMainGehalt.addCell(c);
tableMainGehalt.addCell("");
tableMainGehalt.addCell("- Solidarit�tszuschlag");
tableMainGehalt.addCell("");
c = new PdfPCell(new Phrase(df.format(soli)));
c.setHorizontalAlignment(Element.ALIGN_RIGHT);
tableMainGehalt.addCell(c);
tableMainGehalt.addCell("");
PdfPCell c10 = new PdfPCell(new Phrase("= Zu Gesamte Steuerabz�ge"));
c10.setBorderWidthBottom(1);
tableMainGehalt.addCell(c10);
PdfPCell c11 = new PdfPCell(new Phrase(""));
c11.setBorderWidthRight(0);
c11.setBorderWidthLeft(0);
c11.setBorderWidthBottom(1);
tableMainGehalt.addCell(c11);
PdfPCell c12 = new PdfPCell(new Phrase(""));
c12.setBorderWidthRight(0);
c12.setBorderWidthBottom(1);
tableMainGehalt.addCell(c12);
PdfPCell c13 = new PdfPCell(new Phrase(df.format(gesSteuerabzug)));
c13.setBorderWidthBottom(1);
c13.setHorizontalAlignment(Element.ALIGN_RIGHT);
tableMainGehalt.addCell(c13);
tableMainGehalt.addCell("- Krankenversicherung");
c = new PdfPCell(new Phrase(pf.format(prozentKrankenversicherung)+" %"));
c.setHorizontalAlignment(Element.ALIGN_RIGHT);
tableMainGehalt.addCell(c);
c = new PdfPCell(new Phrase(df.format(krankenversicherung)));
c.setHorizontalAlignment(Element.ALIGN_RIGHT);
tableMainGehalt.addCell(c);
tableMainGehalt.addCell("");
tableMainGehalt.addCell("- Pflegeversicherung");
c = new PdfPCell(new Phrase(pf.format(prozentPflegeversicherung)+" %"));
c.setHorizontalAlignment(Element.ALIGN_RIGHT);
tableMainGehalt.addCell(c);
c = new PdfPCell(new Phrase(df.format(pflegeversicherung)));
c.setHorizontalAlignment(Element.ALIGN_RIGHT);
tableMainGehalt.addCell(c);
tableMainGehalt.addCell("");
tableMainGehalt.addCell("- Rentenversicherung");
c = new PdfPCell(new Phrase(pf.format(prozentRentenversicherung)+" %"));
c.setHorizontalAlignment(Element.ALIGN_RIGHT);
tableMainGehalt.addCell(c);
c = new PdfPCell(new Phrase(df.format(rentenversicherung)));
c.setHorizontalAlignment(Element.ALIGN_RIGHT);
tableMainGehalt.addCell(c);
tableMainGehalt.addCell("");
tableMainGehalt.addCell("- Arbeitslosenversicherung");
c = new PdfPCell(new Phrase(pf.format(prozentArbeitslosenversicherung)+" %"));
c.setHorizontalAlignment(Element.ALIGN_RIGHT);
tableMainGehalt.addCell(c);
c = new PdfPCell(new Phrase(df.format(arbeitslosenversicherung)));
c.setHorizontalAlignment(Element.ALIGN_RIGHT);
tableMainGehalt.addCell(c);
tableMainGehalt.addCell("");
PdfPCell c14 = new PdfPCell(new Phrase("= Gesamte Sozialver. Abz�ge"));
c14.setBorderWidthTop(0);
c14.setBorderWidthBottom(1);
tableMainGehalt.addCell(c14);
PdfPCell c15 = new PdfPCell(new Phrase(""));
c15.setBorderWidthTop(0);
c15.setBorderWidthRight(0);
c15.setBorderWidthLeft(0);
c15.setBorderWidthBottom(1);
tableMainGehalt.addCell(c15);
PdfPCell c16 = new PdfPCell(new Phrase(""));
c16.setBorderWidthTop(0);
c16.setBorderWidthRight(0);
c16.setBorderWidthBottom(1);
tableMainGehalt.addCell(c16);
PdfPCell c17 = new PdfPCell(new Phrase(df.format(gesSozialversicherungsabzug)));
c17.setBorderWidthTop(0);
c17.setBorderWidthBottom(1);
c17.setHorizontalAlignment(Element.ALIGN_RIGHT);
tableMainGehalt.addCell(c17);
tableMainGehalt.addCell("= Nettogehalt");
tableMainGehalt.addCell("");
tableMainGehalt.addCell("");
c = new PdfPCell(new Phrase(df.format(nettogehalt)));
c.setHorizontalAlignment(Element.ALIGN_RIGHT);
tableMainGehalt.addCell(c);
PdfPCell c18 = new PdfPCell(new Phrase(""));
c18.setColspan(4);
c18.setBorderWidth(1);
c18.setBorderWidthLeft(0);
c18.setBorderWidthRight(0);
tableMainGehalt.addCell(c18);
PdfPCell c19 = new PdfPCell(new Phrase(""));
c19.setColspan(4);
c19.setBorderWidth(0);
tableMainGehalt.addCell(c19);
float[] relSizeBorder = {1};
PdfPTable tableBorder = new PdfPTable(relSizeBorder);
tableBorder.getDefaultCell().setBorderWidth(1);
tableBorder.setWidthPercentage(100);
tableBorder.addCell(tableMain);
tableBorder.addCell(tableMainGehalt);
main.add(tableBorder);
//ende main
PdfPTable header1 = new PdfPTable(1);
PdfPCell cell = new PdfPCell(new Phrase(" ", FontFactory.getFont(FontFactory.HELVETICA, 54)));
cell.setBorder(Rectangle.NO_BORDER);
cell.setBorderWidth(0);
header1.addCell(cell);
header1.setTotalWidth(document.getPageSize().getWidth() - document.leftMargin() - document.rightMargin());
document.add(header1);
document.add(header2);
document.add(adresse);
document.add(main);
}