@@ -42,23 +42,26 @@ This file is part of the iText (R) project.
42
42
*/
43
43
package com .itextpdf .kernel .pdf ;
44
44
45
- import com .itextpdf .io .LogMessageConstant ;
46
45
import com .itextpdf .kernel .geom .Rectangle ;
47
46
import com .itextpdf .kernel .pdf .action .PdfAction ;
48
47
import com .itextpdf .kernel .pdf .annot .PdfLinkAnnotation ;
48
+ import com .itextpdf .kernel .pdf .filespec .PdfStringFS ;
49
+ import com .itextpdf .kernel .pdf .navigation .PdfDestination ;
49
50
import com .itextpdf .kernel .pdf .navigation .PdfExplicitDestination ;
51
+ import com .itextpdf .kernel .pdf .navigation .PdfExplicitRemoteGoToDestination ;
50
52
import com .itextpdf .kernel .pdf .navigation .PdfStringDestination ;
51
53
import com .itextpdf .kernel .utils .CompareTool ;
52
54
import com .itextpdf .test .ExtendedITextTest ;
53
- import com .itextpdf .test .annotations .LogMessage ;
54
- import com .itextpdf .test .annotations .LogMessages ;
55
55
import com .itextpdf .test .annotations .type .IntegrationTest ;
56
56
import java .io .IOException ;
57
57
import java .util .Arrays ;
58
58
import org .junit .BeforeClass ;
59
59
import org .junit .Test ;
60
60
import org .junit .experimental .categories .Category ;
61
61
62
+ import java .util .ArrayList ;
63
+ import java .util .List ;
64
+
62
65
import static org .junit .Assert .assertNull ;
63
66
64
67
@ Category (IntegrationTest .class )
@@ -175,4 +178,33 @@ public void destCopyingTest05() throws IOException, InterruptedException {
175
178
176
179
assertNull (new CompareTool ().compareByContent (outFile , cmpFile , destinationFolder , "diff_" ));
177
180
}
181
+
182
+ @ Test
183
+ public void remoteGoToDestinationTest () throws IOException , InterruptedException {
184
+ String cmpFile = sourceFolder + "cmp_remoteGoToDestinationTest.pdf" ;
185
+ String outFile = destinationFolder + "remoteGoToDestinationTest.pdf" ;
186
+
187
+ PdfDocument out = new PdfDocument (new PdfWriter (outFile ));
188
+ out .addNewPage ();
189
+
190
+ List <PdfDestination > destinations = new ArrayList <>(7 );
191
+ destinations .add (PdfExplicitRemoteGoToDestination .createFit (1 ));
192
+ destinations .add (PdfExplicitRemoteGoToDestination .createFitH (1 , 10 ));
193
+ destinations .add (PdfExplicitRemoteGoToDestination .createFitV (1 , 10 ));
194
+ destinations .add (PdfExplicitRemoteGoToDestination .createFitR (1 , 10 , 10 , 10 , 10 ));
195
+ destinations .add (PdfExplicitRemoteGoToDestination .createFitB (1 ));
196
+ destinations .add (PdfExplicitRemoteGoToDestination .createFitBH (1 , 10 ));
197
+ destinations .add (PdfExplicitRemoteGoToDestination .createFitBV (1 , 10 ));
198
+
199
+ int y = 785 ;
200
+ for (PdfDestination destination : destinations ) {
201
+ PdfLinkAnnotation linkExplicitDest = new PdfLinkAnnotation (new Rectangle (35 , y , 160 , 15 ));
202
+ PdfAction action = PdfAction .createGoToR (new PdfStringFS ("Some fake destination" ), destination );
203
+ linkExplicitDest .setAction (action );
204
+ out .getFirstPage ().addAnnotation (linkExplicitDest );
205
+ y -= 20 ;
206
+ }
207
+ out .close ();
208
+ assertNull (new CompareTool ().compareByContent (outFile , cmpFile , destinationFolder , "diff_" ));
209
+ }
178
210
}
0 commit comments