If you want to create pdf file, you can try
new FileOutputStream("path.pdf");
And then using pdf writer, write this to file.
But if you are interested in Pdf table generation. I would like to offer you another lib.
I worked with itextpdf, and created table in pdf documents.
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.12</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.itextpdf.tool/xmlworker -->
<dependency>
<groupId>com.itextpdf.tool</groupId>
<artifactId>xmlworker</artifactId>
<version>5.4.4</version>
</dependency>
You should write something like this
public PdfStream opendocument() {
document = new Document(PageSize.A4);
try {
writer = PdfWriter.getInstance(document, new FileOutputStream(path));
writer.setPdfVersion(PdfWriter.PDF_VERSION_1_7);
document.open();
} catch (DocumentException | FileNotFoundException e) {
e.printStackTrace();
}
return this;
}
p.s. it's part from my code, don't care about PdfStream class.
Where writer and document objects are PdfWriter and Document instances.
I think that write all code example here, it isn't good idea, but you can read more about this https://developers.itextpdf.com/examples/itext-action-second-edition/chapter-1
If you have some questions, ask me) Good luck !