RadPdfViewer not loading the document

5 posts, 0 answers
  1. Patrick
    Patrick avatar
    2 posts
    Member since:
    May 2015

    Posted 22 Jan Link to this post

    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.

     

           

  2. Lance | Tech Support Engineer, Sr.
    Admin
    Lance | Tech Support Engineer, Sr. avatar
    359 posts

    Posted 23 Jan Link to this post

    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.
  3. Patrick
    Patrick avatar
    2 posts
    Member since:
    May 2015

    Posted 24 Jan in reply to Lance | Tech Support Engineer, Sr. Link to this post

    Thank you it is working by changing th constructor.

    But it was working with the previous version of telerik.

  4. Lance | Tech Support Engineer, Sr.
    Admin
    Lance | Tech Support Engineer, Sr. avatar
    359 posts

    Posted 24 Jan Link to this post

    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.
  5. Lance | Tech Support Engineer, Sr.
    Admin
    Lance | Tech Support Engineer, Sr. avatar
    359 posts

    Posted 25 Jan Link to this post

    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.
Back to Top