We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Pdf.Page.AddStamp method throws exception for specific pdf file

We are using your product to parse text, concatenate and renumber pdf documents, and your tools have been working great. We are into our verification cycle, and we came across a specific pdf file that throws the following exception when we call the AddStamp method:

Item has already been added. Key in dictionary: ''œ.'' Key being added: ''œ.''

The stack trace:
at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
at System.Collections.Hashtable.Add(Object key, Object value)
at Aspose.Pdf.OperatorCollection.(† )
at Aspose.Pdf.OperatorCollection.€(† )
at Aspose.Pdf.OperatorCollection..ctor(‡ , † )
at Aspose.Pdf.OperatorCollection..ctor(† )
at Aspose.Pdf.Page.get_Contents()
at Aspose.Pdf.Resources.€(Page )
at Aspose.Pdf.Page.get_Resources()
at Aspose.Pdf.TextStamp.Put(Page page)
at Aspose.Pdf.PageNumberStamp.Put(Page page)
at Aspose.Pdf.Page.AddStamp(Stamp stamp)
at MUSE.Services.Reports.Pdf.PdfGenerator.PageWaterMark(String pdfPath)

Since this is working for the hundreds of other pdf we are testing with we believe that the code is correct, and it is some specific property of the pdf file causing the exception, however we have not been able to isolate this and thought it would be easy for you to diagnose.

We are using File Version Product Version 2013.02.05 of the Aspose.Pdf.dll
and I have attached the specific pdf file.

Thanks and I look forward to a response.

Hi Bob,

Thanks for contacting support.

I have tested the scenario using Aspose.Pdf for .NET 9.9.0 where I have used the code snippet shared over following link and I am unable to notice any issue. The PDF document is properly being stamped. Please try using the latest release and in case you still face the same issue or you have any further query, please feel free to contact. We are sorry for your inconvenience.