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

Free Support Forum - aspose.com

PDF introspection and iteration over image (placeholder)

We want to generate PDF files containing placeholder images for ads. The ads will be delivered as PDF and should be stamped into the generated primary PDF file. Since we can not include the PDF ads directly from our conversion pipeline we need to stamp them. The placeholder images have the same size as the ad PDFs to be stamped.


Blueprint in meta code

pdf =
for page in pdf.getPages()
for image in page.getImages():
image_data =
if image_data matches next PDF ad metadata then
replace_current_image_with_ad_PDF_through_stamping()

Is this doable?

Hi Andreas,

I’m afraid, currently Aspose.Pdf.Kit for Java doesn’t allow you to loop through the images and then work with those images. However, looking into your scenario, one option seems viable and that is if you know the page number at which the image needs to be replaced and the index of the image at that page then you may use the replaceImage method to replace that particular image with the new ad. Please see if this helps in your scenario.

If you find any further questions, please do let us know.
Regards,