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

PdfViewer Don't display anythig but...

3 Answers 78 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Thierry
Top achievements
Rank 1
Thierry asked on 27 Jun 2017, 07:37 AM

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;


            }
        }

3 Answers, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 27 Jun 2017, 12:19 PM
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.
0
Thierry
Top achievements
Rank 1
answered on 27 Jun 2017, 12:48 PM

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 .....

0
Tanya
Telerik team
answered on 30 Jun 2017, 05:49 AM
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 you to write beautiful native mobile apps using a single shared C# codebase.
Tags
PDFViewer
Asked by
Thierry
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Thierry
Top achievements
Rank 1
Share this question
or