@@ -59,6 +59,7 @@ This file is part of the iText (R) project.
59
59
import com .itextpdf .layout .element .Paragraph ;
60
60
import com .itextpdf .layout .element .Tab ;
61
61
import com .itextpdf .layout .element .TabStop ;
62
+ import com .itextpdf .layout .element .Text ;
62
63
import com .itextpdf .layout .property .Property ;
63
64
import com .itextpdf .layout .property .TabAlignment ;
64
65
import com .itextpdf .test .ExtendedITextTest ;
@@ -107,6 +108,35 @@ public static void beforeClass() {
107
108
createOrClearDestinationFolder (destinationFolder );
108
109
}
109
110
111
+ @ Test
112
+ public void chunkEndsAfterOrBeforeTabPosition () throws IOException , InterruptedException {
113
+ String outFileName = destinationFolder + "chunkEndsAfterOrBeforeTabPosition.pdf" ;
114
+ String cmpFileName = sourceFolder + "cmp_chunkEndsAfterOrBeforeTabPosition.pdf" ;
115
+
116
+ PdfDocument pdfDoc = new PdfDocument (new PdfWriter (outFileName ));
117
+ Document doc = new Document (pdfDoc );
118
+
119
+ String textBeforeTab = "a" ;
120
+ String textAfterTab = "tab stop's position = " ;
121
+
122
+ Paragraph paragraph ;
123
+ for (int i = 0 ; i < 20 ; i ++) {
124
+ paragraph = new Paragraph ();
125
+ paragraph .add (new Text (textBeforeTab ));
126
+ TabStop [] tabStop = new TabStop [1 ];
127
+ tabStop [0 ] = new TabStop (i );
128
+ paragraph .addTabStops (tabStop );
129
+ paragraph .add (new Tab ());
130
+ paragraph .add (new Text (textAfterTab ));
131
+ paragraph .add (Integer .toString (i ));
132
+ doc .add (paragraph );
133
+ }
134
+
135
+ doc .close ();
136
+
137
+ Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , "diff" ));
138
+ }
139
+
110
140
@ Test
111
141
public void defaultTabsTest () throws IOException , InterruptedException {
112
142
String outFileName = destinationFolder + "defaultTabTest.pdf" ;
@@ -478,6 +508,7 @@ public void tabsAnchorSemicolonTest03() throws IOException, InterruptedException
478
508
private Document initDocument (String outFileName ) throws FileNotFoundException {
479
509
return initDocument (outFileName , false );
480
510
}
511
+
481
512
private Document initDocument (String outFileName , boolean tagged ) throws FileNotFoundException {
482
513
PdfDocument pdfDoc = new PdfDocument (new PdfWriter (outFileName ));
483
514
if (tagged ) {
0 commit comments