iText 的简单使用,iText简单使用,[Java]代码 //s
分享于 点击 295 次 点评:110
iText 的简单使用,iText简单使用,[Java]代码 //s
[Java]代码
//set pdf location and the title String pdfLocation = request.getRealPath("/") + "/web/report/pdf/"; String pdfName= "test.pdf"; String pdfFile = pdfLocation + pdfName; Document document = new Document(); try { PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(pdfFile)); document.open(); document.add(new Paragraph("Hello world")); } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } finally { document.close(); }
用户点评