Using iText to add a image footer to a file

I wrote code to add a footer image to a page.  The secondFile is supposed to be a copy of the first with an image added to the footer.  The problem is I am not seeing the image attached.  The secondFile looks just like the original.  Will you be able to help?

public class Main {
    private static final Log logger = LogFactory.getLog(Main.class);

    private static final String FILENAME_INPUT = "c:/Downloads/Test.pdf";
    private static final String FILENAME_OUTPUT = "c:/Downloads/out.pdf";

        try {
            PdfUtil.addFooterImage(FILENAME_INPUT, FILENAME_OUTPUT);  
        } catch (Exception e) {
            logger.error(null, e);


Open in new window

public static void addFooterImage(String fileInput, String fileOutput) throws Exception{

      PdfReader pdfInputReader = new PdfReader(fileInput); 
      PdfStamper pdfOutputStamper = new PdfStamper(pdfInputReader,new FileOutputStream(fileOutput)); 
      Image image = Image.getInstance("c:/Downloads/photo.jpg"); 
      for(int i=1; i<= pdfInputReader.getNumberOfPages(); i++){
          PdfContentByte content = pdfOutputStamper.getUnderContent(i);
          image.setAbsolutePosition(100f, 700f);

Open in new window

public static void addFooterImage(ByteArrayOutputStream baos) throws Exception{
    Document document = new Document();
    PdfWriter.getInstance(document, baos);;
    Image image1 = Image.getInstance(new URL(""));

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mark BullockQA EngineerCommented:
I got the attached code working. It's like your first attempt. You'll have to change the filenames.
onaled777Author Commented:
Thanks for you time.  "/Users/mark/Downloads/PLNUWeddingGuide.pdf"  This was relevant to which directory exactly?
Mark BullockQA EngineerCommented:
That's just the input file I used for testing. Change it to work with your input file.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.