Hi,
Environment: Aspose.PDF_10_3_0 and Aspose.PDF_10_9_0 versions.
I see an exception message: “A first chance exception of type ‘System.NullReferenceException’ occurred in Aspose.Pdf.dll” when I try to extract adobe fields using following code for the attached test document. Here is my code:
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(filename);
Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form(pdfDocument);
//get all field names
String[] allfields = form.FieldNames;
Aspose.Pdf.PageCollection pageCollection = pdfDocument.Pages;
Aspose.Pdf.InteractiveFeatures.Forms.FormType formType = pdfDocument.Form.Type;
string fieldFullName = “”;
Aspose.Pdf.Facades.FormFieldFacade fieldfacade = null;
foreach (Aspose.Pdf.InteractiveFeatures.Forms.Field formField in pdfDocument.Form.Fields)
{
fieldFullName = formField.FullName;
try
{
fieldfacade = form.GetFieldFacade(fieldFullName); // GIVES EXCEPTION AT THIS LINE
}catch (Exception e){
Trace.Write(e.Message);
}
}
1. How can I handle this error?
2. What is a work around for this?
Thank you,
Sireesha
Hi Sireesha,
Thanks
for using our API’s.<o:p></o:p>
I
have tested the scenario and I am able to notice the same problem. For the sake
of correction, I have logged this problem as PDFNEWNET-39540 in
our issue tracking system. We will further look into the details of this
problem and will keep you updated on the status of correction. Please be
patient and spare us little time. We are sorry for this inconvenience.
I also have this error
Hi Birgit,
I’ve just seen your reply. Did you already find a solution? See attached the document which produces the exception.
Thanks,
Birgit
Hi Birgit,
Aspose.Pdf.Document
pdfDocument = new Aspose.Pdf.Document(@“C:\Users\Home\Downloads\ErhbgsBogStammdatenStromVersorgerId8674doc.pdf”);<o:p></o:p>
Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form(pdfDocument);
//get all field names
String[] allfields = form.FieldNames;
Aspose.Pdf.PageCollection pageCollection = pdfDocument.Pages;
Aspose.Pdf.InteractiveFeatures.Forms.FormType formType = pdfDocument.Form.Type;
string fieldFullName = "";
Aspose.Pdf.Facades.FormFieldFacade fieldfacade = null;
foreach (Aspose.Pdf.InteractiveFeatures.Forms.Field formField in pdfDocument.Form.Fields)
{
fieldFullName = formField.FullName;
try
{
fieldfacade = form.GetFieldFacade(fieldFullName); // GIVES EXCEPTION AT THIS LINE
//pdfForm.FillField(fieldFullName, "44.name_vorname");
Console.WriteLine("field FullName: {0} page: {1}",formField.FullName, fieldfacade.PageNumber);
}
catch (Exception ex)
{
Trace.Write(ex.Message);
}
}
Please feel free to contact us for any further assistance.
Best Regards,