Hi All,
Can we read form fields from PDF using Spire.PDF. If it is possible, can someone provide me with a sample with C#?
Thanks in advanced. Much appreciated
PdfDocument doc = new PdfDocument();
doc.LoadFromFile(FilePath + "FormFieldData.pdf");
//Get form
PdfFormWidget formWidget = doc.Form as PdfFormWidget;
for (int i = 0; i < formWidget.FieldsWidget.List.Count; i++)
{
PdfField field = formWidget.FieldsWidget.List[i] as PdfField;
if (field is PdfTextBoxFieldWidget)
{
PdfTextBoxFieldWidget textBoxField = field as PdfTextBoxFieldWidget;
//Get the text
string s =textBoxField.Text;
...
}
}
PdfDocument doc = new PdfDocument();
pdfDoc.Security.OwnerPassword = "";
pdfDoc.Security.UserPassword = "";
pdfDoc.Security.Permissions = PdfPermissionsFlags.AccessibilityCopyContent | PdfPermissionsFlags.AssembleDocument | PdfPermissionsFlags.CopyContent | PdfPermissionsFlags.Default | PdfPermissionsFlags.EditAnnotations | PdfPermissionsFlags.EditContent | PdfPermissionsFlags.FillFields | PdfPermissionsFlags.FullQualityPrint | PdfPermissionsFlags.Print;
pdfDoc.SaveToFile(outputFile.OutPutFilePath);
pdfDoc.Close();
doc.Security.OwnerPassword = "";
doc.Security.UserPassword = "";
doc.Security.Permissions = PdfPermissionsFlags.Default;