I want to know if there is any way for a offline build for xcode iOS such that we can display pdf file from local file.
The method I\'m using now is vi
In my case, I have a tableView that segues to a PDFView based on either a selected row or detail indicator (there are two different ViewControllers for each in different parts of my app). I have an @IBOutlet for the PDFView and use this code to open the desired PDF, which is saved in the app:
@IBOutlet weak var myPDFView: PDFView!
var mySelection = String()
override func viewDidLoad() {
super.viewDidLoad()
if let path = Bundle.main.path(forResource: mySelection, ofType: "pdf") {
let url = URL(fileURLWithPath: path)
if let myDocument = PDFDocument(url: url) {
myPDFView.document = myDocument
myPDFView.autoScales = true
myPDFView.displayMode = .singlePageContinuous
myPDFView.displayDirection = .vertical
myPDFView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
}
}
}
This all works great. The correct PDFs load easily and fill the screen like I want. However, the PDF is always scrolled up just a little, causing the top portion to be hidden under the navigation bar. Notice in the screen shot below that the top of the document is not visible but the bottom is, just above the tab bar at the bottom. I think this has to do with PDF coordinates starting at the bottom of the page but cannot figure out how to get it to load the very top of the document, so the background at the top is visible.

Perhaps this has to do with autoScales?