I have a pdf that I'm downloading from an api to the local device and trying to use PDFView as I'm trying to not use webview for anything,
my issue is when I get to the PDFView part, I'm following this tutorial. and I'm stuck on the PdfDocument piece. It keeps saying the path is null.
var downloadPath = Path.Combine(FileSystem.CacheDirectory, "certificate.pdf");
var pdfView = new PdfView
{
TranslatesAutoresizingMaskIntoConstraints = false
};
View.AddSubview(pdfView);
pdfView.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor).Active = true;
pdfView.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor).Active = true;
pdfView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor).Active = true;
pdfView.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor).Active = true;
// ... HttpClient call to download pdf ...
pdfView.Document = new PdfDocument(new NSUrl(_downloadPath));
I excluded the http client piece as that's working no problem, I can detect the file when I tested it.
The problem is for sure in this line, and I think it should be:
pdfView.Document = new PdfDocument(new NSUrl(_downloadPath, false));