I'm using iText-5.0.6
And the code hasn't any magic. Try with something like this:
PdfWriter.getInstance(document, stream);
PdfPTable tableHeader = new PdfPTable(2);
tableHeader.setWidthPercentage(80);
try {
tableHeader.setWidths(new int[] { 1, 2 });
} catch (DocumentException e) {
e.printStackTrace();
}
tableHeader.setSpacingAfter(10);
tableHeader.getDefaultCell().setPadding(4);
tableHeader.getDefaultCell().setVerticalAlignment(Element.ALIGN_CENTER);
PdfPCell cell;
BaseColor baseColor = new BaseColor(230, 230, 230);
cell = new PdfPCell(new Phrase("Hello World!"));
cell.setColspan(2);
cell.setPadding(4);
cell.setBackgroundColor(baseColor);
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
tableHeader.addCell(cell);
document.open();
document.add(tableHeader);
document.close();
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.