How do I replace an existing image in PDF with another one? Same location just different resolution / content
With PDFNet there are multiple ways you could implement image replacement.
a) Swap low-level images (doc.Swap(image_old.GetSDFObj().GeObjNum(),image_new.GetSDFObj().GeObjNum()));
b) Change image via Element interface (using ElementReader/Writer … along the lines of ElementEdit sample)
c) Using ContentReplacer (this option is least flexible, but is very simple to use)
If you are looking for an ‘out of the box’ sample, please take a look at option ‘c’ (i.e. ContentReplacer sample, included as part of the SDK). If shows how to swap images based on a replacement region. This is very simple method, but is more limited compared to other two options (a & b).
Unfortunately the SDK doesn’t include a ready to use sample illustrating option a & b which are more powerful but require more some familiarity with PDF format. However if you follow instructions from the following KBs you should be able to get it working: