Hi,
We are in the process of evaluating aspose as PDF converter for one of our esteemed client, and working with POCs as of now.
I am trying to add the header/footer images to the pdf generated(i.e. existing pdf) using aspose.pdf for java platform, observed that, its taking much time(apporx 10secs) to put the header/footer images in place.
Please find the below code snippet I am using for the same, review it once and let me know if there is any better way to achieve this with less time consumed.
ImageStamp footerImg = null;
ImageStamp headerImg = null;
//set footer image props
if (pdfInfo.getFooterinputStream() != null) {
footerImg = new ImageStamp(pdfInfo.getFooterinputStream());
footerImg.setBackground(true);
footerImg.setXIndent(2);
footerImg.setYIndent(0);
footerImg.setHeight(60);
footerImg.setWidth(593);
//imageStamp.setRotate(com.aspose.pdf.Rotation.on270);
footerImg.setOpacity(1);
}
//set header imagea props.
if (pdfInfo.getHeaderInputStream() != null) {
headerImg = new ImageStamp(pdfInfo.getHeaderInputStream());
headerImg.setBackground(true);
headerImg.setXIndent(2);
headerImg.setYIndent(778);
headerImg.setHeight(60);
headerImg.setWidth(593);
headerImg.setOpacity(1);
}
//add images in all pages.
for (int i = 1; i <= pdfDocument.getPages().size(); i++) {
if (footerImg != null)
pdfDocument.getPages().get_Item(i).addStamp(footerImg);
if (headerImg != null)
pdfDocument.getPages().get_Item(i).addStamp(headerImg);
}