I'm having an odd issue with a Xamarin Mac application that has been running fine in the field for a couple of years. As part of the application I generate HTML + some JS, then convert this to a PDF, and load the PDF into a PDFView for display to the user. The code is very similar to this:
string sSourcePathForPDFFile = System.IO.Path.Combine(SourcePathForResources, "GeneratedPDF.pdf"); var pdf URL = EscapedFullPathURL("file://" + sSourcePathForPDFFile); ThePDFView.Document = PDFDocument;
On my business partner's Mac (which is running 10.12.6) this code does NOT result in the PDF being shown in the PDFView; the PDFView remains blank. However, on my development machine (also running 10.12.6) it works fine. Our application also works fine on another test Mac (running 10.11.6). Interestingly, if I move this code into "AwakeFromNib" (using a pre-generated PDF file), the PDF works fine on the problematic Mac; it's only if the PDFView is set to load a new document when necessary as the user is viewing the form that it doesn't work.
Other info - I'm using Visual Studio for Mac v7.1 build 1297, Xamarin.Mac v18.104.22.168, and Mono 22.214.171.124. I've got a simple test application that demonstrates the issue.
I thought that perhaps I need to cajole the PDFView into refreshing, so I have also tried adding these various lines:
ThePDFView.NeedsDisplay = true; ThePDFView.NeedsLayout = true; ThePDFView.LayoutDocumentView();
... after the 'Document' assignment, but this makes no difference on the problematic Mac.
Has anyone else come across this kind of behaviour? From research it seems Apple kind of mucked up PDFKit in different ways recently, however as it stands this is a show-stopper issue for us, and I can't assume it's only going to be a problem on my partner's computer.