本文整理匯總了Java中com.itextpdf.text.pdf.PdfPTable.writeSelectedRows方法的典型用法代碼示例。如果您正苦於以下問題:Java PdfPTable.writeSelectedRows方法的具體用法?Java PdfPTable.writeSelectedRows怎麽用?Java PdfPTable.writeSelectedRows使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.itextpdf.text.pdf.PdfPTable
的用法示例。
在下文中一共展示了PdfPTable.writeSelectedRows方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onEndPage
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
@Override
public void onEndPage(PdfWriter writer, Document document) {
PdfPTable table = new PdfPTable(2);
table.setTotalWidth(527);
table.setWidthPercentage(100);
table.setLockedWidth(true);
table.getDefaultCell().setFixedHeight(105f);
table.getDefaultCell().setBorderWidth(0);
table.addCell("");
table.addCell(csmLogoImage);
table.writeSelectedRows(0, -1, 100, 840, writer.getDirectContent());
ColumnText.showTextAligned(writer.getDirectContent(),
Element.ALIGN_LEFT,
new Phrase(lebData.getSchuelername() + " " + lebData.getSchuljahr() + " " + lebData.getSchulhalbjahr().getId() + " Seite " + document.getPageNumber(), fusszeilenFont),
100, 75, 0);
}
示例2: onEndPage
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
/**
* Adds a header to every page
* @see com.itextpdf.text.pdf.PdfPageEventHelper#onEndPage(
* com.itextpdf.text.pdf.PdfWriter, com.itextpdf.text.Document)
*/
public void onEndPage(PdfWriter writer, Document document) {
PdfPTable table = new PdfPTable(3);
try {
table.setWidths(new int[]{40,5,10});
table.setTotalWidth(100);
table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
Font font=new Font(chineseFont,8);
font.setColor(new BaseColor(55,55,55));
Paragraph paragraph=new Paragraph("第 "+writer.getPageNumber()+" 頁 共",font);
paragraph.setAlignment(Element.ALIGN_RIGHT);
table.addCell(paragraph);
Image img=Image.getInstance(total);
img.scaleAbsolute(28, 28);
PdfPCell cell = new PdfPCell(img);
cell.setBorder(Rectangle.NO_BORDER);
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(cell);
PdfPCell c = new PdfPCell(new Paragraph("頁",font));
c.setHorizontalAlignment(Element.ALIGN_LEFT);
c.setBorder(Rectangle.NO_BORDER);
table.addCell(c);
float center=(document.getPageSize().getWidth())/2-120/2;
table.writeSelectedRows(0, -1,center,30, writer.getDirectContent());
}
catch(DocumentException de) {
throw new ExceptionConverter(de);
}
}
示例3: createReceiptHeaderAndTextBelow
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
private void createReceiptHeaderAndTextBelow(PdfContentByte cb) throws DocumentException {
PdfPTable headerTable = new PdfPTable(1);
float[] rows = { 450f };
headerTable.setTotalWidth(rows);
headerTable.getDefaultCell()
.setBorder(Rectangle.NO_BORDER);
headerTable.addCell(new Phrase(new Chunk("Bestätigung über Geldzuwendungen", textFontForReceiptHeader)));
headerTable.writeSelectedRows(0, 1, 75f, 625, cb);
PdfPTable table = new PdfPTable(1);
table.setTotalWidth(rows);
table.getDefaultCell()
.setBorder(Rectangle.NO_BORDER);
table.getDefaultCell()
.setLeading(8f, 0);
table.addCell(new Phrase(new Chunk("im Sinne des §10b des Einkommensteuergesetzes", textFont)));
table.addCell(new Phrase(new Chunk("an eine der in §5 Abs. 1 Nr. 9 des Körperschaftsteuergesetzes bezeichneten", textFont)));
table.addCell(new Phrase(new Chunk("Körperschaften, Personenvereinigungen oder Vermögensmassen", textFont)));
table.writeSelectedRows(0, 3, 75f, 590, cb);
}
示例4: createCircleAndText
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
public static void createCircleAndText(PdfContentByte cb, String text, float xCoord, float yCoord, float radius, Font textFont, int circleColorRed, int circleColorGreen, int circleColorBlue)
throws DocumentException, IOException {
cb.saveState();
cb.setRGBColorFill(circleColorRed, circleColorGreen, circleColorBlue);
cb.circle(xCoord, yCoord, radius);
cb.fill();
cb.stroke();
cb.restoreState();
PdfPTable table = new PdfPTable(1);
float[] rows = { 595f };
table.setTotalWidth(rows);
table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
table.getDefaultCell().setFixedHeight(radius * 2);
table.addCell(new Phrase(new Chunk(text, textFont)));
table.writeSelectedRows(0, 1, 0, yCoord + radius, cb);
}
示例5: onStartPage
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
@Override
public void onStartPage(PdfWriter writer, Document document) {
cabe = true;
PdfPTable pTableNumPage = new PdfPTable(1);
pTableNumPage.setTotalWidth(80f);
PdfPCell pCellImagem = new PdfPCell(new Phrase("Pag Nº: ".toUpperCase() + document.getPageNumber(), fontNump));
pCellImagem.setRotation(270);
pCellImagem.setBorder(0);
pTableNumPage.addCell(pCellImagem);
pTableNumPage.writeSelectedRows(-1, 2, 761f, 80.5f, writer.getDirectContent());
}
示例6: drawTableAtTheEndOfPage
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
/**
* <a href="http://stackoverflow.com/questions/43807931/creating-table-in-pdf-on-last-page-bottom-wrong-official-solution">
* Creating table in pdf on last page bottom (wrong official solution)
* </a>
* <p>
* Helper method for {@link #testCreateTableLikeUser7968180()}. Here the error
* is corrected.
* </p>
*/
private static void drawTableAtTheEndOfPage(Document document, PdfWriter writer, PdfPTable datatable)
{
datatable.setTotalWidth(document.right() - document.left());
// datatable.setTotalWidth(document.right(document.rightMargin()) - document.left(document.leftMargin()));
datatable.writeSelectedRows(0, -1, document.left(),
datatable.getTotalHeight() + document.bottom(), writer.getDirectContent());
// datatable.writeSelectedRows(0, -1, document.left(document.leftMargin()),
// datatable.getTotalHeight() + document.bottom(document.bottomMargin()), writer.getDirectContent());
}
示例7: createUserFields
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
private void createUserFields(PdfContentByte cb, Receipt receipt, Document doc) throws DocumentException {
// get latest cart and sum of total prices
Cart latest = receipt.getCarts()
.get(0);
// create Strings
String name = (latest.getCallBackNachname() == null ? "" : latest.getCallBackNachname() + ", ") + (latest.getCallBackVorname() == null ? "" : latest.getCallBackVorname());
String company = latest.getCallBackFirma() == null ? "" : latest.getCallBackFirma();
String street = latest.getCallBackStrasse() == null ? "" : latest.getCallBackStrasse();
String city = (latest.getCallBackPlz() == null ? "" : latest.getCallBackPlz() + " ") + (latest.getCallBackOrt() == null ? "" : latest.getCallBackOrt());
PdfPTable tableForNameAndAdress = new PdfPTable(1);
float[] rows = { 450f };
tableForNameAndAdress.setTotalWidth(rows);
tableForNameAndAdress.getDefaultCell()
.setBorder(Rectangle.NO_BORDER);
tableForNameAndAdress.addCell(new Phrase(new Chunk("Name und Anschrift des Zuwendenden:", textFont)));
tableForNameAndAdress.addCell(new Phrase(new Chunk(" ", textFont)));
tableForNameAndAdress.addCell(new Phrase(new Chunk(company, textFontUserData)));
tableForNameAndAdress.addCell(new Phrase(new Chunk(name, textFontUserData)));
tableForNameAndAdress.addCell(new Phrase(new Chunk(street, textFontUserData)));
tableForNameAndAdress.addCell(new Phrase(new Chunk(city, textFontUserData)));
tableForNameAndAdress.writeSelectedRows(0, 6, 85f, 525f, cb);
}
示例8: createHeaderBlock
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
public static void createHeaderBlock(PdfContentByte cb, int pageNumber, int pageSize) throws DocumentException, IOException {
cb.saveState();
cb.setColorFill(BaseColor.BLACK);
cb.rectangle(0.0f, 822.0f, 595.0f, 20.0f);
cb.fill();
cb.stroke();
cb.restoreState();
Font textFont = new Font(FontFamily.HELVETICA, 7, Font.NORMAL, BaseColor.WHITE);
PdfPTable table = new PdfPTable(4);
float[] rows = { 100f, 100f, 100f, 295f };
table.setTotalWidth(rows);
table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
table.getDefaultCell().setFixedHeight(20);
table.addCell(new Phrase(new Chunk("WALD 1.1 gGmbH", textFont)));
table.addCell(new Phrase(new Chunk("[ Spendenkonto 222 888 ]", textFont)));
table.addCell(new Phrase(new Chunk("www.iplantatree.org", textFont)));
PdfPCell pageCell = new PdfPCell(new Phrase(new Chunk("Seite " + pageNumber + " von " + pageSize, textFont)));
pageCell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
pageCell.setBorder(PdfPCell.NO_BORDER);
table.addCell(pageCell);
table.writeSelectedRows(0, 1, 0, 842, cb);
}
示例9: createAdress
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
public static void createAdress(PdfContentByte cb, float xCoord, float yCoord) throws DocumentException {
Font textFontForAdress = new Font(FontFamily.HELVETICA, 10, Font.NORMAL, BaseColor.BLACK);
PdfPTable table = new PdfPTable(1);
float[] rows = { 200f };
table.setTotalWidth(rows);
table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
table.getDefaultCell().setFixedHeight(14f);
table.addCell(new Phrase(new Chunk("Wald 1.1 gemeinnützige GmbH", textFontForAdress)));
table.addCell(new Phrase(new Chunk("Gabelsbergerstraße 4", textFontForAdress)));
table.addCell(new Phrase(new Chunk("D-06114 Halle", textFontForAdress)));
table.writeSelectedRows(0, 3, xCoord, yCoord, cb);
}
示例10: onEndPage
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
@Override
// initialization of the header table
public void onEndPage(final PdfWriter writer,
final Document document) {
final PdfPTable header = new PdfPTable(2);
final Phrase p = new Phrase();
final Chunk ck = new Chunk(String.format("%s%n %s Finalist Schedule - Award Group: %s", //
mChallengeTitle, //
mShowPrivate ? "Private" : "", mDivision), HEADER_FONT);
p.add(ck);
header.getDefaultCell().setBorderWidth(0);
header.addCell(p);
header.getDefaultCell().setHorizontalAlignment(com.itextpdf.text.Element.ALIGN_RIGHT);
header.addCell(new Phrase(new Chunk(String.format("Tournament: %s %nDate: %s", mTournament, mFormattedDate),
HEADER_FONT)));
final PdfPCell blankCell = new PdfPCell();
blankCell.setBorder(0);
blankCell.setBorderWidthTop(1.0f);
blankCell.setColspan(2);
header.addCell(blankCell);
final PdfContentByte cb = writer.getDirectContent();
cb.saveState();
header.setTotalWidth(document.right()
- document.left());
header.writeSelectedRows(0, -1, document.left(), document.getPageSize().getHeight() - 10, cb);
cb.restoreState();
}
示例11: onEndPage
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
@Override
// initialization of the header table
public void onEndPage(final PdfWriter writer,
final Document document) {
final PdfPTable header = new PdfPTable(2);
final Phrase p = new Phrase();
final Chunk ck = new Chunk(_challengeTitle
+ "\n" + _reportTitle, _font);
p.add(ck);
header.getDefaultCell().setBorderWidth(0);
header.addCell(p);
header.getDefaultCell().setHorizontalAlignment(com.itextpdf.text.Element.ALIGN_RIGHT);
header.addCell(new Phrase(new Chunk("Tournament: "
+ _tournament + "\nDate: " + _formattedDate, _font)));
final PdfPCell blankCell = new PdfPCell();
blankCell.setBorder(0);
blankCell.setBorderWidthTop(1.0f);
blankCell.setColspan(2);
header.addCell(blankCell);
final PdfContentByte cb = writer.getDirectContent();
cb.saveState();
header.setTotalWidth(document.right()
- document.left());
header.writeSelectedRows(0, -1, document.left(), document.getPageSize().getHeight() - 10, cb);
cb.restoreState();
}
示例12: testSandeepSinghHeaderTable
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
/**
* <a href="http://stackoverflow.com/questions/29977927/table-header-in-pdf-getting-displayed-using-itextpdf5-1-1-but-not-in-itextpdf5-5">
* table header in pdf getting displayed using itextpdf5.1.1 but not in itextpdf5.5.3
* </a>
* <p>
* Indeed, the code as presented by the OP does not show the header table. This makes sense, though:
* </p>
* <p>
* The OP has cells with default padding (i.e. 2) and height 10, and he tries to insert text at height 7.
* But 2 (top margin) + 7 (text height) + 2 (bottom margin) = 11, i.e. more than fits into the cell height 10.
* Thus, the text does not fit and is not displayed.
* </p>
* <p>
* You can fix this by either
* <ul>
* <li>using a smaller font, e.g. 6, or
* <li>using a higher cell, e.g. 11, or
* <li>using a smaller padding, e.g. 1, see below-
* </p>
*/
@Test
public void testSandeepSinghHeaderTable() throws DocumentException, IOException
{
byte[] strIntermediatePDFFile = createSampleDocument();
String header1 = "Header 1";
String header2 = "Header 2";
String header3 = "Header 3";
String header5 = "Header 5";
Document document = new Document(PageSize.A4.rotate(), 20, 20, 75, 20);
PdfCopy copy = new PdfCopy(document, new FileOutputStream(new File(RESULT_FOLDER, "stampTableHeader.pdf")));
document.open();
PdfReader pdfReaderIntermediate = new PdfReader(strIntermediatePDFFile);
int numberOfPages = pdfReaderIntermediate.getNumberOfPages();
Font ffont = new Font(Font.FontFamily.UNDEFINED, 7, Font.NORMAL);
System.out.println("###### No. of Pages: " + numberOfPages);
for (int j = 0; j < numberOfPages; )
{
PdfImportedPage page = copy.getImportedPage(pdfReaderIntermediate, ++j);
PageStamp stamp = copy.createPageStamp(page);
Phrase footer = new Phrase(String.format("%d of %d", j, numberOfPages), ffont);
ColumnText.showTextAligned(stamp.getUnderContent(),
Element.ALIGN_CENTER, footer,
(document.right() - document.left()) /
2 + document.leftMargin(),
document.bottom() - 10, 0);
if (j != 1)
{
PdfPTable headerTable = new PdfPTable(2);
headerTable.setTotalWidth(700);
headerTable.getDefaultCell().setFixedHeight(10);
headerTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
headerTable.getDefaultCell().setPadding(1); // Added!
headerTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
headerTable.addCell(new Phrase(String.format(header1), ffont));
headerTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
headerTable.addCell(new Phrase(String.format(header2), ffont));
headerTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
headerTable.addCell(new Phrase(String.format(header3), ffont));
headerTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
headerTable.addCell(new Phrase(String.format(header5, j), ffont));
headerTable.completeRow();
headerTable.writeSelectedRows(0, 5, 60.5f, 550, stamp.getUnderContent());
}
stamp.alterContents();
copy.addPage(page);
}
document.close();
}
示例13: createBlueBlock
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
private void createBlueBlock(PdfContentByte cb, int treeCount) throws DocumentException {
cb.saveState();
cb.setRGBColorFill(0x64, 0xA7, 0xBD);
cb.rectangle(0.0f, 375.0f, 595.0f, 200.0f);
cb.fill();
cb.stroke();
cb.restoreState();
Font textFont = new Font(FontFamily.TIMES_ROMAN, 14, Font.ITALIC, BaseColor.WHITE);
Font textBlack = new Font(FontFamily.TIMES_ROMAN, 14, Font.ITALIC, BaseColor.BLACK);
Font textFontTreeCount = new Font(FontFamily.HELVETICA, 30, Font.BOLD, BaseColor.BLACK);
PdfPTable tableForTreeCount = new PdfPTable(1);
float[] rows = { 495f };
tableForTreeCount.setTotalWidth(rows);
tableForTreeCount.getDefaultCell().setBorder(Rectangle.NO_BORDER);
tableForTreeCount.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
tableForTreeCount.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
tableForTreeCount.getDefaultCell().setFixedHeight(40);
Integer treeCountAsObject = treeCount;
tableForTreeCount.addCell(new Phrase(new Chunk(treeCountAsObject.toString(), textFontTreeCount)));
tableForTreeCount.writeSelectedRows(0, 1, 50f, 575f, cb);
PdfPTable tableForWhiteText = new PdfPTable(1);
tableForWhiteText.setTotalWidth(rows);
tableForWhiteText.getDefaultCell().setBorder(Rectangle.BOTTOM);
tableForWhiteText.getDefaultCell().setBorderWidth(1f);
tableForWhiteText.getDefaultCell().setBorderColor(BaseColor.WHITE);
tableForWhiteText.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
tableForWhiteText.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
tableForWhiteText.getDefaultCell().setFixedHeight(40);
Phrase phraseForTreesPlantForYou = new Phrase();
if (treeCount == 1) {
phraseForTreesPlantForYou.add(new Chunk("Baum wurde für Sie gepflanzt!", textFont));
} else {
phraseForTreesPlantForYou.add(new Chunk("Bäume wurden für Sie gepflanzt!", textFont));
}
PdfPCell longTextCell = new PdfPCell();
longTextCell.setHorizontalAlignment(Element.ALIGN_LEFT);
longTextCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
longTextCell.setBorder(Rectangle.BOTTOM);
longTextCell.setBorderWidth(1f);
longTextCell.setBorderColor(BaseColor.WHITE);
longTextCell.setFixedHeight(65);
Paragraph longText = new Paragraph(new Chunk(
"Mit diesem Gutschein können sie Ihre Pflanzung in Augenschein nehmen und mehr über die naturnahen Aufforstungsprojekte bei \"I Plant A Tree\" erfahren. Ihre Bäume wachsen auf ehemals brachliegenden Flächen und sind Teil neu entstehender Wälder.",
textFont));
longText.setLeading(15f);
longTextCell.addElement(longText);
tableForWhiteText.addCell(phraseForTreesPlantForYou);
tableForWhiteText.addCell(longTextCell);
tableForWhiteText.writeSelectedRows(0, 2, 50f, 535f, cb);
PdfPTable tableForHowItWorks = new PdfPTable(1);
tableForHowItWorks.setTotalWidth(rows);
tableForHowItWorks.getDefaultCell().setBorder(Rectangle.NO_BORDER);
tableForHowItWorks.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
tableForHowItWorks.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
tableForHowItWorks.getDefaultCell().setFixedHeight(40);
tableForHowItWorks.addCell(new Phrase(new Chunk("Und so einfach funktioniert's:", textBlack)));
tableForHowItWorks.writeSelectedRows(0, 2, 50f, 425f, cb);
}
示例14: createTreeCountAndCustomTextBlock
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
private void createTreeCountAndCustomTextBlock(PdfContentByte cb, String customText, int treeCount) throws DocumentException {
Font textFont = new Font(FontFamily.TIMES_ROMAN, 16, Font.ITALIC, BaseColor.BLACK);
Font textFontTreeCount = new Font(FontFamily.HELVETICA, 30, Font.BOLD, BaseColor.BLACK);
Font customTextFont = new Font(FontFamily.HELVETICA, 12, Font.NORMAL, BaseColor.BLACK);
cb.saveState();
cb.setRGBColorFill(0xE0, 0xDE, 0xDF);
cb.rectangle(0.0f, 325.0f, 595.0f, 205.0f);
cb.fill();
cb.stroke();
cb.restoreState();
Integer treeCountAsObj = treeCount;
PdfPTable table = new PdfPTable(1);
float[] rows = { 595f };
table.setTotalWidth(rows);
table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
table.getDefaultCell().setFixedHeight(35);
table.addCell(new Phrase(new Chunk("über die Pflanzung von", textFont)));
table.addCell(new Phrase(new Chunk(treeCountAsObj.toString(), textFontTreeCount)));
table.addCell(new Phrase(new Chunk("Bäumen", textFont)));
table.writeSelectedRows(0, 3, 0, 520, cb);
cb.saveState();
cb.setRGBColorFill(0xF7, 0xF2, 0xF4);
cb.rectangle(50.0f, 345.0f, 495.0f, 60.0f);
cb.fill();
cb.stroke();
cb.restoreState();
PdfPTable textTable = new PdfPTable(1);
float[] textRows = { 475f };
textTable.setTotalWidth(textRows);
textTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
textTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
textTable.getDefaultCell().setFixedHeight(40);
textTable.addCell(new Phrase(new Chunk(customText, customTextFont)));
textTable.writeSelectedRows(0, 1, 60, 395, cb);
}
示例15: createLawTextDateAndSignatureBlock
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
private void createLawTextDateAndSignatureBlock(PdfContentByte cb, String number, String date) throws DocumentException, MalformedURLException, IOException {
Font textFont = new Font(FontFamily.HELVETICA, 10, Font.NORMAL, BaseColor.BLACK);
Font textFontBold = new Font(FontFamily.HELVETICA, 10, Font.BOLD, BaseColor.BLACK);
Font textFontSmall = new Font(FontFamily.HELVETICA, 6, Font.NORMAL, BaseColor.BLACK);
PdfPTable table = new PdfPTable(2);
float[] rows = { 247.5f, 247.5f };
table.setTotalWidth(rows);
table.getDefaultCell().setBorder(Rectangle.BOTTOM);
table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
table.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
table.getDefaultCell().setFixedHeight(75);
Phrase leftPhrase = new Phrase();
leftPhrase.add(new Chunk(
"Hiermit wird die Pflanzung dieser Bäume bescheinigt. Die Pflanzung erfolgt durch die Wald 1.1 gGmbH und kann im Internet unter www.iplantatree.org über die Zertifikat-Nummer #",
textFont));
leftPhrase.add(new Chunk(number, textFontBold));
leftPhrase.add(new Chunk(" abgerufen bzw. nachvollzogen werden.", textFont));
Phrase rightPhrase = new Phrase(10f);
rightPhrase.add(new Chunk(
"Dieses Zertifikat ist keine Bestätigung über Geldzuwendungen im Sinne des § 10 b des Einkommensteuergesetzes an eine der in § 5 Abs. 1 Nr. 9 des Körperschaftsteuergesetzes bezeichneten Körperschaften, Personenvereinigungen oder Vermögensmassen.",
textFont));
PdfPCell rightCell = new PdfPCell();
rightCell.setPaddingLeft(10.0f);
rightCell.setBorder(Rectangle.BOTTOM);
rightCell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
rightCell.setVerticalAlignment(Element.ALIGN_TOP);
rightCell.addElement(rightPhrase);
PdfPCell dateCell = new PdfPCell();
dateCell.setPaddingTop(10.0f);
dateCell.setBorder(Rectangle.NO_BORDER);
dateCell.addElement(new Phrase(new Chunk("Datum der Ausstellung: " + date, textFont)));
PdfPCell emptyCell = new PdfPCell();
emptyCell.setBorder(Rectangle.NO_BORDER);
final Image signatureImage = Image.getInstance(getClass().getResource(_imagePath + "/Unterschrift150.jpg"));
PdfPCell underSignatureCell = new PdfPCell();
underSignatureCell.setBorder(Rectangle.NO_BORDER);
underSignatureCell.setPadding(0f);
Phrase underSignaturePhrase = new Phrase(10f);
underSignaturePhrase.add(new Chunk("Unterschrift / Stempel des ausstellenden Unternehmens / der ausstellenden Person", textFontSmall));
underSignatureCell.addElement(underSignaturePhrase);
underSignatureCell.setVerticalAlignment(Element.ALIGN_TOP);
table.addCell(leftPhrase);
table.addCell(rightCell);
table.addCell(dateCell);
table.addCell(emptyCell);
table.addCell(signatureImage);
table.addCell(emptyCell);
table.addCell(underSignatureCell);
table.addCell(emptyCell);
table.writeSelectedRows(0, 4, 50, 305, cb);
}