Hi All,
I have been trying to add editable text box to my custom annotation. So far, I have been successful in adding a static text to my annotation. Here is the code for that:
// Read in the stream for the appearance key.
memset(&buf, 0, sizeof(buf));
strcat(buf, "BT /STAMPR 24 Tf 10 40 TD ( Sample Text )Tj ET q 10 w 0 1 0 RG 5 5 90 90 re S Q");
s = (ASUns32)strlen(buf);
stm = ASMemStmRdOpen(buf, s);
attributesDict = CosNewDict(cdoc, false, 5);
LengthEntry = CosNewInteger(cdoc, false, s);
CosDictPutKeyString(attributesDict, Length_KStr, LengthEntry);
cStmObj = CosNewStream(cdoc, true, stm, 0, true, attributesDict, cNullObj, s);
cStmDictObj = CosStreamDict(cStmObj);
CosDictPutKeyString(cStmDictObj, "Type", CosNewNameFromString(cdoc, false, "XObject"));
CosDictPutKeyString(cStmDictObj, "Subtype", CosNewNameFromString(cdoc, false, "Form"));
CosDictPutKeyString(cStmDictObj, "FormType", CosNewInteger(cdoc, false, 1L));
// Set up ProcSet Resources.
cProcSetObj = CosNewArray(cdoc, false, 2L);
CosArrayPut(cProcSetObj, 0L, CosNewNameFromString(cdoc, false, "PDF"));
CosArrayPut(cProcSetObj, 1L, CosNewNameFromString(cdoc, false, "Text"));
CosDictPutKeyString(cResObj, "ProcSet", cProcSetObj);
// Put Resources dictionary in XObject's stream dictionary.
CosDictPutKeyString(cStmDictObj, "Resources", cResObj);
where cStmDictObj is a cos object containing the stream's attributes dictionary, cdoc is a cos level document object, cResObj is a cos object containing the resource dictionary for XObject.
In the above code, we set the stream dictionary by invoking the CosDictPutKeyString method and pass the name of the key("Type", "Subtype"). I looked into the PDF Reference and found that these are the keys of the Form Dictionary. What can be the entry for the name key if I want to add an editable text box?
The third parameter is passed by invoking CosNewNameFromString method. Here "XObject" and "Form" are passed as arguments. What should be passed as CosObj objects(3rd parameter for CosNewNameFromString) in case of an editable text box?
I looked up the Developing Plug-ins and Applications and the PDF Reference in the SDK and looked for samples too. But, I couldn't find much help.
I want to add an editable text box to my custom annotation.
Kindly guide.
Thanks!