We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

.NET Aspose.PDF.Kit How to reset a form field

Is there a way to add a button dynamically to clear a form field value?

(Refer to the attachment for the equivalent functionality in Acrobat Pro)

What I would like to do is to go thru each Radio Button group and create a button next to each radio button group called “Clear”. When the button is pressed, I would like to clear the radio button value (since it can’t be unclicked once a user clicks on it).

Here is the code I came up so far but it doesn’t seem like adding any buttons.
And I am not sure what to pass to “url” parameter of “AddSubmitBtn” method.

public void FillTemplate(string pdfTemplate)
string fname = Guid.NewGuid().ToString();
string fname1 = fname + “_1.pdf”;
fname = fname + “.pdf”;

string srcFile = Path.Combine(_context.Request.PhysicalApplicationPath,
string.Format(@"{0}{1}", TempOutput, fname1));
string destFile = Path.Combine(_context.Request.PhysicalApplicationPath,
string.Format(@"{0}{1}", TempOutput, fname));

if (!Directory.Exists(Path.GetDirectoryName(srcFile)))

var pdfFileStamp = new Kit.PdfFileStamp(pdfTemplate, srcFile);
var fileNumber = GetFileNumber(_clientId);
var formattedText = new Kit.FormattedText(
string.Format(“WL# {0}”, fileNumber),
Kit.EncodingType.Winansi, true, 8F);

pdfFileStamp.AddFooter(formattedText, 10F, 10F, 10F);

var fc = new Kit.FormFieldFacade { FontSize = 8F };
var fe = new Kit.FormEditor(srcFile, destFile) { Facade = fc };

var form = new Kit.Form(destFile, _context.Response.OutputStream);
string[] fieldNames = form.FieldNames;
// Add “clear” button next to radio buttons
for (int i = 0; i < fieldNames.Length; i++)
if (form.GetFieldType(fieldNames[i]) != Kit.FieldType.Radio) continue;

Kit.FormFieldFacade facade = form.GetFieldFacade(fieldNames[i]);
fe.AddSubmitBtn(string.Format("{0}Clear", fieldNames[i]), facade.PageNumber, “Clear”, “”,
facade.Box.Top, facade.Box.Left, 40 ,20);



Hi Sung,

Thanks for contacting support.

As per my understanding, you are using legacy Aspose.Pdf.Kit for .NET. Please note that Aspose.Pdf.Kit for .NET has been discontinued as separate product and all its classes and enumerations are moved under Aspose.Pdf.Facades namespace of Aspose.Pdf for .NET. Furthermore, the AddSubmitBtn(…) method is used submit filled form values to external website/URL. As per your requirements, you may consider resetting the values of RadioButton groups. I would suggest you to please follow the instructions specified over

In case you encounter any issue, please share the resource file so that we can test the scenario at our end.