This is a migrated thread and some comments may be shown as answers.

Encrypted PDF-Files in PdfViewer

7 Answers 436 Views
PdfViewer and PdfViewerNavigator
This is a migrated thread and some comments may be shown as answers.
Holger
Top achievements
Rank 1
Holger asked on 17 Feb 2020, 10:38 AM

 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

Sort by
0
Tanya
Telerik team
answered on 17 Feb 2020, 12:40 PM

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

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Holger
Top achievements
Rank 1
answered on 17 Feb 2020, 12:56 PM
OK, Thanks, and is there anything else, what one can do with encrypted documents ? Any conversion to another Format or so ..
0
Accepted
Tanya
Telerik team
answered on 18 Feb 2020, 08:59 AM

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

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Holger
Top achievements
Rank 1
answered on 18 Feb 2020, 04:35 PM

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".

0
Tanya
Telerik team
answered on 19 Feb 2020, 01:04 PM

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

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Holger
Top achievements
Rank 1
answered on 19 Feb 2020, 01:29 PM
If I create a password encrypted pdf with your tools, I (the developer) want to present the pdf to the user, without having the user to enter a password a second time. You enter a password, create the pdf, and to view it, you want the user to enter it a second time ?
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.


0
Tanya
Telerik team
answered on 20 Feb 2020, 07:39 AM

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

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
PdfViewer and PdfViewerNavigator
Asked by
Holger
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Holger
Top achievements
Rank 1
Share this question
or