PdfViewer: Password protected documents cannot be opened
Workaround:
PdfFormatProvider provider = new PdfFormatProvider(); PdfImportSettings settings = this.radPdfViewer1.PdfViewerElement.ImportSettings; settings.UserPasswordNeeded += (s, a) => { a.Password = "1234"; }; provider.ImportSettings = settings; this.radPdfViewer1.LoadDocument(@"..\..\password.pdf");
Is there a way to load this RadFixedDocument into a RadPdfViewer without writing the document to a file first and then loading it in the viewer?
Workaround:
You can achieve the desired functionality by exporting the RadFixedDocument to a MemoryStream instead of a file in the file system and then load it in the PdfViewer:
RadFixedDocument document = CreateRadFixedDocument();
PdfFormatProvider pdfFormatProvider = new PdfFormatProvider();
Stream ms = new MemoryStream();
pdfFormatProvider.Export(document, ms);
radPdfViewer1.LoadDocument(ms);
Hello,
When opening this document (see attached), PDF viewer crashes with following exception.
To reproduce, open this document in the Pdf Viewer WinForms example, latest version.
Screenshot attached.
************** Exception Text **************
System.InvalidCastException: Unable to cast object of type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfHexString' to type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfLiteralString'.
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.ExceptionHandling.ExceptionHandler.TryHandle(Exception exception)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.PageContentManager.LoadPageContent(RadFixedPage fixedPage)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.ThreadSafePageContentManager.LoadPageContent(RadFixedPage page)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.LoadOnDemandPagesCacheManager.LoadPage(RadFixedPage page)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.LoadOnDemandPagesCacheManager.BeginUsingPage(RadFixedPage page)
at Telerik.Windows.Documents.Fixed.Text.TextPageProvider.CreateTextPage(RadFixedPage fixedPage, TextDocument parent)
at Telerik.Windows.Documents.Fixed.Text.TextDocument.CreateTextPage(Int32 index)
at Telerik.Windows.Documents.Fixed.Text.TextDocument.GetTextPage(Int32 index)
at Telerik.WinControls.PdfViewer.MouseHandlers.SelectionHandler.Initialize(RadFixedDocument document)
at Telerik.WinControls.PdfViewer.MouseHandlers.MouseHandlersController.InitializeHandlers(RadFixedDocument document)
at Telerik.WinControls.UI.RadPdfViewerElement.documentLoader_RunWorkerCompleted(Object sender, RunWorkerCompletedEventArgs e)
at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e)
at System.ComponentModel.BackgroundWorker.AsyncOperationCompleted(Object arg)
Good morning.
I'm using a pdfViewer instance in order to load pdf forms, with text fields to be edited by the users.
Loading is ok, editing is ok, the problem is when I go to save the edited document. When I save the document, if I don't click elsewhere in the document, in which case the content of the field is committed, the content of the field is not saved with the document. This happens either using the 'Save As' button or using the SaveDocument API function.
Probably it is my fault, since I'm new to PdfViewer: I can imagine that something like a commit command has to be available, but I'm not able to find it.
Can you help me, please?
Thank you in advance.
PS. I will attach three screenshots in order to let you understand better what I mean.
Is there a way to customize the box to request a signature?
Thanks in advance