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;
}
}
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;
}
}