Application crashes with exception while creating windows.data.pdf.pdfdocument for a particular PDF document
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
PdfDocument = result.GetResults();
Attached PDF document.
PDF document : https://drive.google.com/file/d/1lW59Nwvhnb6OXkWIQoJeF04aj32ezepn/view?usp=sharing
Kindly provide solution ASAP.
Ashok Kumar Viswanathan
I have something to confirm. Is it a UWP project? Does this issue happens to all the PDF files or it just for this PDF file you shared? Does this issue happen on other devices with the same PDF file?
Hi @Roy Li - MSFT ,
Yes, it is a UWP project. This issue does not occur all the PDF document. Only in the attached PDF document.
Does this issue happen on other devices with the same PDF file? -> Yes
Ashok Kumar Viswanathan.
Since other PDF works correctly, it looks like the issue might be more related to the specific PDF file. Would you like to generate a new PDF with the same content to test?
Yes, with other PDF document rendering works fine. We are really concerned with the provided PDF document only.
Would you like to generate a new PDF with the same content to test? -> No we could not. We need this issue to be resolved with the provided PDF document only. Same PDF document works fine with other competitors like Adobe.
Sign in to comment