Windows.Data.Pdf.PdfDocument Crash with file size greater than 2GB

Jérôme S 5 Reputation points
2024-11-12T17:59:23.92+00:00

Same issue as here (no replies there, it's an old thread)
https://learn.microsoft.com/en-us/answers/questions/248422/windows-data-pdf-pdfdocument-crash

My notes:

Crash is not catchable which makes it really hard to find reason for issue or workaround.

I've tried the file in the official demo sample app and it crashes too. The file can be opened in other PDF software (including Edge - although slowly - which is funny because I think it uses the Windows.Data.Pdf library as well if I'm correct?)

After a bit more research, it seems the size is indeed what makes it crash. Another PDF lib I tried crashed similarly when the stream length exceeded Int32.MaxValue. The exception was catchable in this one so I could get a proper error message.

My laptop has 16GB of ram (nothing else running really) and 140GB free SSD space so I hope that's not the issue.

I can provide a storage link to a crashing file if necessary.

Same error on Windows 10 and Windows 11, both 64 bits, app is 64 bits.

Universal Windows Platform (UWP)
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,072 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.