Open a .pdf file and set the footer

Hi,

I’ve been evaluating Aspose PDF for a couple weeks. I’ve gone through the examples provided and searched through your online support but I have a question that I hope you could answer.

I’ve been trying to figure out how to open up a .pdf file and set the footer:

It’s easy enough to create a new .pdf file and set the footer:

Pdf pdf = new Pdf();

PageSetup pageSetup = new PageSetup();
pageSetup.setPageHeight(612);
pageSetup.setPageWidth(792);

pdf.setPageSetup(pageSetup);

Section sec1 = pdf.getSections().add();

HeaderFooter footer = new HeaderFooter(sec1);

Text footText = new Text(sec1, “Released for Manufacturing”);

footer.getParagraphs().add(footText);

sec1.setOddFooter(footer);

pdf.save(new FileOutputStream(new File("./MyFooter.pdf")));

But I’m trying to figure out how to open an existing .pdf file.

I’ve tried working with “PdfContentEditor”

PdfContentEditor editor = new PdfContentEditor();
editor.bindPdf(“Footer.pdf”);

but it has no method for setting the footer.

Could you please provide me with an example?

Thank you,

Mike Kopp
Kuka Systems Corporation
6600 Center Dr. Sterling Heights, MI 48312

Hi Mike,

Thank you for considering Aspose.

In Aspose.Pdf.Kit for .NET, there is a handy way (which is PdfFileStamp.AddFooter )to set the footer of a Pdf file but, unfortunately, there is not same method in our Java edition. We will add such methods in our next version for Java, and any comment will be greatly appreciated.

Before such methods could be available in java edition, please try the workaround of using PdfFileStamp.addLogomark (for text footer) or PdfFileStamp.addWatermark (for image footer), or just using PdfFileStamp.addStamp(working with a flexible Stamp class, could set custom footer to pages ).

Thanks,