Hi Alex,
The end user is creating a new PDF document and adding fields to the document using the Editor ActiveX object. Just using the built in commands so nothing fancy there. The user then uses one of my custom commands in the ActiveX Editor to submit the PDF form as a template to my webservice. In the button code I try to use the core layer to retrieve the acroform object to do my validation, which is null. If I save the document, close it and open it again then the acroform object is refreshed and I can do the validation. So again, the question is how to I refresh the AcroForm object to contain the form objects without having to save, close and re-open the document?
Here is a mock up of what is happening. "HasAcroForm" returns false, and when checking the "AcroForm" object it is null even though the user has added fields.
Code: Select all
// Confirm this is a form
if (axPXV_Control1.Inst.ActiveDoc.CoreDoc.HasAcroForm == true)
{
// Confirm all required fields exist
IPXC_AcroForm acroForm = axPXV_Control1.Inst.ActiveDoc.CoreDoc.AcroForm;
IPXC_FormField formF1 = acroForm.GetFieldByName("Field1");
IPXC_FormField formF2 = acroForm.GetFieldByName("Field2");
if (formF1 == null || formF2 == null)
{
MessageBox.Show("The required fields are not populated on the form.", "Upload Form Template", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else
{
// Do my processing here
}
}
else
MessageBox.Show("The document is not an AcroForm.", "Upload Form Template", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
Please let me know if there is anything that is not clear, or if you need any other information.