title: Go to specific pages of a pdf file
body: <p>I can not figure out how to do this: When I click on a certain TableView cell, I go to certain pages of a pdf file (startPage is the beginning of the page, endPage is the end of the page).
  The class for opening the pdf file:</p>
  
  <pre><code>import UIKit
  
  class DetailLessonsVC: UIViewController {
  
  let pdfTitle = "Strahov_Pages"
  
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      // Do any additional setup after loading the view.
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  func openPDFAction(title: Int, sub: Int)
  {
      if let url = Bundle.main.url(forResource: pdfTitle, withExtension: "pdf") {
          let webView = UIWebView(frame:self.view.frame)
          let urlRequest = URLRequest(url: url)
          webView.loadRequest(urlRequest as URLRequest)
          self.view.addSubview(webView)
  
      }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The transition function when clicking on a TableView cell (TableViewController class):</p>
  
  <pre><code>    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
      let vc = DetailLessonsVC()
      vc.openPDFAction(title: startPage[indexPath.count], sub: endPage[indexPath.count])
      self.navigationController?.pushViewController(vc, animated: true)
      self.tableView.deselectRow(at: indexPath, animated: true)
  }
  </code></pre>
  
  <p>StartPage and endPage Arrays (TableViewController class):</p>
  
  <pre><code>let startPage = [6, 9, 15, 23, 27, 29, 33, 37, 41]
  
  let endPage = [8, 14, 22, 26, 28, 32, 36, 42, 44]
  </code></pre>