I can't figure out what the exact cause of this is. I have a wpf project which uses the RadPdfViewer. To Print I'm using the PrintPdfDocumentCommand. Running the project from visual studio (in debug or release) the pdf's print without a problem. When I publish the project and install it on my local machine I get an exception when trying to print. I click the "print" icon on the toolbar and the dialog window opens. I select my printer and click "print" on the dialog window, that is the program crashes from an exception (see stack trace below). The strange thing is, if the pdf file that is failing to print is in the same location as the programs executable it will print fine. This crash only happens when the pdf file's location is outside the directory of where the programs executable lives.
StackTrace: System.ObjectDisposedException: Cannot access a closed file.
at System.IO.__Error.FileNotOpen()
at System.IO.FileStream.get_Position()
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfReader.Readers.PdfReaderBase.get_Position()
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfReader.Parsers.PdfParser.ReadIndirectObject(Int64 offset, Boolean isEncrypted)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfReader.PdfContentManager.ReadIndirectObject(IndirectReference fromRef, Boolean isEncrypted)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfReader.PdfContentManager.ReadData(IndirectReference reference)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfReader.PdfContentManager.ReadDataFromAsyncCall(IndirectReference reference)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfReader.PdfResourceManager.GetGlobalImageSource(ResourceKey key)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfReader.PdfResourceManager.GetImageSource(ResourceKey key)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.GetImageSource(ResourceKey key)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.GetImageSource(Image image)
at Telerik.Windows.Documents.Fixed.UI.ContentElementsPainter.DrawImage(DrawingContext drawingContext, ContentElementsPainterInitializeContext context, Image image)
at Telerik.Windows.Documents.Fixed.UI.ContentElementsPainter.DrawImage(DrawingContext drawingContext, Image image)
at Telerik.Windows.Documents.Fixed.UI.ContentElementsPainter.DrawContentElement(DrawingContext drawingContext, IContentElement contentElement)
at Telerik.Windows.Documents.Fixed.UI.ContentElementsPainter.DrawContainer(DrawingContext drawingContext, Container container)
at Telerik.Windows.Documents.Fixed.UI.ContentElementsPainter.DrawContentElement(DrawingContext drawingContext, IContentElement contentElement)
at Telerik.Windows.Documents.Fixed.UI.ContentElementsPainter.DrawContainer(DrawingContext drawingContext, Container container)
at Telerik.Windows.Documents.Fixed.UI.ContentElementsPainter.DrawContentElement(DrawingContext drawingContext, IContentElement contentElement)
at Telerik.Windows.Documents.Fixed.UI.ContentElementsPainter.OnRender(DrawingContext dc)
at System.Windows.UIElement.Arrange(Rect finalRect)
(cont...)
StackTrace: System.ObjectDisposedException: Cannot access a closed file.
at System.IO.__Error.FileNotOpen()
at System.IO.FileStream.get_Position()
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfReader.Readers.PdfReaderBase.get_Position()
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfReader.Parsers.PdfParser.ReadIndirectObject(Int64 offset, Boolean isEncrypted)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfReader.PdfContentManager.ReadIndirectObject(IndirectReference fromRef, Boolean isEncrypted)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfReader.PdfContentManager.ReadData(IndirectReference reference)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfReader.PdfContentManager.ReadDataFromAsyncCall(IndirectReference reference)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfReader.PdfResourceManager.GetGlobalImageSource(ResourceKey key)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfReader.PdfResourceManager.GetImageSource(ResourceKey key)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.GetImageSource(ResourceKey key)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.GetImageSource(Image image)
at Telerik.Windows.Documents.Fixed.UI.ContentElementsPainter.DrawImage(DrawingContext drawingContext, ContentElementsPainterInitializeContext context, Image image)
at Telerik.Windows.Documents.Fixed.UI.ContentElementsPainter.DrawImage(DrawingContext drawingContext, Image image)
at Telerik.Windows.Documents.Fixed.UI.ContentElementsPainter.DrawContentElement(DrawingContext drawingContext, IContentElement contentElement)
at Telerik.Windows.Documents.Fixed.UI.ContentElementsPainter.DrawContainer(DrawingContext drawingContext, Container container)
at Telerik.Windows.Documents.Fixed.UI.ContentElementsPainter.DrawContentElement(DrawingContext drawingContext, IContentElement contentElement)
at Telerik.Windows.Documents.Fixed.UI.ContentElementsPainter.DrawContainer(DrawingContext drawingContext, Container container)
at Telerik.Windows.Documents.Fixed.UI.ContentElementsPainter.DrawContentElement(DrawingContext drawingContext, IContentElement contentElement)
at Telerik.Windows.Documents.Fixed.UI.ContentElementsPainter.OnRender(DrawingContext dc)
at System.Windows.UIElement.Arrange(Rect finalRect)
(cont...)