Last Updated: 17 Feb 2021 09:47 by ADMIN
Release R1 2021 SP2
Created on: 11 Feb 2021 08:27
Category: PdfViewer
Type: Bug Report
Pdf viewer crashes when opening document


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)

Attached Files:
1 comment
Dess | Tech Support Engineer, Principal
Posted on: 11 Feb 2021 14:34

Hello, Gilad,  

The provided pdf file is greatly appreciated. I was able to replicate the error in our Demo application.

I have logged it in our feedback portal by making this thread a public feedback item on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

As of R1 2021 RadPdfViewer is optimized to work together with RadPdfProcessing library model. The idea is to unify the underlying architecture of RadPdfViewer and PdfProcessing to allow feature parity. RadPdfViewer uses the new model by default. However, the user can easily switch to the old model by using the UsePdfProcessingModel and UsePdfProcessingModelDefaultValue boolean properties. They should be set before loading a PDF document.

Currently, the possible solution that I can suggest is to use the old model for pdf rendering:

Me.RadPdfViewer1.PdfViewerElement.UsePdfProcessingModel = False

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Dess | Tech Support Engineer, Sr.
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at