Created
February 10, 2011 10:17
-
-
Save mgenov/820247 to your computer and use it in GitHub Desktop.
iText sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyClass { | |
public static void main(String[] args) throws DocumentException, IOException { | |
Document document = new Document(); | |
document.setPageCount(1); | |
PdfWriter.getInstance(document, | |
new FileOutputStream("/home/matrix/SimpleImages.pdf")); | |
document.open(); | |
URL verdanaUrl = MyClass.class.getResource("verdana.ttf"); | |
BaseFont bf = BaseFont.createFont(verdanaUrl.getPath(), BaseFont.IDENTITY_H, BaseFont.EMBEDDED); | |
PdfPTable table = new PdfPTable(2); // Code 1 | |
// Code 2 | |
PdfPCell userInfo = new PdfPCell(new Paragraph("Потребител", new Font(bf, 10))); | |
userInfo.setBackgroundColor(BaseColor.GRAY); | |
userInfo.setBorder(5); | |
table.addCell(userInfo); | |
PdfPCell contractInfo = new PdfPCell(new Paragraph("Клиент",new Font(bf, 10))); | |
contractInfo.setBackgroundColor(BaseColor.GRAY); | |
contractInfo.setBorder(5); | |
table.addCell(contractInfo); | |
// Code 3 | |
table.addCell("3"); | |
table.addCell("4"); | |
// Code 4 | |
table.addCell("5"); | |
table.addCell("6"); | |
// Code 5 | |
document.add(table); | |
document.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hello in table I don't want bottom border and top border.how can i remove that border ?
