Hi Telerik-Team,
the 2024.4.X release of UI for WPF seems to no longer render pdf files correctly. It looks like as if the PdfViewer just renders the document as a single huge page.
An application that uses those references:
<PackageReference Include="Telerik.Windows.Controls.for.Wpf.Xaml" Version="2024.3.924" />
<PackageReference Include="Telerik.Windows.Controls.FixedDocumentViewers.for.Wpf.Xaml" Version="2024.3.924" />
<PackageReference Include="Telerik.Windows.Documents.Core" Version="2024.3.806" />
<PackageReference Include="Telerik.Windows.Documents.Fixed" Version="2024.3.806" />
<PackageReference Include="Telerik.Windows.Zip" Version="2024.3.806" />
works as expected. Once you change those to:
<PackageReference Include="Telerik.Windows.Controls.for.Wpf.Xaml" Version="2024.4.1111" />
<PackageReference Include="Telerik.Windows.Controls.FixedDocumentViewers.for.Wpf.Xaml" Version="2024.4.1111" />
<PackageReference Include="Telerik.Windows.Documents.Core" Version="2024.4.106" />
<PackageReference Include="Telerik.Windows.Documents.Fixed" Version="2024.4.106" />
<PackageReference Include="Telerik.Windows.Zip" Version="2024.4.106" />
the renderer stops working.
I have attached a VS solution with a pdf file that reproduces this
The attached image shows the issue.
Changing the value of the DocumentSource property at runtime causes the RadPdfViewer to display a busy indicator and not update the displayed PDF file with the new one.
To work this around, derive from the RadPdfViewer and create a new dependency property for the property of the type of PdfDocumentSource (for example, from your view model). In its callback method, call the SetDocumentSource method of the derived RadPdfViewer by passing the new value:
public class MyPdfViewer : RadPdfViewer
{
public PdfDocumentSource PdfDocumentSource
{
get { return (PdfDocumentSource)GetValue(PdfDocumentSourceProperty); }
set { SetValue(PdfDocumentSourceProperty, value); }
}
public static readonly DependencyProperty PdfDocumentSourceProperty =
DependencyProperty.Register("PdfDocumentSource", typeof(PdfDocumentSource), typeof(MyPdfViewer), new PropertyMetadata(new PropertyChangedCallback(OnDocumentSourceChanged)));
private static void OnDocumentSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
MyPdfViewer viewer = (MyPdfViewer)d;
viewer.SetDocumentSource((PdfDocumentSource)e.NewValue);
}
}
<local:MyPdfViewer x:Name="pdfViewer" PdfDocumentSource="{Binding MyViewModelPropertyOfTypePdfDocumentSource}" />