Is there a way to display an encrypted file in PdfViewer ?
I created a file:
formatProvider = new Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider();
formatProvider.ExportSettings.UserPassword = "xxx";
formatProvider.ExportSettings.IsEncrypted = true;
formatProvider.Export( ...)
And now I want to display it, but haven't found a place to pass a password to the viewer.
It's not displaying any error, it's just displaying - the correct number of - empty pages.
7 Answers, 1 is accepted
Hello Holger,
RadPdfViewer currently doesn't support password-protected documents. We already have logged a request to provide you with such a functionality: ADD. RadPdfViewer - support for password-protected documents. You can use this item to vote for the implementation of the feature as well as to subscribe for notifications about status changes on it.
Regards,
Tanya
Progress Telerik
Hello Holger,
You can open and modify protected PDF documents using the API of PdfProcessing. However, conversion to other formats is currently unavailable. We have logged a task to expose PDF import functionality in WordsProcessing. This feature will allow you to import PDF documents and export them to rich text documents. You can vote for the implementation of the task as well as subscribe to track its status using the related public item: WordsProcessing: Implement import from PDF.
Regards,
Tanya
Progress Telerik
OK, for myself or for other reader I found a solution, how to remove the encryption.
var formatProvider = new Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider();
formatProvider.ImportSettings.UserPasswordNeeded += ImportSettings_UserPasswordNeeded;
var doc = formatProvider.Import(file);
file = formatProvider.Export(doc);
radPdfViewer1.LoadDocument(new MemoryStream(file));
with
private void ImportSettings_UserPasswordNeeded(object sender, PasswordNeededEventArgs e)
{
e.Password = "xxx";
}
If it's so easy, it't not worth "logging a request".
Hi Holger,
Yes, that could be an approach for loading such a document. The downside of this approach is that you will always need to resolve the password in your code. The feature request we have logged is to directly allow the user opening the document to enter the password for it through the UI. We believe that such a feature would be a nice enhancement to the control and that is why we have it on our portal.
Regards,
Tanya
Progress Telerik
This is not really an intelligent feature. If this is the current feature request, you should extend it, or open an other request.
Having a user to enter the same password twice (for creation and for view) can not be solved, if the control asks the user directly.
I want to avoid, the user being asked.
Hi Holger,
Thank you for sharing your feedback. I have added the case to our internal item to ensure that the developer who will implement the feature will take this possibility into account as well. Although in this case really doesn't make sense to force the user to provide their password twice, it would be a security breach if they can open a protected document without the password in the control. The viewer doesn't depend on how the document was created and doesn't have notion about that. However, I believe that after unifying the models of PdfViewer and PdfProcessing (which we are currently working on), passing the document that has been just created within the model, could be done without prompting for a password.
Regards,
Tanya
Progress Telerik