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

RadPdfViewer not loading the document

4 Answers 679 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 22 Jan 2017, 12:21 PM

I am using Q1 2016 version of telerik

I have a binding for my Document source using MVVM light

This is my XAML code :

<telerik:RadPdfViewer Grid.Row="1" HorizontalAlignment="Stretch" Name="pdfViewer" VerticalAlignment="Top"
DocumentSource="{Binding DocumentPdf}" />

 

and here is my code :

public CotisationPdfVm(string url)
{
DocumentPdf = new PdfDocumentSource(new Uri(url), FormatProviderSettings.ReadOnDemand);
}

private PdfDocumentSource _documentPdf;
public PdfDocumentSource DocumentPdf
{
get { return _documentPdf; }
set
{
_documentPdf = value;
RaisePropertyChanged(() => DocumentPdf);
}

 

The url is

The document remains blank. No exception.

When I put a breakpoint in the set of my property the I have: IsStreamLoaded = false

The url is "http://109.88.185.2:60000/Reports/Cotisation/2017/CotisationReportVANDEVOORDEN Patrick-354-2017.pdf"

The uri is "http://109.88.185.2:60000/Reports/Cotisation/2017/CotisationReportVANDEVOORDEN%20Patrick-354-2017.pdf"

When I try with a browser (IE) with the same uri I can read the document.

 

       

4 Answers, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 23 Jan 2017, 09:18 PM
Hi Patrick,

The reason it's not working is because of the FormatProviderSettings.ReadOnDemand setting. If you change your constructor to the following, it will work as expected:


public CotisationPdfVm(string url)
{
    DocumentPdf = new PdfDocumentSource(new Uri(url));
}


I'm forwarding this to the PdfViewer team take a look and see if this is the expected behavior when using data binding. 


Side-note:


In case you weren't aware of it, we also have a converter that lets you bind directly to the Uri and set the FormatProviderSettings via the parameter.

Here's the namespace and Resource declaration:
<!-- NAMESPACE -->
xmlns:fixed="clr-namespace:Telerik.Windows.Documents.Fixed;assembly=Telerik.Windows.Controls.FixedDocumentViewers"
 
<!-- CONVERTER -->
<Window.Resources>
  <fixed:PdfDocumentSourceValueConverter x:Key="DocumentSourceConverter"/>
</Window.Resources>
 
<!-- USAGE -->
<telerik:RadPdfViewer DocumentSource="{Binding DocumentUri, Converter={StaticResource DocumentSourceConverter}, ConverterParameter=ReadAllAtOnce}" />


Thank you for reporting this.

Regards,
Lance | Tech Support Engineer, Sr.
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Patrick
Top achievements
Rank 1
answered on 24 Jan 2017, 09:21 AM

Thank you it is working by changing th constructor.

But it was working with the previous version of telerik.

0
Lance | Manager Technical Support
Telerik team
answered on 24 Jan 2017, 11:05 PM
Hello Patrick,

I have spoken with the development team about this and they've confirmed it is a regression. They've logged it and will work on a fix to be included in an upcoming update.

I have updated your Telerik Points for bringing this to our attention, thank you.

Regards,
Lance | Tech Support Engineer, Sr.
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Lance | Manager Technical Support
Telerik team
answered on 25 Jan 2017, 06:49 PM
Hello Patrick,

I wanted to follow up with you to share the Feedback Item link for your reported issue so that you can follow along and be aware of when it's repaired.

The status will change from "Under Development" to "Completed" when done.

Thank you again.

Regards,
Lance | Tech Support Engineer, Sr.
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
PDFViewer
Asked by
Patrick
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Patrick
Top achievements
Rank 1
Share this question
or