- Home
- Forum
- Xamarin.Forms
- How can I feed the password in the viewmodel to display a password protected pdf in SfPdfViewer
How can I feed the password in the viewmodel to display a password protected pdf in SfPdfViewer
I have a password protected pdf that I would liked to display in my SfPdfViewer without asking the user to enter the password. I will be feeding the password through the viewmodel. I tried to use some code under "Set user password using event when accessing the attachment" on this page: https://help.syncfusion.com/file-formats/pdf/working-with-security?cs-save-lang=1&cs-lang=xamarin and came up with the following.
I need a way to feed document22 into the pdfviewer because the code below still asks for password once the pdf loads.
//========================
{
Stream docStream = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("Sample.Assets.Input.pdf");
//Creates an empty PDF loaded document instance
PdfLoadedDocument document22 = new PdfLoadedDocument(docStream, "password");
MemoryStream stream1 = new MemoryStream();
document22.Save(stream1);
PdfDocumentStream = stream1;
}
public Stream PdfDocumentStream
{
get { return m_pdfDocumentStream; }
set
{
m_pdfDocumentStream = value;
OnPropertyChanged();
}
}
//=======================================
In the view I have "InputFileStream="{Binding PdfDocumentStream, Mode=TwoWay}" for the sfPdfViewer
Thanks,
Madhu
SIGN IN To post a reply.
2 Replies
AV
Ashokkumar Viswanathan
Syncfusion Team
June 29, 2020 07:33 AM UTC
Hi Madhu,
Greetings from Syncfusion support,
Currently, we have the support to load encrypted PDF document only using the following API,
|
pdfViewerControl.LoadDocument(stream,”password”); |
We do not have the support to load the encrypted document by passing the pdfStream to the InputStream of SfPdfViewer control. Currently, we are analyzing the feasibility for the support and we will update the further details on July 1st 2020.
Regards,
Ashok Kumar Viswanathan.
AV
Ashokkumar Viswanathan
Syncfusion Team
July 1, 2020 03:09 PM UTC
Hi Madhu,
At present, we do not have support to load password protected PDF using data binding in Xamarin platform. We do not have any immediate plans to implement this feature. At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest.
Based on our present commitments and the above parameters, this feature is expected to be implemented in our 2021 Volume 3 Main Release. We will let you know when this feature is implemented.
Disclaimer: The date for the feature implementation is tentative and not a commitment on our parts.
You can now track the status of this feature request here,
Regards,
Ashok Kumar Viswanathan.
SIGN IN To post a reply.
- 2 Replies
- 2 Participants
-
MG Madhu Ganesh
- Jun 27, 2020 12:33 AM UTC
- Jul 1, 2020 03:09 PM UTC