Hi,
We are using the Java Apose pdf kit file (aspose-pdf-kit-3.6.0.jar) for adding the page numbers and footer. it's working fine at testing directly in Linux environment (Standalone application). it's not generating properly when deploy application into the oracle Application server.
tested file is attached.
Used the below mentioned code for adding the Footer and Page Numbers into the PDF file.
String inFile = "D:\\AGILE.pdf";
String FooterFile = "D:\\Footer_x2010_xlsx.pdf";
String outFile = "D:\\Page_x2010_xlsx.pdf";
String stampFile = "D:\\Stamped_x2010_xlsx.pdf";
String footerText = "001 A Admin 12/15/2010";
String footerNotes = "This is a sample file";
int footerAttrSize = 7;
int footerNotesSize = 6;
int pageNumberSize = 6;
com.aspose.pdf.kit.License license = new com.aspose.pdf.kit.License();
license.setLicense(new FileInputStream("d:\\Aspose.Total.Java.lic"));
PdfFileStamp fileStamp;
fileStamp = new PdfFileStamp(inFile, FooterFile);
FormattedText footerText_format = new FormattedText(footerText, new FontColor(250, 0, 0), FontStyle.Courier, EncodingType.Winansi, false, new Integer(footerAttrSize));
FormattedText footerText_notes = new FormattedText(footerNotes, new FontColor(250, 0, 0), FontStyle.Courier, EncodingType.Winansi, false, new Integer(footerNotesSize));
fileStamp.addFooter(footerText_format, 15);
fileStamp.addFooter(footerText_notes, 5);
fileStamp.close();
PdfFileInfo fileInfo = new PdfFileInfo(FooterFile);
int totalPages = fileInfo.getNumberofPages();
fileInfo.clearInfo();
PdfFileStamp fileStamp12 = new PdfFileStamp(FooterFile, outFile);
FormattedText ft = new FormattedText("Page # of " + totalPages, new FontColor(250, 0, 0), FontStyle.CourierBold, EncodingType.Winansi, false, new Integer(pageNumberSize));
fileStamp12.addPageNumber(ft, 1);
fileStamp12.close();
PdfFileStamp fileStamp1 = new PdfFileStamp(outFile, stampFile);
Stamp logoStamp = new Stamp();
logoStamp.bindLogo(new FormattedText("Preliminary", new FontColor(90, 90, 90), FontStyle.TimesRoman, EncodingType.Winansi, false, 50));
logoStamp.setOrigin(200, 300);
logoStamp.isBackground(false);
logoStamp.setOpacity(0.5f);
logoStamp.setRotation(30);
fileStamp1.addStamp(logoStamp);
fileStamp1.close();
Regards,
Aravind