We added forms to existing pdfs in order to track certain values. We make good use of AddFieldAppearance. However fields that use this feature are not available in the Fields list of the final aspose document.
Hi Linda,
Running this simple check…only fields that are not duplicated are returned using the Aspose.Pdf. Thank you for your assistance.
static void ShowValues(string path)
{
Document pdfDocument = new Document(path);
// Get values from all fields
Console.WriteLine(">>> Show Values for " + path);
foreach (Field formField in pdfDocument.Form)
{
Console.WriteLine(“Field Name: {0} Field Value: {1}”, formField.PartialName, formField.Value);
}
Console.ReadLine();
}
Also please know that I have been able to get to the fields and values using ADOBE Reader and more recently freeware used to read pdfs.
thank you again.
Hi Linda
Thanks for your feedback. You can get value and position of these duplicate fields using Aspose.Pdf as following.
var pdf1 = new Document(@"D:/Downloads/Q01-01001.pdf");
var formtyp = pdf1.Form.Type;
var pdfForm = new Aspose.Pdf.Facades.Form(pdf1);
foreach (var field in pdf1.Form.Fields)
{
var fieldFullName = field.FullName;
var facadeField = pdfForm.GetFieldFacade(fieldFullName);
var fieldType = pdfForm.GetFieldType(fieldFullName);
if (field.Count > 0)
{
foreach (Aspose.Pdf.Annotations.Annotation annot in field)
{
Console.WriteLine("Field Name: {0}, Field Value: {1}, Field Type: {2}, Page number: {3}, count: {4}, rect: {5}",
fieldFullName, field.Value, fieldType, facadeField.PageNumber, field.Count, annot.Rect);
}
}
else
{
Console.WriteLine("Field Name: {0}, Field Value: {1}, Field Type: {2}, Page number: {3}, count: {4}",
fieldFullName, field.Value, fieldType, facadeField.PageNumber, field.Count);
}
}
Please feel free to contact us for any further assistance.
Best Regards,
Thank you so much for your prompt support. That worked perfectly.
kind regards,
linda
Hi Linda,