Can anyone tell me how I can create a PDF with a text annotation on it (so that the annotation can be visible while opening the PDF with the PDF reader in the Desktop) ?
Currently I am able to create a PDF, but I am not able to set the Page level dictionary for the key "Annots". This is the Sample code that I did to create the meta information about the page. Can Anyone tell me where I went wrong and any other approach that I should follow.
CFMutableDictionaryRef metaDataDictionary = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks,&kCFTypeDictionaryValueCallBacks);
CFDictionarySetValue(metaDataDictionary, CFSTR("Subtype"), CFSTR("Text"));
CFDictionarySetValue(metaDataDictionary, CFSTR("Contents"), CFSTR("This is a sample"));
CFDictionarySetValue(metaDataDictionary, CFSTR("Subj"), CFSTR("Subject"));
CFDictionarySetValue(metaDataDictionary, CFSTR("M"), CFSTR("Date"));
CFDictionarySetValue(metaDataDictionary, CFSTR("NM"), CFSTR("Name of Annotation"));
CFMutableArrayRef array = CFArrayCreateMutable(kCFAllocatorDefault,0, &kCFTypeArrayCallBacks);
CFArrayInsertValueAtIndex(array, 0, metaDataDictionary);
CFDictionarySetValue(pageDictionary,CFSTR("Annots"), array);
Thanks in advance