1

I have a pdf with 3 images

enter image description here

I want to find each image and replace it with another image

I saw in the pdf the original paths under xmpMM:Ingredients:

enter image description here

I tried to change it via notepad++ but it looks like the images are already embedded and changing the path does nothing.

How can I find each image and replace it with another image?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
coral
  • 181
  • 1
  • 1
  • 12
  • thanks. I actually created the original pdf using Illustrator. My goal is to be able to mark objects (images) so that I can dynamically replace them with another library. The first step is to know how to mark them. Do you know a way of using the information I currently have in XMP- can the object be identified? – coral Dec 07 '21 at 09:41

1 Answers1

2

The xmp stuff is information only. The actual images are embedded streams in the pdf file. Finding the correct streams to replace and replacing them isn't a simple problem, and can't be done with notepad. You'll need a library / toolkit that can modify PDFs, like https://pdf-lib.js.org/ or similar.

The PDF file looks like an Illustrator file, which adds another layer of weirdness - Illustrator can write PDFs that have both PDF and Illustrator versions of the content, and you see one in Acrobat and the other in Illustrator.

It's probably easier to recreate the PDF from whatever source produced it.

dirck
  • 838
  • 5
  • 10
  • thank you. I actually created the original pdf using Illustrator. My goal is to be able to mark objects (images) so that I can dynamically replace them with another library. The first step is to know how to mark them. Do you know a way of using the information I currently have in XMP- can the object be identified? – coral Dec 06 '21 at 18:36
  • The PDF rendering may not contain symbolic information about where the images come from. The objects could be tagged using marked content operators. If you have Acrobat you can look at the document tags. I don't think Adobe Reader shows tag information. I don't know if Illustrator generates tags. Illustrator does have layers, which is another option for locating and replacing content. You'd need to add a separate layer for each image. – dirck Dec 06 '21 at 19:12
  • Another option is to use PDF annotations, since they are easier to find and replace. I'm not sure they are something you can add from Illustrator. I don't have a current Illustrator, and without a copy of your document, there's not much else I can suggest. – dirck Dec 06 '21 at 19:12
  • Hi dirck, thanks. illustrator can generate tags or add xmp to art but when you create the pdf - this information gets lost. my goal is to create pdf using AI- but I can add c++ code for "tag" the art. I just don't find a way to do that. can you please elaborate about PDF annotations? or about the layers? thank you very much! – coral Dec 07 '21 at 07:58
  • Layers should persist from Illustrator to PDF. Annotations are placed on top of PDF pages for markup purposes. Replacing an image is tricky without a symbolic link to it. I'd suggest not placing the initial template images using Illustrator. There aren't any "image annotations", but you could add annotations as placeholders for where you want to put stuff, using Acrobat or another PDF editing tool. You could also specify locations out-of-band in some text control file and use that to control where your replacement images are placed. – dirck Dec 07 '21 at 17:54