Question
IAC : C# : Is it possible to get bounding box of a field as an AcroRect object ?
Is it possible to get bounding box of a field as an AcroRect object ?
CAcroApp acroApp = new AcroAppClass();
CAcroAVDoc avDoc = new AcroAVDocClass();
CAcroRect acroRect = new AcroRectClass();
CAcroPDDoc pDDoc = new AcroPDDocClass();
if (!avDoc.Open(sample_pdf, ""))
return;
else
pDDoc = (CAcroPDDoc)avDoc.GetPDDoc();
IAFormApp formApp = new AFormAppClass();
IFields myFields = (IFields)formApp.Fields;
IEnumerator myEnumerator = myFields.GetEnumerator();
while (myEnumerator.MoveNext())
{
IField myField = (IField)myEnumerator.Current;
string fieldName = myField.Name;
string fieldType = myField.Type;
}
I need to replace myField of type checkbox to a text field of same size at same location. I can remove checkbox by
while (myEnumerator.MoveNext())
{
IField myField = (IField)myEnumerator.Current;
string fieldName = myField.Name;
string fieldType = myField.Type;
//Remove Checkbox field type
if(fieldType=="checkbox")
myFields.Remove(fieldName);
}
How can I add a text type field in the same position of checkbox ?
if(fieldType=="checkbox")
{
//Remove Checkbox field type
myFields.Remove(fieldName);
//Add text field type
myFields.Add(fieldName, "text", 0, acroRect.Left, acroRect.Top, acroRect.right, acroRect.bottom); // how to get acroRect object of a field ??
}
