Application crashes with exception while creating windows.data.pdf.pdfdocument for a particular PDF document

Ashok Kumar 1 Reputation point
2021-07-13T07:39:28.247+00:00

Description : We have been using Windows run time API windows.data.pdf.pdfdocument to access the PDF pages and we will convert the pdf pages into Image, to view the page content in our custom control. However we are facing exception while converting input stream to PdfDocument

Code snippet to replicate the issue:
// Stream is input stream of PDF document
stream.Position = 0;
randomStream = await ConvertToRandomAccessStream(stream as MemoryStream);
IAsyncOperation<global::Windows.Data.Pdf.PdfDocument> result = global::Windows.Data.Pdf.PdfDocument.LoadFromStreamAsync(randomStream, passWord);
// Throws one or more exception at this line
result.AsTask().Wait();
PdfDocument = result.GetResults();

Attached PDF document.

PDF document : https://drive.google.com/file/d/1lW59Nwvhnb6OXkWIQoJeF04aj32ezepn/view?usp=sharing

Kindly provide solution ASAP.

Regards,
Ashok Kumar Viswanathan

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,316 questions
Universal Windows Platform (UWP)
{count} votes