IText - Example

Example

The following source code generates a PDF file as a Hello World example.

import java.io.FileOutputStream; import com.itextpdf.text.Document; import com.itextpdf.text.Paragraph; import com.itextpdf.text.pdf.PdfWriter; public class ITextHelloWorld { public static void main(String args) { try { Document document = new Document; PdfWriter.getInstance(document, new FileOutputStream("HelloWorld.pdf")); document.open; document.add(new Paragraph("Hello World")); document.close; } catch (Exception e) { System.out.println(e); } } }

Read more about this topic:  IText

Famous quotes containing the word example:

    Our intellect is not the most subtle, the most powerful, the most appropriate, instrument for revealing the truth. It is life that, little by little, example by example, permits us to see that what is most important to our heart, or to our mind, is learned not by reasoning but through other agencies. Then it is that the intellect, observing their superiority, abdicates its control to them upon reasoned grounds and agrees to become their collaborator and lackey.
    Marcel Proust (1871–1922)