Issues with Aspose.PDF version 24.3.0

It seems that the issue was resolved by adding this line:
pdfFile.BindPdf(“”);

I smoke tested some scenarios and it worked.
Should I always include this line when I work with the class PdfFileInfo from now on?

Do I still need this to make it work?
System.Threading.Thread.Sleep(1000);

Also, I noticed another issue when I try upload and then download PDF files with data entries.
For instance:
PY 221 Label Notice_v8RE508 (Egg Form).pdf (179.1 KB)

How can I add a validation to prevent the users from uploading PDF files with data entries?

@jimmy.rojas

Yes, it is recommended and correct way to use PdfFileInfo Class.

No, it is not needed any more.

Do you mean to detect the PDF files with Form Fields?

I was referring to this line:
pdfFile.BindPdf(“”);

Yes, I meant to detect the PDF files with Form Fields.

Also, can I use this code snippet to check if a PDF file contains signatures?

public static bool IsSignedPdf(string filePath)
{
PdfFileSignature pdfSign = new PdfFileSignature();
pdfSign.BindPdf(filePath);
return pdfSign.ContainsSignature();
}

@jimmy.rojas

You can use below property to determine if PDF has any form fields or not:

Document.Form.Fields.Count

We upgraded the Aspose library to v25.7 recently, and deployed a new release of our application with this upgrade to PROD last Friday. Now, the users are reporting several issues uploading PDF files.

An item with the same key has already been added." source=“mscorlib” detail="System.ApplicationException: An item with the same key has already been added. StackTrace: at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add)
 at #=z9W8OEM$p8$g7694whr8T0jRxJwvdctJ1R$EeZ3ITou1EZTgHRw==.#=zkksCAzmrsk_H(#=zF7$jGz6kYTSr2nSyKQalEmRNcx7aLt08LC2n_xNOhF9u #=z_Ip$DbYUI972)
 at #=ziN9ESXTDEHqQ9i28HzgngITTo0InGFGHbGPsVxGPvQoB.#=ziM4g4g1Qaq0P(#=zF7$jGz6kYTSr2nSyKQalEmRNcx7aLt08LC2n_xNOhF9u #=zX9TZRmo=, Int64 #=zwCgSo68=, Nullable1& #=zeWA7mAE=) at #=ziN9ESXTDEHqQ9i28HzgngITTo0InGFGHbGPsVxGPvQoB.#=zAdIg0khetjot(List1 #=z4SqYp6Y=, #=zF7$jGz6kYTSr2nSyKQalEmRNcx7aLt08LC2n_xNOhF9u #=zX9TZRmo=, Int64 #=zwCgSo68=)
 at #=ziN9ESXTDEHqQ9i28HzgngITTo04SqYp6Y=, List1 #=zT_TJ_pEutgW6) at #=ziN9ESXTDEHqQ9i28HzgngITTo0InGFGHbGPsVxGPvQoB.#=zfSI77_wxPv0V(#=z_HFh1h9N21sQyH2FimgXElZP1Nonq7KQ_A== #=zS9hZG74=, #=zg4XhJOHcYaratJ4SSOf4w5XWCbJR9z_uxWwxf17D0AWA #=zW_iSz$GlvlBB5M7fLw==, Boolean #=zME0cRrIT6Zas, Boolean #=z7ygylo2byPvH) at #=ziN9ESXTDEHqQ9i28HzgngITTo0InGFGHbGPsVxGPvQoB.#=zfSI77_wxPv0V(#=z_HFh1h9N21sQyH2FimgXElZP1Nonq7KQ_A== #=zS9hZG74=, #=zg4XhJOHcYaratInGFGHbGPsVxGPvQoB.#=zCKB5i7bs0YurnjOhLw==(Stream #=zHKyIkptxFHabpfL$3Q==, Boolean #=z7ygylo2byPvH, List`1 #=zJ4SSOf4w5XWCbJR9z_uxWwxf17D0AWA #=zW_iSz$GlvlBB5M7fLw==) at Aspose.Pdf.OperatorCollection.#=zvq5X7UM6S3jG() at Aspose.Pdf.OperatorCollection.#=zYCo173xa$Z8C() at Aspose.Pdf.OperatorCollection.get_Count() at Aspose.Pdf.OperatorCollection.#=zzU1PmlA=.MoveNext() at Aspose.Pdf.Page.get_Layers()

When I check the logs, there are a lot of entries indicating issues with the product Aspose.PDF

The error in our log after trying to upload this PDF is:

An item with the same key has already been added." source=“mscorlib” detail="System.ApplicationException: An item with the same key has already been added. StackTrace: at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add)
 at #=z9W8OEM$p8$g7694whr8T0jRxJwvdctJ1R$EeZ3ITou1EZTgHRw==.#=zkksCAzmrsk_H(#=zF7$jGz6kYTSr2nSyKQalEmRNcx7aLt08LC2n_xNOhF9u #=z_Ip$DbYUI972)
 at #=ziN9ESXTDEHqQ9i28HzgngITTo0InGFGHbGPsVxGPvQoB.#=ziM4g4g1Qaq0P(#=zF7$jGz6kYTSr2nSyKQalEmRNcx7aLt08LC2n_xNOhF9u #=zX9TZRmo=, Int64 #=zwCgSo68=, Nullable1& #=zeWA7mAE=) at #=ziN9ESXTDEHqQ9i28HzgngITTo0InGFGHbGPsVxGPvQoB.#=zAdIg0khetjot(List1 #=z4SqYp6Y=, #=zF7$jGz6kYTSr2nSyKQalEmRNcx7aLt08LC2n_xNOhF9u #=zX9TZRmo=, Int64 #=zwCgSo68=)
 at #=ziN9ESXTDEHqQ9i28HzgngITTo04SqYp6Y=, List1 #=zT_TJ_pEutgW6) at #=ziN9ESXTDEHqQ9i28HzgngITTo0InGFGHbGPsVxGPvQoB.#=zfSI77_wxPv0V(#=z_HFh1h9N21sQyH2FimgXElZP1Nonq7KQ_A== #=zS9hZG74=, #=zg4XhJOHcYaratJ4SSOf4w5XWCbJR9z_uxWwxf17D0AWA #=zW_iSz$GlvlBB5M7fLw==, Boolean #=zME0cRrIT6Zas, Boolean #=z7ygylo2byPvH) at #=ziN9ESXTDEHqQ9i28HzgngITTo0InGFGHbGPsVxGPvQoB.#=zfSI77_wxPv0V(#=z_HFh1h9N21sQyH2FimgXElZP1Nonq7KQ_A== #=zS9hZG74=, #=zg4XhJOHcYaratInGFGHbGPsVxGPvQoB.#=zCKB5i7bs0YurnjOhLw==(Stream #=zHKyIkptxFHabpfL$3Q==, Boolean #=z7ygylo2byPvH, List`1 #=zJ4SSOf4w5XWCbJR9z_uxWwxf17D0AWA #=zW_iSz$GlvlBB5M7fLw==) at Aspose.Pdf.OperatorCollection.#=zvq5X7UM6S3jG() at Aspose.Pdf.OperatorCollection.#=zYCo173xa$Z8C() at Aspose.Pdf.OperatorCollection.get_Count() at Aspose.Pdf.OperatorCollection.#=zzU1PmlA=.MoveNext() at Aspose.Pdf.Page.get_Layers()
When I check the logs, there are a lot of entries indicating issues with the product Aspose.PDF

Also, there are a lot of entries in our logs with this error message:

Object reference not set to an instance of an object." source=“Aspose.PDF” detail="System.ApplicationException: Object reference not set to an instance of an object. StackTrace: at Aspose.Pdf.Page.#=zWYq$LPbwgIUe() at Aspose.Pdf.Page.get_Layers() at LSAS_Web.Common.Support.DocumentHelper.ValidateFileAttributes(String filePath) at LSAS_Web.Areas.LabelApplication.Controllers.Edit.Step4Controller.ValidateFileAttributes(String filePath) at LSAS_Web.Areas.LabelApplication.Controllers.Edit.Step4Controller.UploadDocument(DocumentationInfoModel formModel) at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters)&#xD;&#xA; at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult2.CallEndDelegate(IAsyncResult asyncResult)&#xD;&#xA; at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult)&#xD;&#xA; at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) —> System.NullReferenceException: Object reference not set to an instance of an object. at Aspose.Pdf.Page.#=zWYq$LPbwgIUe() at Aspose.Pdf.Page.get_Layers()

Apparently, there is a problem with this get_Layers() method.

This is a PDF file that users have reported they are unable to upload into our application.

THLG-2025-Beef-Protocol.pdf (397.5 KB)

There is a problem when it tries to read from the the property Layers.
This is the code snippet:

Aspose.Pdf.Document document = new Aspose.Pdf.Document(filePath);
foreach (Page page in document.Pages)
{
List<Aspose.Pdf.Layer> layers = page.Layers;
if (layers != null && layers.Count > 0)
{
errors.Add(ValidationMessage.Keys.DocumentationInfoModelKeys.PDF_CONTAINS_LAYERS);
break;
}
}
document.Dispose();

@jimmy.rojas

Is it happening with all kind of PDF files that you are processing? Can you please share one sample file with the code sample that is causing this exception? We will test the scenario in our environment and address it accordingly.

Hi,
It throws an error with several PDF files that have multiple pages.
I’ve already shared a PDF sample and the code snippet yesterday.

It’s failing in this line:
List<Aspose.Pdf.Layer> layers = page.Layers;

I’m sharing again a couple of PDF samples to troubleshoot.

THLG-2025-Beef-Protocol.pdf (397.5 KB)

VK_907563_TurkeyItalian_Stuffing_Live_2025_40oz-compressed.pdf (300.5 KB)

Please advise.

@jimmy.rojas

We were able to reproduce these errors in our environment with 25.8 version of the API. Therefore, below tickets have been registered in our issue tracking system for your PDF documents:

  • PDFNET-60548 (VK_907563_TurkeyItalian_Stuffing_Live_2025_40oz-compressed.pdf)
  • PDFNET-60549 ( THLG-2025-Beef-Protocol.pdf)

We will look into the details of the ticket and let you know as soon as they are resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.

Ok, I understand. When do you think your team can resolve this issue? Can you provide any estimate?
Currently, our users are experiencing a lot of issues in our PROD environment. We need to evaluate if we have to address this problem with other options.

@jimmy.rojas

We are afraid that an estimate cannot be provide at the moment because the tickets are pending for initial analysis. The issues in free support model are prioritized on first-come, first-served basis and as soon as we complete the investigation, we will be able to share some ETA with you. The resolution time depends upon the number of issues logged prior to these tickets. We highly appreciate your patience and comprehension in this regard.

We are sorry for the inconvenience.

Good morning,

Is there any news? It’s been two weeks now, and our users have reported numerous issues. Please let me know if there are any updates regarding this matter.

@jimmy.rojas

We are afraid that the earlier logged ticket(s) have not been yet resolved due to other issues in the queue which were logged prior to this. Nevertheless, your concerns have already been recorded and we will surely consider them during the investigation process. We will inform you once we have some definite updates about ticket resolution. We apologize for the inconvenience caused.

Good morning,

Is there any news on this matter?

@jimmy.rojas

We are afraid that no updates are available at the moment as investigation hasn’t been completed. Nevertheless, we will inform you once we have some certain news in this regard. We highly appreciate your patience in this regard.

Hello,

Just checking in to see if there are any updates on this issue.

@jimmy.rojas

Sadly, the tickets are not yet resolved. Once there are any definite updates regarding issue fix, we will let you know via this forum thread. We apologize for your inconvenience.