PdfViewer Don't display anythig but...

4 posts, 0 answers
  1. Thierry
    Thierry avatar
    2 posts
    Member since:
    Sep 2008

    Posted 27 Jun Link to this post

    Hi all

     

    I've a Strange error... 

    The pdfviewer don't show anything but if i print the document it exists !

     

    The code work normaly before i don't understand.....

    this is the XAML code

    <Window x:Class="TestPdfViewer.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
            xmlns:UC="clr-namespace:Angdm.Framework.UI.UserControls;assembly=Angdm.Framework.UI"
            xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
            xmlns:local="clr-namespace:TestPdfViewer"
            mc:Ignorable="d"
            Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
        <Grid >
            <telerik:RadPdfViewer x:Name="pdfviewer"/>
            <!--<UC:UCPdfViewer x:Name="pdfviewer" BorderBrush="Red"/>-->
        </Grid>
    </Window>

     

    and the window loaded

     

       private void Window_Loaded(object sender, RoutedEventArgs e)
            {
                using (FileStream fs = new FileStream("c:\\toto.pdf", FileMode.Open, FileAccess.Read))
                {
                    byte[] byteread = new byte[fs.Length];
                    int numBytesToRead = (int)fs.Length;
                    int numBytesRead = 0;
                    while (numBytesToRead > 0)
                    {
                        int n = fs.Read(byteread, numBytesRead, numBytesToRead);

                        if (n == 0)
                            break;
                        numBytesRead += n;
                        numBytesToRead -= n;
                    }
                    numBytesToRead = byteread.Length;
                   
                    MemoryStream m = new MemoryStream(byteread);
                    FormatProviderSettings settings = new FormatProviderSettings(ReadingMode.AllAtOnce);
                    PdfFormatProvider provider = new PdfFormatProvider(m, settings);
                    RadFixedDocument mdoc_data = provider.Import();
                    this.pdfviewer.ClearDocument();
                    this.pdfviewer.Document = mdoc_data;


                }
            }

  2. Tanya
    Admin
    Tanya avatar
    575 posts

    Posted 27 Jun Link to this post

    Hi Thierry,

    Similarly to my reply in the support ticket, I am unable to reproduce an issue and I suggest that it could be caused by something in the contents of the imported document. Therefore, we will need a sample document that reproduces the issue so we can check what is causing it. Can you please share such a document?

    Regards,
    Tanya
    Progress Telerik
    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. Thierry
    Thierry avatar
    2 posts
    Member since:
    Sep 2008

    Posted 27 Jun in reply to Tanya Link to this post

    Hi tanya

    I've solved the pb....

    I've only deploy the bad nuget package (without XAML)...... :-(

    Thanks

    I've now a pb with the "good" package and tfs build .....

  4. Tanya
    Admin
    Tanya avatar
    575 posts

    Posted 30 Jun Link to this post

    Hi Thierry,

    I am happy to hear that the control is now working as expected. If you believe the issues you are experiencing with the TFS builds are related to PdfViewer, please share more information so we can investigate what is going on.

    Regards,
    Tanya
    Progress Telerik
    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