예제 ¶
- HelloWorld
~cpp package spike; import java.io.FileNotFoundException; import java.io.FileOutputStream; import com.lowagie.text.Document; import com.lowagie.text.DocumentException; import com.lowagie.text.Paragraph; import com.lowagie.text.pdf.PdfWriter; public class HelloWorld { public HelloWorld() { writeHello(); } private void writeHello() { Document document = new Document(); try { PdfWriter.getInstance(document, new FileOutputStream("Hello.pdf")); document.open(); document.add(new Paragraph("Hello, World")); document.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (DocumentException e) { e.printStackTrace(); } } public static void main(String args[]) { new HelloWorld(); } }
결과 파일 : Hello.pdf
도구분류, 프로그래밍분류