Skip to content

Commit 47762be

Browse files
committed
App.java
App.java
1 parent 53e84ea commit 47762be

File tree

1 file changed

+34
-0
lines changed
  • itext-java-pdf-table/src/main/java/com/hmkcode

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.hmkcode;
2+
3+
import java.io.FileNotFoundException;
4+
import java.io.FileOutputStream;
5+
6+
import com.itextpdf.text.Document;
7+
import com.itextpdf.text.DocumentException;
8+
import com.itextpdf.text.PageSize;
9+
import com.itextpdf.text.pdf.PdfWriter;
10+
11+
12+
public class App
13+
{
14+
public static void main( String[] args ) throws FileNotFoundException, DocumentException
15+
{
16+
// step 1
17+
Document document = new Document();
18+
document.setPageSize(PageSize.A4);
19+
20+
// step 2
21+
PdfWriter.getInstance(document, new FileOutputStream("pdf.pdf"));
22+
23+
// step 3
24+
document.open();
25+
26+
// step 4 create PDF contents
27+
document.add(TableBuilder.createTable());
28+
29+
//step 5
30+
document.close();
31+
32+
System.out.println( "PDF Created!" );
33+
}
34+
}

0 commit comments

Comments
 (0)