/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package CZ3003_Subscriber;

import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import org.apache.pdfbox.exceptions.COSVisitorException;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.edit.PDPageContentStream;
import org.apache.pdfbox.pdmodel.font.PDFont;
import org.apache.pdfbox.pdmodel.font.PDType1Font;
import org.apache.pdfbox.pdmodel.graphics.xobject.PDJpeg;

/**
 *
 * @author Bryden
 */
public class NewMain {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException, COSVisitorException {

        String imagePath = "C:\\Users\\Bryden\\Desktop\\pie-sample.png";

        try (// Create a document and add a page to it
                PDDocument document = new PDDocument()) {
            PDPage page = new PDPage(PDPage.PAGE_SIZE_A4);
            document.addPage(page);
            
// Create a new font object selecting one of the PDF base fonts
            PDFont font = PDType1Font.HELVETICA_BOLD;
            
            InputStream in = Files.newInputStream(Paths.get(imagePath));
            PDJpeg img = new PDJpeg(document, in);
            
// Define a text content stream using the selected font, moving the cursor and drawing the text "Hello World"
            try (// Start a new content stream which will "hold" the to be created content
                    PDPageContentStream contentStream = new PDPageContentStream(document, page)) {
                // Define a text content stream using the selected font, moving the cursor and drawing the text "Hello World"
                contentStream.beginText();
                contentStream.setFont(font, 12);
                contentStream.moveTextPositionByAmount(100, 700);
                contentStream.drawString("Hello World");
                contentStream.endText();
                
                contentStream.drawImage(img, 10, 10);
                
// Make sure that the content stream is closed:
            }
            
            img.clear();
            
// Save the results and ensure that the document is properly closed:
            document.save("Hello World.pdf");
        }
    }

}

@@ -325,24 +325,101 @@
 ile.Paths;%0D%0A
+import java.util.ArrayList;%0D%0Aimport java.util.Date;%0D%0Aimport java.util.List;%0D%0A
 import org.a
@@ -460,24 +460,24 @@
 Exception;%0D%0A
-
 import org.a
@@ -996,1602 +996,8 @@
     
-String imagePath = %22C:%5C%5CUsers%5C%5CBryden%5C%5CDesktop%5C%5Cpie-sample.png%22;%0D%0A%0D%0A        try (// Create a document and add a page to it%0D%0A                PDDocument document = new PDDocument()) %7B%0D%0A            PDPage page = new PDPage(PDPage.PAGE_SIZE_A4);%0D%0A            document.addPage(page);%0D%0A            %0D%0A// Create a new font object selecting one of the PDF base fonts%0D%0A            PDFont font = PDType1Font.HELVETICA_BOLD;%0D%0A            %0D%0A            InputStream in = Files.newInputStream(Paths.get(imagePath));%0D%0A            PDJpeg img = new PDJpeg(document, in);%0D%0A            %0D%0A// Define a text content stream using the selected font, moving the cursor and drawing the text %22Hello World%22%0D%0A            try (// Start a new content stream which will %22hold%22 the to be created content%0D%0A                    PDPageContentStream contentStream = new PDPageContentStream(document, page)) %7B%0D%0A                // Define a text content stream using the selected font, moving the cursor and drawing the text %22Hello World%22%0D%0A                contentStream.beginText();%0D%0A                contentStream.setFont(font, 12);%0D%0A                contentStream.moveTextPositionByAmount(100, 700);%0D%0A                contentStream.drawString(%22Hello World%22);%0D%0A                contentStream.endText();%0D%0A                %0D%0A                contentStream.drawImage(img, 10, 10);%0D%0A                %0D%0A// Make sure that the content stream is closed:%0D%0A            %7D%0D%0A            %0D%0A            img.clear();%0D%0A            %0D%0A// Save the results and ensure that the document is properly closed:%0D%0A            document.save(%22Hello World.pdf%22);%0D%0A        %7D
 %0D%0A  
@@ -1001,13 +1001,11 @@
 %0A    %7D%0D%0A
-%0D%0A
 %7D%0D%0A

ADD Report