Hello,
You can use the following workaround:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
PdfImportSettings pdfImportSettings = new PdfImportSettings();
this.radPdfViewer1.PdfViewerElement.ImportSettings = pdfImportSettings;
pdfImportSettings.OwnerPasswordNeeded += ImportSettings_OwnerPasswordNeeded;
}
private void ImportSettings_OwnerPasswordNeeded(object? sender, Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.PasswordNeededEventArgs e)
{
var password = (this.radPdfViewer1.PdfViewerElement as CustomPdfViewerElement).Call_ShowPasswordRequireDialog();
e.Password = password;
}
private void bWithPermissionPasswordOnly_Click(object sender, EventArgs e)
{
radPdfViewer1.LoadDocument(@"resources\WithPermissionPasswordOnly.pdf");
}
private void bWithDocumentOpenPassword_Click(object sender, EventArgs e)
{
radPdfViewer1.LoadDocument(@"resources\WithDocumentOpenPassword.pdf");
}
}
public class CustomPdfViewer : RadPdfViewer
{
protected override RadPdfViewerElement CreateViewerElement()
{
return new CustomPdfViewerElement();
}
}
public class CustomPdfViewerElement : RadPdfViewerElement
{
public string Call_ShowPasswordRequireDialog()
{
return ShowPasswordRequireDialog();
}
}
Regards,
Nadya | Tech Support Engineer
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.