How to remove images which are repeatedly used and replace with reusable images

I have a file which has the same images on alternate pages.

I want to create this image only once and reuse it on the alternate
pages instead of embedding it on every page.

Also how to find out if this image is reused or is embedded for every

A sample code in VB will help greatly


You would create image only once (using pdftron.PDF.Image.Create()).
You can keep the resulting image as a member variable in your class
and reuse to create any number of image elements on different pages.
All elements will refer to the same embedded image. This is
illustrated at the beginning of ElementBuilder sample project (http://

You can determine if different image elements point to the same
embedded image by comparing they object numbers (e.g. image_element.
GetXObject().GetObjNum()). You can also find which images are used on
a given page by enumerating images stored in page resource dictionary

Thank you you somuch for the response.
I am now able to get the object number but got stuck on replacing the content. also how do i delete the objects which are no more in used in the document

You can replce an old image with a new one using sdfdoc.Swap(). For


For more examples you can search for swap or "Image Replace" in this

Object that are no longer in use are utomatically deleted if you are
saving the file using linearization or unused object remove mode
(these are flags you can pass in doc.Save() method).