Skip to main content
tom warner
Participant
March 28, 2016
Answered

Can javascript be used to batch replace images within a PDF from image files?

  • March 28, 2016
  • 1 reply
  • 1016 views

I want to batch process the images within some PDFs. I'm thinking the way to do that would be to export all images from the PDF to separate image files, batch process those in a photo editor, and then use javascript to batch replace the original PDFs' images with the processed versions. However I haven't been able to find any indication of such ability in the Acrobat SDK or any mention on the internets of anybody having tried it. Does anybody know if it's at least in theory possible? Can anyone point me to the right function to use?

Note that there's more in these PDFs than images, so rebuilding new PDFs from the processed image files is not an option.

This topic has been closed for replies.
Correct answer try67

No, it's not. JS has no access to the image streams in a PDF file. You can, in principle, overlay the old images with the new ones (using button fields to hold the new images), but then the issue is that you can't detect the location of the old images. In short, you need to look for a different solution.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
March 28, 2016

No, it's not. JS has no access to the image streams in a PDF file. You can, in principle, overlay the old images with the new ones (using button fields to hold the new images), but then the issue is that you can't detect the location of the old images. In short, you need to look for a different solution.

tom warner
Participant
March 28, 2016

oh heckety heck