pdfbox创建pdf文档,hello world!
记下代码:
public class CreatPdfFile {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
PDDocument document = null;
try{
document = new PDDocument();
PDPage page = new PDPage(PDRectangle.A4);
document.addPage(page);
System.out.println();
PDFont font = PDType1Font.HELVETICA_BOLD;
PDPageContentStream contentStream = new PDPageContentStream(document, page);
contentStream.beginText();
contentStream.setFont(font, 20);
contentStream.newLineAtOffset(100, 100);
//contentStream.showText("Hello World !");
//c