I'm trying to display a pdf on an iOS device (ipad) using PDFkit. For some reason, swift displays the second page when the display opens. I figure out part of the problem is the preview.autoscale. When I set this to false, the pdf is not full screen, but it starts on the first page. So, I think the issue is the "zoom" part of the autoscale is zooming in on the first page. I did find a simalar question on stackoverflow (PDFKit: PDFView doesn't resize when device rotated), but the soution didnt work. Below is the relevant code:
if let FBdocument = PDFDocument(url: fileURL) {
pdfView.document = FBdocument
pdfView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(pdfView)
pdfView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor,constant: 0.0).isActive = true
pdfView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor,constant: 0.0).isActive = true
pdfView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor,constant: 0.0).isActive = true
pdfView.bottomAnchor.constraint(equalTo: letdothis_button.topAnchor,constant: 0.0).isActive = true
pdfView.autoScales = true