I am creating several merge documents and writing to each document as part of a process. Once I am finished with each form, I combine them all into a single merge document. Most of the forms have the same fields on them, but a few have different fields. I am using a line like this:
doc.Form.Fields[FieldPosition].CreateLabel(page, FieldValue, fieldFont, fieldFontSize, TextAlign);
where FieldPosition is a string representation of the field name. What I'd like to be able to do before I call this line is to check if that is a field on the pdf form. If it is, then write to it. If it is not, then I'd skip over the above call. Is there a method for doing so?
Check if Field Exists
Re: Check if Field Exists
Support · Nov 30, 2009Hello,
There is no functionality to check if a field is present in the PDF or not using its name directly in our API. However you will be able to find it by using the Try Catch block from .NET. When you try to access a field with a name and if the field is not present then it will through an error. You will have to catch this exception and then proceed for the next step.
Thanks,
ceTe Software Support Team.
Re: Check if Field Exists
Forum member · Nov 30, 2009Thanks. That's what I was doing for testing. Can I suggest adding this as a possible future enhancement?
Re: Check if Field Exists
Support · Nov 30, 2009Hello,
We will add this feature to our wish list and we will forward this over to the developers to consider adding to a future version. But currently we do not have any immediate plans on adding this feature.
Thanks,
ceTe Software Support Team.