Error when attempting to create new Form object

I was recommended to Aspose by a Developer Evangelist. I am in the process of evaluating several PDF solutions in order to make a recommendation. My goal is to fill out forms in several PDF files given to me by outside sources. My first test was with a competitor, ITextSharp, which opened the PDF and filled out the form very easily. I’m not sure why, but Aspose throws an error on this pdf.


I was directed towards this example http://www.aspose.com/documentation/.net-components/aspose.pdf-for-.net/fill-form-fields-in-an-existing-pdf-file-facades.html

and here is my code.

string outputPdf = String.Format(@“C:\PDF\Test\Test{0:dd-MM-yyyy-HH-mm-ss}.pdf”, DateTime.Now);
string inputPdf = @“C:\PDF\Application - Blank.pdf”;
Aspose.Pdf.Facades.Form form = null;
try
{
form = new Aspose.Pdf.Facades.Form(inputPdf, outputPdf);

form.FillField(“ASSOCIATE_NUM”, GetValue(config.ApplicationParameters.Associate));
form.FillField(“CHAIN_NUM”, GetValue(config.ApplicationParameters.Chain));
form.FillField(“MID”, GetValue(config.ApplicationParameters.MID));
form.FillField(“MERCHANT_CATEGORY_CODE”, GetValue(config.ApplicationParameters.MCCCode));

form.FlattenAllFields();
form.Save();
}
catch
{
throw;
}
finally
{
}

The line that errors ins the line where I am instantiating the Aspose.Pdf.Facades.Form. The error is a null reference exception.

[NullReferenceException: Object reference not set to an instance of an object.] Aspose.Pdf.EmbeddedFileCollection.( node, Hashtable hash) +57 Aspose.Pdf.EmbeddedFileCollection…ctor(Document document) +161 Aspose.Pdf.Document.() +58 Aspose.Pdf.Document.(Stream input, String password) +181 Aspose.Pdf.Facades.Form…ctor(String srcFileName, Stream destStream) +92

Hello Josh,

Thanks for your interest in our products.

Recently we have released a merged version of Aspose.Pdf for .NET 6.0.0 which provides the combined features of Aspose.Pdf for .NET (a component which provides the capability to create PDF documents from scratch) and Aspose.Pdf.Kit for .NET (provides the capability to manipulate/edit existing PDF documents) and we have observed that an issue is occurring when using this release to fill form fields. For the sake of correction, its already logged in our issue tracking system as PDFNEWNET-29360 and our development team is working hard to get this fixed. As soon as the problem is resolved, we would be more than happy to update you with the status of correction. We are really sorry for this inconvenience.

You may try using the classes and methods of Aspose.Pdf namespace. Please visit the following link for information on
Fill Form Field in a PDF Document

codewarior:
Hello Josh,

Thanks for your interest in our products.

Recently we have released a merged version of Aspose.Pdf for .NET 6.0.0 which provides the combined features of Aspose.Pdf for .NET (a component which provides the capability to create PDF documents from scratch) and Aspose.Pdf.Kit for .NET (provides the capability to manipulate/edit existing PDF documents) and we have observed that an issue is occurring when using this release to fill form fields. For the sake of correction, its already logged in our issue tracking system as PDFNEWNET-29360 and our development team is working hard to get this fixed. As soon as the problem is resolved, we would be more than happy to update you with the status of correction. We are really sorry for this inconvenience.

You may try using the classes and methods of Aspose.Pdf namespace. Please visit the following link for information on
Fill Form Field in a PDF Document

I tried your suggestion and I still get an error.

document = new Document(inputPdf);

throws the error
[NullReferenceException: Object reference not set to an instance of an object.]
   Aspose.Pdf.EmbeddedFileCollection.a( node, Hashtable hash) +57
   Aspose.Pdf.EmbeddedFileCollection..ctor(Document document) +161
   Aspose.Pdf.Document.() +58
   Aspose.Pdf.Document.a(String fileName, String password) +88
   Aspose.Pdf.Document..ctor(String filename, String password) +27
This is version 6.0.0 of the Aspose.Pdf download. 

Hello Josh,

Can you please share the source PDF document so that we can test the scenario at our end. We apologize for your inconvenience.

Hello Josh,

Thanks for sharing the resource file.

We are working over this query and will get back to you soon. We are sorry for the delay and inconvenience.

The issues you have found earlier (filed as 29360) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(10)