New Aspose.pdf.Document hangs on small PDF

One of our clients has a PDF in their system that causes Aspose.PDF to hang when we try to open it.

It’s quite a small document and it looks like just a generic “ad” to be placed in a newspaper or something.

Can I send you a sample to investigate? We can deal with a call to New Aspose.pdf.Document(sFileName) failing, but we can’t deal with it never completing.

If I might make a suggestion… you could add an override on the constructor to allow us set a Timeout in seconds;

Aspose.Pdf.Document.New(string filename, int timeoutinseconds)

for example, and throw an error if the constructor hasn’t completed within the specified time frame?

I should also mention that we’re using Aspose.PDF 24.5.0

Yes, please attach it and tell us what OS and SDK you are running on.
Is this document openable by viewers (primarily Adobe Acrobat)?

The development team recently added the ability to use CancellationToken for Document.Save. I will clarify whether they plan to do something similar to create (open) a document.
And how would you feel about such an opportunity (this is still different, not a timeout)?
At the moment, we can only suggest creating a document opening in a separate task with a timeout.

1 Like

Thank you, can you give me a private link to upload the document?

You can attach the document here; only the topic author and administrators will see it.
Or you can use the approach described here (And check checkbox “Private Topic” besides.)


Hello Sergei,

The PDF opens fine in my PDF reader (Foxit) on Windows 11.

I’m not sure I understand what you mean by “SDK”? We’re using Aspose.PDF 24.5.0 in a .NET Framework 4.8 solution. Is that the information you’re looking for?

Kind regards

Pino Carafa

Thank you, I was interested in this, sorry for not being clear about it.

For your peace of mind, I will remove the attached document from the forum (keeping it locally).

1 Like

Thank you. Yes it didn’t really contain anything of a remotely sensitive nature but better safe than sorry.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-57182,PDFNET-57183

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

1 Like

Created tasks for the development team
Bug #PDFNET-57182: Call new Document(string) hangs
Feature #PDFNET-57183: Add the ability to use a Timeout or CancellationToken when open a document

1 Like

Fantastic. Have a great weekend Sergei. Will check back in on Tuesday.

Unfortunately, problems are not solved as quickly as they are set.

1 Like