This question is locked. New answers and comments are not allowed.
I have a RadPdfViewer that is being loaded from a stream. I am experiencing 2 issues with this control that is giving me fits.
1. The first issue is that when I first go to my page with the PdfViewer, the document is always blank.... it never loads. The memory stream is there however. When I return to this page the second time and on, the Pdf loads most of the time (with the same PDF or a different one) - it seems to be sporadic.
My Xaml:
My code behind. This method is called once the stream is loaded into my view model.
This usually works the second time on... never the first time.
As an aside, if i use the following code as suggested in the forums, i get a null exception in PdfFormatProvider the first time. (Yes, my PdfAttachmentStream has data loaded)
2. My second (less important issue) is that I have to use a timer or sleep thread to get any sort of consistency with the document rendering. If i do not delay the thread, the document will never load.
Any thoughts?
1. The first issue is that when I first go to my page with the PdfViewer, the document is always blank.... it never loads. The memory stream is there however. When I return to this page the second time and on, the Pdf loads most of the time (with the same PDF or a different one) - it seems to be sporadic.
My Xaml:
<telerik:RadPdfViewer x:Name="pdfViewer" telerik:ScrollViewerExtensions.EnableMouseWheel="True" ScrollViewer.VerticalScrollBarVisibility="Auto" Mode="Pan" Background="{StaticResource AppBackgroundBrush}" />My code behind. This method is called once the stream is loaded into my view model.
public override void AttachmentReady(){ Dispatcher.BeginInvoke(() => { timer.Tick += delegate(object s, EventArgs args) { pdfViewer.DocumentSource = new PdfDocumentSource((DataContext as ViewDocumentViewModel).PdfAttachmentStream); timer.Stop(); }; timer.Interval = new TimeSpan(0, 0, 0, 0, 300); // if I dont wait, the pdf will never load timer.Start(); });}This usually works the second time on... never the first time.
As an aside, if i use the following code as suggested in the forums, i get a null exception in PdfFormatProvider the first time. (Yes, my PdfAttachmentStream has data loaded)
delegate(object s, EventArgs args){ PdfFormatProvider provider = new PdfFormatProvider((DataContext as DocumentViewModelBase).PdfAttachmentStream, FormatProviderSettings.ReadAllAtOnce); pdfViewer.Document = provider.Import();};2. My second (less important issue) is that I have to use a timer or sleep thread to get any sort of consistency with the document rendering. If i do not delay the thread, the document will never load.
Any thoughts?
