step 1: Buat document-object nya
Document document = new Document(PageSize.A4, 50, 50, 50, 50);
step 2: Buat writernya.. ( Pdf Writer )
PdfWriter writer = PdfWriter.getInstance(document,new FileOutputStream(namaFile));
writer.setPageEvent(this);
step 3: buka Dokumennya
document.open();
step 4. skarang tinggal kita mau nulis apa... misalnya kita nulis Hello World :D.
Chunk chunk = new Chunk(" ");
chunk.setFont(new Font(Font.COURIER, 24, Font.BOLD));
document.add(new Paragraph(chunk));
chunk = new Chunk("Hello World");
chunk.setFont(new Font(Font.HELVETICA, 18, Font.BOLD));
document.add(new Paragraph(chunk));
Step 5. tutup dokumennya
document.close();
Step 6. sudah selesai
0 komentar:
Posting Komentar