We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Copy content of a page on top of another page

Hi,


I would like to know if it’s possible to overlay/copy the content of a pdf page on top of another page using Aspose.Pdf Java?

Basically, I need to use a PDF page as a background and copy on top the content of another pdf without rasterizing the contents.

You can see attached an example of what I would like to achieve.

Thank you very much.

Best regards,

Hi Calvo,


Thanks for your inquiry. You may accomplish your requirement adding PDF page stamp. Please check following sample code snippet to add a PDF page to another page as stamp. Hopefully it will resolve the issue.

//open document<o:p></o:p>

Document pdfDocument = new Document(myDir+"input.pdf");

Document pdfDocument1 = new Document(myDir+"stamp.pdf");

//create page stamp

PdfPageStamp pageStamp = new PdfPageStamp(pdfDocument1.getPages().get_Item(1));

pageStamp.setBackground(true);

pageStamp.setXIndent(100);

pageStamp.setYIndent(100);

pageStamp.setRotate(Rotation.on180);

//add stamp to particular page

pdfDocument.getPages().get_Item(1).addStamp(pageStamp);

//save output document

pdfDocument.save(myDir+"output_pdfpagestamp.pdf");


Please feel free to contact us for any further assistance.


Best Regards,

1 Like