If you download the pdf document from the internet, save it to the device and try to show it inside PdfViewer, it will not be loaded on Xiaomi phones with MIUI 12.1. and above.
Users report similar issues with downloaded files on MIUI devices, here are a few discussions on the matter:
https://www.reddit.com/r/Xiaomi/comments/l3x5db/miui_12130_broke_file_permissions_on_mi10_lite/
https://www.reddit.com/r/Xiaomi/comments/mx05ur/file_downloading_issues_on_my_xiaomi/
It seems that's the same reason for the PdfViewer not showing downloaded pdf files as it properly shows pdf documents added as embedded resource to the solution.
Zooming on physical devices does not work properly (gets stuck). Same behavior when scrolling and panning the document
When trying to scroll, pan, and zoom, these gestures open the flyout menu, not to the document in the viewer.
I am Lazy Loading a document in a TabViewItem on the RadTabView Control. Here are the steps.
1. My Page opens and I am on my Main Tab.
2. The user has two Bottom Menu Options, one of them is for a view of a Document.
3. The user selects the Document Tab Option, and the I fire an Async operation that Loads a Byte Array that the PDFViewer is bound to. This loads fine. The document successfully loads in the viewer.
4. The user goes back to the Main Tab
5. The user then selects the Document Tab Option again, the Byte Array is already loaded so I do not Load it again in my ViewModel. So, I am not updating the Source Property on the PDFViewer again once it is loaded. I also tried just reloading the document with the same results.
The application just crashes. My guess is the Rendering or Re-Rendering of the Pdf Document between Tab Selections and there is someting
If the document is never loaded, the app does not crash. However, once I load the document in the PDFViewer that exists on a Tab, the Application will crash if the user moves between tabs.
Stack Trace from the Native Crash Reporting from the Application Output Window.
at <unknown> <0xffffffff>
at SkiaSharp.SkiaApi:sk_canvas_draw_path <0x000fe>
at SkiaSharp.SKCanvas:DrawPath <0x001f2>
at Telerik.XamarinForms.SkiaSharp.PdfSkiaPathPainter:Paint <0x00b42>
at Telerik.XamarinForms.SkiaSharp.SkiaPainterBase:Paint <0x0010f>
at Telerik.XamarinForms.Common.Painters.Painter:TryPaint <0x00176>
at Telerik.XamarinForms.Common.Painters.Painter:Paint <0x003a2>
at Telerik.XamarinForms.SkiaSharp.SkiaPainter:Canvas_PaintSurface <0x0038c>
at SkiaSharp.Views.Forms.SKCanvasView:OnPaintSurface <0x000bc>
at SkiaSharp.Views.Forms.SKCanvasView:SkiaSharp.Views.Forms.ISKCanvasViewController.OnPaintSurface <0x00076>
at SkiaSharp.Views.Forms.SKCanvasViewRendererBase`2:OnPaintSurface <0x001d5>
at SkiaSharp.Views.iOS.SKCanvasView:DrawInSurface <0x0015c>
at SkiaSharp.Views.iOS.SKCanvasView:Draw <0x005b3>
at <Module>:runtime_invoke_void__this___CGRect <0x003f9>
at <unknown> <0xffffffff>
at UIKit.UIApplication:UIApplicationMain <0x00211>
at UIKit.UIApplication:Main <0x000b2>
at UIKit.UIApplication:Main <0x00222>
at EMMA.FINSM.iOS.Application:Main <0x00092>
at <Module>:runtime_invoke_void_object <0x00178>
Example of my Binding. Very simple Byte Array Binding, and out of the box example from the QSF Code. I also tried using a Stream and it does the same thing.
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
/>
</
Grid.RowDefinitions
>
<
telerikPdfViewer:RadPdfViewerToolbar
PdfViewer
=
"{Binding Source={x:Reference PDFView}}"
>
<
telerikPdfViewer:NavigateToPreviousPageToolbarItem
/>
<
telerikPdfViewer:NavigateToNextPageToolbarItem
/>
<
telerikPdfViewer:NavigateToPageToolbarItem
/>
<
telerikPdfViewer:FitToWidthToolbarItem
/>
<
telerikPdfViewer:ToggleLayoutModeToolbarItem
/>
</
telerikPdfViewer:RadPdfViewerToolbar
>
<
telerikPdfViewer:RadPdfViewer
x:Name
=
"PDFView"
Grid.Row
=
"1"
Source
=
"{Binding Document}"
/>
</
Grid
>
public
byte
[] Document
{
get
=> _document;
set
{
SetProperty(
ref
_document, value);
}
}