Hi Dung,
You have mentioned the crash in Xamarin Forms platform. We were not able to reproduce the crash in Xamarin Forms platform. In Xamarin Forms platform there is no support for password protected PDF documents. When such PDF is loaded the UnhandledConditionOccurred event will be raised.
By the code snippet you have provided we guessed that you are using UWP platform. This is not a defect of PdfViewer. Password protected PDFs can be loaded using the overload method LoadDocument(Stream stream, string password) in which the password of the PDF should be provided as the second argument.
Please find the code snippet below.
var stream = new FileStream(file.AbsolutePath, System.IO.FileMode.Open, System.IO.FileAccess.Read);
sfPdfViewer.LoadDocument(stream, "password");
where the string “password” must be the corresponding password of the PDF document.
We have attached a simple sample in the following link for your reference.
Kindly place the PDF in the attachment in the local folder of the application before running the sample. The password of the PDF is “syncfusion".
Kindly confirm whether the platform is UWP or Xamarin Forms. If it is Xamarin Forms, please provide us with the PDF document and a simple sample with which the issue could be reproduced. That way we will be able to understand the issue and provide a proper solution.
Best,
Navaneetha Kannan