how add a hyperlink in pdf page to page using itex

2019-08-27 12:42发布

问题:

I want to add or create a hyperlink in bottom of the PDF page and it will redirecting to another page by using itextsharp. and next thing is for example if i have 50 pages PDF file. add 3 pages to it. and in 50th page i want 2 hyperlinks at bottom of the page. one to go for 51st page and another one to for 52nd page. next thing is if i am click back button in 51st page and 52nd page also it will come to 50th page.

回答1:

Using PdfAnnotation to create link

PdfAnnotation annotation;
                annotation = PdfAnnotation.CreateLink(
                stamper.Writer, rect, PdfAnnotation.HIGHLIGHT_INVERT,
                new PdfAction(string.Format(IMDB, screening.movie.Imdb))
              );
              stamper.AddAnnotation(annotation, page);

More details to refer this link

http://kuujinbo.info/iTextInAction2Ed/index.aspx?ch=Chapter07&ex=TimetableAnnotations2