我正在尝试使用 Aspose 设置 pdf 中字段的值。 此 pdf 在 ITextSharp 中运行良好。 这是我正在经历的主要挫折。
这是我的代码
string outputPdf = String.Format(@"C:\PDF\output\test{0:dd-MM-yyyy-HH-mm-ss}.pdf", DateTime.Now);
string inputPdf = @"C:\PDF\application.pdf";
Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form(inputPdf, outputPdf);
form.FillField("MY_FIELD", "Test Value");
form.FlattenAllFields();
form.Save();
该行Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form(inputPdf, outputPdf);
导致错误。
异常详细信息:System.NullReferenceException:对象引用未设置为对象的实例。
这是堆栈跟踪
[NullReferenceException:对象引用未设置为对象的实例。] 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