title: How to add a link annotation with a PDFActionGoto action type to a PDFPage using swift in MACOS
body: <p>I have been trying to add a link annotation to my PDFPage so that once clicked it will take me to a specific location of the next page. This is the way I am trying but my code is not working:</p>
  <ol>
  <li>The cursor does not change to the pointer style.</li>
  <li>Once the area is clicked navigation does not occur.</li>
  <li>.freetext annotation is working and getting displayed.</li>
  </ol>
  <p>I would appreciate any help regarding this. I have been trying this for the last couple of days. I am using latest version of xcode (12 and swift 5.3)</p>
  <pre><code>    let docDirectoryPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
  
  
      let pdfDocument = PDFDocument()
      let page1 = PDFPage()
      let page2 = PDFPage()
      pdfDocument.insert(page1, at: 0)
      pdfDocument.insert(page2, at: 1)
      
      let textAnnotation = PDFAnnotation(bounds: NSRect(x: 200, y: 1000, width: 600, height: 25), forType: .freeText, withProperties: nil)
      textAnnotation.contents = &quot;Click me to go to the next page&quot;
      
      let linkAnnotation = PDFAnnotation(bounds: NSRect(x: 200, y: 1000, width: 600, height: 25), forType: .link, withProperties: nil)
      linkAnnotation.action = PDFActionGoTo(destination: PDFDestination(page: page2, at: NSPoint(x: 200, y: 1000)))
      linkAnnotation.shouldDisplay = true
      linkAnnotation.shouldPrint = true
  
      let someText = PDFAnnotation(bounds: NSRect(x: 200, y: 1000, width: 600, height: 25), forType: .freeText, withProperties: nil)
      someText.contents = &quot;This is the desitnation of link annotation&quot;
  
      page1.addAnnotation(textAnnotation)
      page1.addAnnotation(linkAnnotation)
      page2.addAnnotation(someText)
  
      
      let printOpts: [NSPrintInfo.AttributeKey: Any] = [NSPrintInfo.AttributeKey.jobDisposition: NSPrintInfo.JobDisposition.preview, NSPrintInfo.AttributeKey.jobSavingURL: docDirectoryPath]
      
      let printInfo = NSPrintInfo(dictionary: printOpts)
      printInfo.horizontalPagination = NSPrintInfo.PaginationMode.automatic
      printInfo.verticalPagination = NSPrintInfo.PaginationMode.automatic
      printInfo.topMargin = 0.0
      printInfo.leftMargin = 0.0
      printInfo.rightMargin = 0.0
      printInfo.bottomMargin = 0.0
      printInfo.isHorizontallyCentered = true
      printInfo.isVerticallyCentered = false
      printInfo.paperSize = NSSize(width: 8.5*96, height: 11*96)
      printInfo.scalingFactor =  1.0
      let printOperation = pdfDocument.printOperation(for: printInfo, scalingMode: .pageScaleNone, autoRotate: false)!
      printOperation.showsPrintPanel = true
      printOperation.run()
  </code></pre>