private MemoryStream CreatePdfWithGoToAnnot(bool isTheSameLink, bool diffDisplayOptions) { MemoryStream stream = new MemoryStream(); PdfDocument pdfDocument = new PdfDocument(new PdfWriter(stream)); pdfDocument.AddNewPage(); pdfDocument.AddNewPage(); pdfDocument.AddNewPage(); Rectangle linkLocation = new Rectangle(523, 770, 36, 36); PdfExplicitDestination destination = PdfExplicitDestination.CreateFit(pdfDocument.GetPage(3)); PdfAnnotation annotation = new PdfLinkAnnotation(linkLocation).SetAction(PdfAction.CreateGoTo(destination) ).SetBorder(new PdfArray(new int[] { 0, 0, 1 })); pdfDocument.GetFirstPage().AddAnnotation(annotation); if (!isTheSameLink) { destination = (diffDisplayOptions) ? PdfExplicitDestination.Create(pdfDocument.GetPage(3), PdfName.XYZ, 350 , 350, 0, 0, 1) : PdfExplicitDestination.CreateFit(pdfDocument.GetPage(1)); } annotation = new PdfLinkAnnotation(linkLocation).SetAction(PdfAction.CreateGoTo(destination)).SetBorder(new PdfArray(new int[] { 0, 0, 1 })); pdfDocument.GetPage(2).AddAnnotation(annotation); pdfDocument.Close(); return(stream); }