@@ -0,0 +1,2265 @@
+/*%0A * Copyright 2015 Datalogics, Inc.%0A */%0A%0Apackage com.datalogics.pdf.samples.creation;%0A%0Aimport com.adobe.pdfjt.core.license.LicenseManager;%0Aimport com.adobe.pdfjt.pdf.document.PDFDocument;%0Aimport com.adobe.pdfjt.pdf.document.PDFOpenOptions;%0A%0Aimport com.datalogics.pdf.document.DocumentHelper;%0Aimport com.datalogics.pdf.layout.LayoutEngine;%0Aimport com.datalogics.pdf.text.Paragraph;%0A%0A/**%0A * This sample shows how to create a basic PDF containing the text 'Hello World'.%0A *%0A */%0Apublic final class HelloWorld %7B%0A    private static final String outputPDFPath = %22HelloWorld.pdf%22;%0A%0A    /**%0A     * This is a utility class, and won't be instantiated.%0A     */%0A    private HelloWorld() %7B%7D%0A%0A    /**%0A     * Main program.%0A     *%0A     * @param args command line arguments%0A     * @throws Exception a general exception was thrown%0A     */%0A    public static void main(final String... args) throws Exception %7B%0A        // If you are using an evaluation version of the product (License Managed, or LM), set the path to where PDFJT%0A        // can find the license file.%0A        //%0A        // If you are not using an evaluation version of the product you can ignore or remove this code.%0A        LicenseManager.setLicensePath(%22.%22);%0A        String path;%0A        if (args.length %3E 0) %7B%0A            path = args%5B0%5D;%0A        %7D else %7B%0A            path = outputPDFPath;%0A        %7D%0A        run(path);%0A    %7D%0A%0A    static void run(final String outputPath) throws Exception %7B%0A        PDFDocument document = null;%0A%0A        try %7B%0A            document = PDFDocument.newInstance(PDFOpenOptions.newInstance());%0A%0A            addText(document);%0A%0A            DocumentHelper.saveFullAndClose(document, outputPath);%0A        %7D finally %7B%0A            if (document != null) %7B%0A                document.close();%0A            %7D%0A        %7D%0A    %7D%0A%0A    /**%0A     * Add the Hello World text to the PDF document.%0A     *%0A     * @param pdfDoc The document to add the text to%0A     * @throws Exception a general exception was thrown%0A     */%0A    private static void addText(final PDFDocument pdfDoc) throws Exception %7B%0A        // Read in a text and add each line as separate paragraph%0A        try (LayoutEngine layoutEngine = new LayoutEngine(pdfDoc)) %7B%0A            layoutEngine.add(new Paragraph(%22Hello World%22));%0A        %7D%0A    %7D%0A%7D%0A

Add a Hello World sample