Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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();
- }
- }
Add Comment
Please, Sign In to add comment