Is there a way to add a user defined value (similar to EXIF tag in JPEG) to an image element in PDF?

Q:

Is there a way to add a user defined value (similar to EXIF tag in JPEG) to an image element in PDF?

A:

Yes, you can store custom key/value pairs in the image dictionary with help of SDF/Cos API.

As a starting point take a look at SDF sample project (http://www.pdftron.com/pdfnet/samplecode.html#SDF) and go over http://www.pdftron.com/pdfnet/intro.html (although there were some API changes this is still a good intro for SDF API in PDFNet).

To be more specific you can access Image object as shown in ImageExtract sample (http://www.pdftron.com/pdfnet/samplecode.html#ImageExtract).

From there, you can add a custom key/value pair as follows:

Obj image_dict = image.GetSDFObj();
Obj my_dict = image_dict.FindObj(“My custom dict”);
if (my_dict == null) my_dict = image_dict.PutDict(“My custom dict”);

Obj my_bool = my_dict.FindObj(“My Bool”);
If (my_bool == null) my_bool = my_dict.PutBool("My Bool ", true);
my_bool.SetBool(false);
bool val = my_bool.GetValue();