I have two monitors, both with a different scaling factor applied. If I move an application between monitors that has a pdf viewer in it that is momentarily loading a pdf document the app crashes with this exception:
System.ArgumentOutOfRangeException
"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"
` at System.ThrowHelper.ThrowArgumentOutOfRange_IndexException() in E:\A\_work\159\s\src\mscorlib\src\System\ThrowHelper.cs:line 80
at Syncfusion.Windows.PdfViewer.SfPdfViewerControl.ChangeZoomFactorOnResizing()
at Syncfusion.Windows.PdfViewer.SfPdfViewerControl.
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in E:\A\_work\159\s\src\mscorlib\src\System\Runtime\ExceptionServices\ExceptionDispatchInfo.cs:line 132
at System.Threading.WinRTSynchronizationContextBase.Invoker.InvokeCore() in C:\A\1\8\s\corefx\src\System.Runtime.WindowsRuntime\src\System\Threading\WindowsRuntimeSynchronizationContext.cs:line 213`
Hello
going from your sample please do the following two things:
<Grid x:Name="pdfViewerGrid" Grid.Row="1"> <cc:SfPdfViewerControl x:Name="pdfViewer" /> </Grid> <Border x:Name="PdfRoot" Grid.Row="1" />
private SfPdfViewerControl CreateNewPdfViewer() { var viewer = new SfPdfViewerControl(); viewer.ViewMode = PageViewMode.FitWidth; PdfRoot.Child = viewer; return viewer; }
var viewer = CreateNewPdfViewer(); PdfRoot.Child = viewer; await viewer.LoadDocumentAsync(ldoc);
//pdfViewer.LoadDocument(ldoc);
For repro: