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

I'm getting one error while opening multiple PDF files and displaying them to RadBook.

3 Answers 70 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Leonardo
Top achievements
Rank 1
Leonardo asked on 07 Jun 2012, 08:02 AM
Hi Now I'm getting one error while opening multiple PDF files and displaying them to RadBook.

I'm getting the error during navigating pages or open PDF.

"Object reference not set to an instance of an object."

Error occurs at Telerik.Windows.Documents.UI.FixedDocumentSinglePagePresenter.LoadPageContent.AnonymousMethod__1()

Following is the souce code


        private ObservableCollection<AttachFileInfo> _attachedFiles;
        public ObservableCollection<AttachFileInfo> AttachedFiles
        {
            get
            {
                return _attachedFiles;
            }
            set
            {
                if (_attachedFiles != value)
                {
                    _attachedFiles = value;
                    NotifyPropertyChanged("AttachedFiles");


                    OpenPDFFiles();
                }
            }
        }


        private IEnumerable<RadFixedPage> _pages;
        public IEnumerable<RadFixedPage> Pages
        {
            get
            {
                return _pages;
            }
            set
            {
                if (_pages != value)
                {
                    _pages = value;
                    NotifyPropertyChanged("Pages");
                }
            }
        }

if (AttachedFiles != null)
            {
                int step = 0;


                if (attachDocumentStream != null)
                {
                    foreach (Stream attachStream in attachDocumentStream)
                    {
                        attachStream.Close();
                        attachStream.Dispose();
                    }
                }


                attachDocumentStream = new List<Stream>(AttachedFiles.Count);
                foreach (AttachFileInfo AttachFile in AttachedFiles)
                {


                    attachDocumentStream.Add(File.Open(AttachFile.FilePath, FileMode.Open));
                    doc = new PdfFormatProvider(attachDocumentStream[step], FormatProviderSettings.ReadOnDemand).Import();
                    DataStore.TotalPages = DataStore.TotalPages+ doc.Pages.Count;
                    Pages = Pages.Concat(doc.Pages);


                    step = step + 1;
                }
            } 

3 Answers, 1 is accepted

Sort by
0
Kammen
Telerik team
answered on 07 Jun 2012, 01:39 PM

Hello Leonardo,

Is it possible to send us a sample project that will help us better understand your case and find the best solution for your problem.

In order to submit the file, you can open a support ticket by logging into your account at http://www.telerik.com and following these steps:

1.       From your account, choose "Contact Support Team";
2.       Click the "Submit support ticket" button under RadControls for WPF and fill in the required information about the product and version of the control your inquiry is about.

3.       At the very bottom, choose “Attach files” – you can see that the size limitation is 20 MB. Mind the allowed file types – in your case you should compress the file and attach it as a zip.

Regards,

Kammen
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
TEST
Top achievements
Rank 1
answered on 07 Aug 2012, 12:20 PM
Hi,

 I am also getting same error while loading multiple file dynamically. But not find any solution....

0
Iva Toteva
Telerik team
answered on 09 Aug 2012, 04:52 PM
Hello,

We are still not able to reproduce the issue. Unfortunately, there is no way to address the problem in this way.

If you open a support ticket and attach a sample project illustrating the behavior you are observing, we will be happy to assist you further.

Regards,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
PDFViewer
Asked by
Leonardo
Top achievements
Rank 1
Answers by
Kammen
Telerik team
TEST
Top achievements
Rank 1
Iva Toteva
Telerik team
Share this question
or