I just implemented the PDFViewer into a Xamarin.Forms project and it worked right out of the gate for UWP.
However I am getting an exception on Android. The error log is attached.
I have made sure that I have the necessary packages installed for Android.I am opening a downloaded pdf that is being written to disk via the PCLStorage library. I have verified that a document exists at the location. And my mp3 player works with downloaded files AND the pdfs work fine in UWP. So I am fairly certain the downloaded PDF is being streamed properly.
I am testing on a Nexus 5 with Android 6.0
This is the code that handles the streaming, I am just using the XAML from the example in the documentation.
public SimplePdf(String filename)
{
InitializeComponent();
FileName = filename;
LoadStream();
}
private async void LoadStream()
{
IFolder rootFolder = FileSystem.Current.LocalStorage;
IFolder folder = await rootFolder.GetFolderAsync("Downloads");
IFile file = await folder.GetFileAsync(FileName);
Debug.WriteLine("file: " + file.Path);
var filebuffer = await file.OpenAsync(FileAccess.Read);
var mStream = new MemoryStream();
filebuffer.CopyTo(mStream);
Debug.WriteLine("stream: " + mStream.Length.ToString());
pdfViewerControl.LoadDocument(mStream);
}
Attachment:
pdfviewer_error.txt_1a8fd27d.zip