Can someone tell me how I can create a PDF with text annotation on it (so that the annotation can be seen when opening a PDF file using a PDF reader on the desktop)?
Currently, I can create a PDF file, but I cannot install a page-level dictionary for the Annots key. This is an example of the code I made to create the meta information about the page. Can someone tell me where I did 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
source share