public void GetPageDetails_IfPdfPageHasUriLinkWithoutScheme_ObjectEditionHasPageUriLinkAddedUriScheme() { // Arrange const int page02Index = 1; var pdfDoc = new PDFDoc(); try { var pdfPage01 = pdfDoc.PageCreate(); var pdfPage02 = pdfDoc.PageCreate(); pdfDoc.PagePushBack(pdfPage01); pdfDoc.PagePushBack(pdfPage02); // create annot of pdfPage02 // uri type of annot to an uri with mailto scheme var uriAcion = PDFAction.CreateURI(pdfDoc, WebUriWithoutScheme); var linkAnnot = Annot.CreateLink(pdfDoc, new Rect(X1, Y1, X2, Y2), uriAcion); pdfPage02.AnnotInsert(0, linkAnnot); // Act _testEntityPrivate.Invoke(GetPageDetailsMethodName, pdfDoc); } finally { pdfDoc.Dispose(); } // Assert var page02LinkCollection = _objectEdition.PageCollection[page02Index].LinkCollection; var page02Links = ConvertToLinkArray(page02LinkCollection); page02Links.ShouldSatisfyAllConditions( () => page02Links.Length.ShouldBe(1), () => page02Links.ShouldContain(link => link.LinkType == UriLinkType), () => page02Links.First().LinkURL.ShouldStartWith(HttpScheme)); }
public void GetPageDetails_IfPdfPageHasGoToLink_ObjectEditionPageHasGoToLink() { // Arrange const int page01Index = 0; var pdfDoc = new PDFDoc(); try { var pdfPage01 = pdfDoc.PageCreate(); var pdfPage02 = pdfDoc.PageCreate(); pdfDoc.PagePushBack(pdfPage01); pdfDoc.PagePushBack(pdfPage02); // create annot of pdfPage01 // goto type of annot links to pdfPage02 var destination = Destination.CreateFit(pdfPage02); var gotoAction = PDFAction.CreateGoto(destination); var linkAnnot = Annot.CreateLink(pdfDoc, new Rect(X1, Y1, X2, Y2), gotoAction); pdfPage01.AnnotInsert(0, linkAnnot); // Act _testEntityPrivate.Invoke(GetPageDetailsMethodName, pdfDoc); } finally { pdfDoc.Dispose(); } // Assert var page01LinkCollection = _objectEdition.PageCollection[page01Index].LinkCollection; var page01Links = ConvertToLinkArray(page01LinkCollection); page01Links.ShouldSatisfyAllConditions( () => page01Links.Length.ShouldBe(1), () => page01Links.ShouldContain(link => link.LinkType == GoToLinkType)); }