Free Support Forum -

Aspose PDF throws error stamping some PDF files- mixed results on one it stamps

Running Aspose PDF 7.1
Version 7.1 throws the following error when stamping some PDF files. The error is thrown on the PdfFileStamp object close method. No output file is produced.
Other PDFs don't throw this error and are stamped correctly.

9/26/2012 11:19:31 AM: An error occurred: '{0}'System.NullReferenceException: Object reference not set to an instance of an object.
at ..€()
at Aspose.Pdf.Document.€(Boolean )
at Aspose.Pdf.Facades.PdfFileStamp.€()
at Aspose.Pdf.Facades.PdfFileStamp.Close()
at PDFStamp.Program.Main(String[] args) in C:\Users\lovett-sw\Documents\Visual Studio Projects\PDFStamp_Aspose_DSA_R1-newPDF-FIPS_test\PDFStamp\PDFStamp.cs:line 402.

Running Aspose PDF 7.3
If I am running 7.3 with the same instantiation code as 7.1 (i.e. nothing is changed but the dll), I get the same results. It abends on some files, but stamps others.
Here's the 7.1 instantiation of PdfFileStamp:
PdfFileStamp stamper = new PdfFileStamp(inputfilename, outputfilename);
However, the compiler throws a warning that that method is obsolete.

If I am running 7.3 and change the PdfFileStamp instantiation code to get rid of the obsolete methods, the same PDF files throw an error (different error output - see below) and the same PDFs don't throw an error. The difference is that both produce an output file but the output file is not stamped, even when the error is not thrown.
Here's the new instantiation code:
PdfFileStamp stamper = new PdfFileStamp();

The error occurs on the AddStamp method now and looks like this:
9/26/2012 1:37:53 PM: An error occurred: '{0}'System.NullReferenceException: Object reference not set to an instance of an object.
at ..€()
at Aspose.Pdf.Stamp.drawStampOnPage(Page page, String name)
at Aspose.Pdf.TextStamp.Put(Page page)
at Aspose.Pdf.Facades.PdfFileStamp.€(Stamp , Int32 )
at Aspose.Pdf.Facades.PdfFileStamp.€(Stamp )
at Aspose.Pdf.Facades.PdfFileStamp.AddStamp(Stamp stamp)
at PDFStamp.Program.Main(String[] args) in C:\Users\lovett-sw\Documents\Visual Studio Projects\PDFStamp\PDFStamp\PDFStamp.cs:line 372.

In both cases the same error, but different verbiage around it.

I will upload a PDF that throws the error.

If I can clarify, let me know what I need to do. However, I am out of the office until 10/8 so unless I hear from you today (9/26), I will not be able to respond until then.



Hi Steve,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the template file.

I am able to reproduce the issue regarding stamping your shared PDF file using the latest version of Aspose.Pdf for .NET v7.3. The issue has been registered in our issue tracking system with issue id: PDFNEWNET-34301. We will notify you via this forum thread regarding any updates against your reported issue.

Sorry for the inconvenience,

The issues you have found earlier (filed as PDFNEWNET-34301) have been fixed in Aspose.Pdf for .NET 7.5.0.

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

I ran the files that had been throwing an error against 7.5 and they worked fine. Good job!