Beispiel #1
0
        public virtual void StructureDestination02Test()
        {
            String                  srcFile          = sourceFolder + "customRolesMappingPdf2.pdf";
            String                  outFile          = destinationFolder + "structureDestination02Test.pdf";
            String                  cmpFile          = sourceFolder + "cmp_structureDestination02Test.pdf";
            PdfDocument             document         = new PdfDocument(new PdfReader(srcFile), new PdfWriter(outFile));
            PdfStructElem           imgElement       = new PdfStructElem((PdfDictionary)document.GetPdfObject(13));
            PdfStructureDestination dest             = PdfStructureDestination.CreateFit(imgElement);
            PdfPage                 secondPage       = document.AddNewPage();
            PdfPage                 thirdPage        = document.AddNewPage();
            PdfLinkAnnotation       linkExplicitDest = new PdfLinkAnnotation(new Rectangle(35, 785, 160, 15));
            PdfAction               gotoStructAction = PdfAction.CreateGoTo(PdfExplicitDestination.CreateFit(thirdPage));

            gotoStructAction.Put(PdfName.SD, dest.GetPdfObject());
            linkExplicitDest.SetAction(gotoStructAction);
            secondPage.AddAnnotation(linkExplicitDest);
            document.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFile, cmpFile, destinationFolder, "diff_"
                                                                             ));
        }