In vb.net, how do I identify the checkboxes in a pdf form, look through them, and replace any that are checked with an X?
Hi Regan,
Dim pdf1 = New Document(myDir + “input_checkbox.pdf”)<o:p></o:p>
Dim pdfForm = New Aspose.Pdf.Facades.Form(pdf1)
For Each field As var In pdf1.Form.Fields
Dim fieldFullName = field.FullName
Dim facadeField = pdfForm.GetFieldFacade(fieldFullName)
Dim fieldType = pdfForm.GetFieldType(fieldFullName)
If fieldType.ToString() = "CheckBox" Then
TryCast(pdf1.Form(fieldFullName), CheckboxField).Style = BoxStyle.Cross
Console.WriteLine("Field Name: {0}, Field Type: {1}", fieldFullName, fieldType)
End If
Next
pdf1.Save(myDir + "output_checkbox.pdf")
Please feel free to contact us for any further assistance.
Best Regards,
Thank you for the info. Unfortunately, I’m getting an error when I implement the code below. (Note that my nonSignatureToken array below provides the field name.) The error is: An unhandled exception of type ‘System.StackOverflowException’ occurred in mscorlib.dll
Hi Regan,
I have sent an email to you with the requested information. Thank you.
Hi Regan,
I’ve identified the issue, but not the solution: When you have multiple checkboxes with the same name, adobe automatically numbers them with a #Number afterward. (For example: FieldName#1, FieldName#2). In this case, you will get the error mentioned at the top of this thread.
Hi Regan,