重现步骤如下:
1. 在示例ControlExplorer2012.8解决方案的项目ControlExplorer.8目录Resources下,添加会报错的PDF文件“4c24ac85-db39-4dbd-a5d4-c656fdbeccf0.pdf”,并修改文件属性的生成操作为“Resource”;
2. 修改项目ControlExplorer.8目录Controls/PdfViewer/DemoPDFViewer_WP8.xaml.cs文件,在PDFView调用此PDF,代码修改如下:
void DemoPDFViewer_Loaded(object sender, RoutedEventArgs e)
{
var resource = Application.GetResourceStream(new Uri("/ControlExplorer" + App.AssemblySuffix + ";component/Resources/4c24ac85-db39-4dbd-a5d4-c656fdbeccf0.pdf", UriKind.Relative));
pdfViewer.LoadDocument(resource.Stream);
//pdfViewer.PageRendered += (s2, e2) =>
{
//if (e2.TotalRenderedPages >= 2)
{
txtLoading.Visibility = System.Windows.Visibility.Collapsed;
pdfViewer.Visibility = System.Windows.Visibility.Visible;
}
};
}
3. 调试运行项目,打开PDFViewer
在pdf加载中就会报错,如下:
Message "Object reference not set to an instance of an object." string
at C1.Phone.PdfViewer.PdfPageElement.ShowCharObjects(CharObject[] charObjects, Double totalDis)
at C1.Phone.PdfViewer.PdfPageElement.ShowFast(List`1 listObjects, List`1 listDistance)
at C1.Phone.PdfViewer.PdfPageElement.ShowTJ()
at C1.Phone.PdfViewer.PdfPageElement.ExecuteCommand(String command, BinaryReader br)
at C1.Phone.PdfViewer.PdfPageElement.RunLoop(BinaryReader reader, TimeSpan timeOut, Func`2 onExectuingCommand)
at C1.Phone.PdfViewer.PdfPageElement.ContinueLoadingCommands(TimeSpan timeOut)
at C1.Phone.PdfViewer.PdfPageLoader.Load()
at C1.Phone.PdfViewer.PdfPageLoader.<Continue>b__0() |