@@ -43,7 +43,6 @@ source product.
4343using System ;
4444using iText . IO . Image ;
4545using iText . Kernel . Colors ;
46- using iText . Kernel . Geom ;
4746using iText . Kernel . Pdf ;
4847using iText . Kernel . Pdf . Xobject ;
4948using iText . Kernel . Utils ;
@@ -80,7 +79,7 @@ public virtual void ParagraphTest() {
8079 Paragraph p = new Paragraph ( new Text ( str ) . SetBorder ( new SolidBorder ( Color . BLACK , 5 ) ) ) . SetBorder ( new SolidBorder
8180 ( Color . BLUE , 5 ) ) ;
8281 MinMaxWidth result = ( ( AbstractRenderer ) p . CreateRendererSubTree ( ) . SetParent ( doc . GetRenderer ( ) ) ) . GetMinMaxWidth
83- ( doc . GetPageEffectiveArea ( PageSize . A4 ) . GetWidth ( ) ) ;
82+ ( MinMaxWidthUtils . GetMax ( ) ) ;
8483 p . SetWidth ( ToEffectiveWidth ( p , result . GetMinWidth ( ) ) ) ;
8584 doc . Add ( p ) ;
8685 doc . Close ( ) ;
@@ -102,7 +101,7 @@ public virtual void DivTest() {
102101 Div d = new Div ( ) . SetPadding ( 4f ) . SetBorder ( new SolidBorder ( Color . GREEN , 5 ) ) . SetMargin ( 6 ) ;
103102 d . Add ( p ) ;
104103 MinMaxWidth result = ( ( AbstractRenderer ) d . CreateRendererSubTree ( ) . SetParent ( doc . GetRenderer ( ) ) ) . GetMinMaxWidth
105- ( doc . GetPageEffectiveArea ( PageSize . A4 ) . GetWidth ( ) ) ;
104+ ( MinMaxWidthUtils . GetMax ( ) ) ;
106105 d . SetWidth ( ToEffectiveWidth ( d , result . GetMinWidth ( ) ) ) ;
107106 doc . Add ( d ) ;
108107 doc . Close ( ) ;
@@ -125,7 +124,7 @@ public virtual void DivWithSmallRotatedParagraph() {
125124 d . Add ( new Paragraph ( ( "iText" ) ) . SetRotationAngle ( Math . PI / 8 ) . SetBorder ( new SolidBorder ( Color . BLUE , 2f ) ) ) ;
126125 d . Add ( p ) ;
127126 MinMaxWidth result = ( ( AbstractRenderer ) d . CreateRendererSubTree ( ) . SetParent ( doc . GetRenderer ( ) ) ) . GetMinMaxWidth
128- ( doc . GetPageEffectiveArea ( PageSize . A4 ) . GetWidth ( ) ) ;
127+ ( MinMaxWidthUtils . GetMax ( ) ) ;
129128 d . SetWidth ( ToEffectiveWidth ( d , result . GetMinWidth ( ) ) ) ;
130129 doc . Add ( d ) ;
131130 doc . Close ( ) ;
@@ -136,6 +135,7 @@ public virtual void DivWithSmallRotatedParagraph() {
136135 /// <exception cref="System.IO.IOException"/>
137136 /// <exception cref="System.Exception"/>
138137 [ NUnit . Framework . Test ]
138+ [ LogMessage ( iText . IO . LogMessageConstant . ELEMENT_DOES_NOT_FIT_AREA ) ]
139139 public virtual void DivWithBigRotatedParagraph ( ) {
140140 String outFileName = destinationFolder + "divBigRotatedParagraphTest01.pdf" ;
141141 String cmpFileName = sourceFolder + "cmp_divBigRotatedParagraphTest01.pdf" ;
@@ -148,7 +148,7 @@ public virtual void DivWithBigRotatedParagraph() {
148148 d . Add ( p ) ;
149149 d . Add ( new Paragraph ( ( "iText" ) ) ) ;
150150 MinMaxWidth result = ( ( AbstractRenderer ) d . CreateRendererSubTree ( ) . SetParent ( doc . GetRenderer ( ) ) ) . GetMinMaxWidth
151- ( doc . GetPageEffectiveArea ( PageSize . A4 ) . GetWidth ( ) ) ;
151+ ( MinMaxWidthUtils . GetMax ( ) ) ;
152152 d . SetWidth ( ToEffectiveWidth ( d , result . GetMinWidth ( ) ) ) ;
153153 doc . Add ( d ) ;
154154 doc . Close ( ) ;
@@ -172,7 +172,7 @@ public virtual void DivWithSmallRotatedDiv() {
172172 Div dRotated = new Div ( ) . SetRotationAngle ( Math . PI / 8 ) . SetBorder ( new SolidBorder ( Color . BLUE , 2f ) ) ;
173173 d . Add ( dRotated . Add ( new Paragraph ( ( "iText" ) ) ) ) ;
174174 MinMaxWidth result = ( ( AbstractRenderer ) d . CreateRendererSubTree ( ) . SetParent ( doc . GetRenderer ( ) ) ) . GetMinMaxWidth
175- ( doc . GetPageEffectiveArea ( PageSize . A4 ) . GetWidth ( ) ) ;
175+ ( MinMaxWidthUtils . GetMax ( ) ) ;
176176 d . SetWidth ( ToEffectiveWidth ( d , result . GetMinWidth ( ) ) ) ;
177177 doc . Add ( d ) ;
178178 doc . Close ( ) ;
@@ -195,7 +195,7 @@ public virtual void DivWithBigRotatedDiv() {
195195 dRotated . Add ( p ) . SetRotationAngle ( Math . PI * 3 / 8 ) ;
196196 Div d = new Div ( ) . Add ( new Paragraph ( ( "iText" ) ) ) . Add ( dRotated ) . SetBorder ( new SolidBorder ( Color . BLUE , 2f ) ) ;
197197 MinMaxWidth result = ( ( AbstractRenderer ) d . CreateRendererSubTree ( ) . SetParent ( doc . GetRenderer ( ) ) ) . GetMinMaxWidth
198- ( doc . GetPageEffectiveArea ( PageSize . A4 ) . GetWidth ( ) ) ;
198+ ( MinMaxWidthUtils . GetMax ( ) ) ;
199199 d . SetWidth ( ToEffectiveWidth ( d , result . GetMinWidth ( ) ) ) ;
200200 doc . Add ( d ) ;
201201 doc . Close ( ) ;
@@ -217,10 +217,10 @@ public virtual void DivWithPercentImage() {
217217 iText . Layout . Element . Image imgPercent = new iText . Layout . Element . Image ( imageXObject ) . SetWidthPercent ( 50 ) ;
218218 Div dPercent = new Div ( ) . Add ( imgPercent ) . SetBorder ( new SolidBorder ( Color . BLUE , 2f ) ) ;
219219 MinMaxWidth result = ( ( AbstractRenderer ) d . CreateRendererSubTree ( ) . SetParent ( doc . GetRenderer ( ) ) ) . GetMinMaxWidth
220- ( doc . GetPageEffectiveArea ( PageSize . A4 ) . GetWidth ( ) ) ;
220+ ( MinMaxWidthUtils . GetMax ( ) ) ;
221221 d . SetWidth ( ToEffectiveWidth ( d , result . GetMinWidth ( ) ) ) ;
222222 MinMaxWidth resultPercent = ( ( AbstractRenderer ) dPercent . CreateRendererSubTree ( ) . SetParent ( doc . GetRenderer (
223- ) ) ) . GetMinMaxWidth ( doc . GetPageEffectiveArea ( PageSize . A4 ) . GetWidth ( ) ) ;
223+ ) ) ) . GetMinMaxWidth ( MinMaxWidthUtils . GetMax ( ) ) ;
224224 dPercent . SetWidth ( ToEffectiveWidth ( dPercent , resultPercent . GetMaxWidth ( ) ) ) ;
225225 doc . Add ( d ) ;
226226 doc . Add ( dPercent ) ;
@@ -245,10 +245,10 @@ public virtual void DivWithRotatedPercentImage() {
245245 ( Math . PI * 3 / 8 ) ;
246246 Div dPercent = new Div ( ) . Add ( imgPercent ) . SetBorder ( new SolidBorder ( Color . BLUE , 2f ) ) ;
247247 MinMaxWidth result = ( ( AbstractRenderer ) d . CreateRendererSubTree ( ) . SetParent ( doc . GetRenderer ( ) ) ) . GetMinMaxWidth
248- ( doc . GetPageEffectiveArea ( PageSize . A4 ) . GetWidth ( ) ) ;
248+ ( MinMaxWidthUtils . GetMax ( ) ) ;
249249 d . SetWidth ( ToEffectiveWidth ( d , result . GetMinWidth ( ) ) ) ;
250250 MinMaxWidth resultPercent = ( ( AbstractRenderer ) dPercent . CreateRendererSubTree ( ) . SetParent ( doc . GetRenderer (
251- ) ) ) . GetMinMaxWidth ( doc . GetPageEffectiveArea ( PageSize . A4 ) . GetWidth ( ) ) ;
251+ ) ) ) . GetMinMaxWidth ( MinMaxWidthUtils . GetMax ( ) ) ;
252252 dPercent . SetWidth ( ToEffectiveWidth ( dPercent , resultPercent . GetMaxWidth ( ) ) ) ;
253253 doc . Add ( d ) ;
254254 doc . Add ( dPercent ) ;
@@ -279,7 +279,7 @@ public virtual void MultipleDivTest() {
279279 ( 3 ) . SetBackgroundColor ( Color . LIGHT_GRAY ) ;
280280 curr . Add ( p ) ;
281281 MinMaxWidth result = ( ( AbstractRenderer ) externalDiv . CreateRendererSubTree ( ) . SetParent ( doc . GetRenderer ( ) ) ) .
282- GetMinMaxWidth ( doc . GetPageEffectiveArea ( PageSize . A4 ) . GetWidth ( ) ) ;
282+ GetMinMaxWidth ( MinMaxWidthUtils . GetMax ( ) ) ;
283283 externalDiv . SetWidth ( ToEffectiveWidth ( externalDiv , result . GetMinWidth ( ) ) ) ;
284284 doc . Add ( externalDiv ) ;
285285 doc . Close ( ) ;
@@ -392,7 +392,7 @@ public virtual void HeaderFooterTableTest() {
392392 ( cell . Clone ( true ) ) . AddFooterCell ( bigCell . Clone ( true ) ) . AddHeaderCell ( bigCell . Clone ( true ) ) . AddHeaderCell
393393 ( cell . Clone ( true ) ) . AddHeaderCell ( cell . Clone ( true ) ) ;
394394 TableRenderer renderer = ( TableRenderer ) table . CreateRendererSubTree ( ) . SetParent ( doc . GetRenderer ( ) ) ;
395- MinMaxWidth minMaxWidth = renderer . GetMinMaxWidth ( doc . GetPageEffectiveArea ( PageSize . A4 ) . GetWidth ( ) ) ;
395+ MinMaxWidth minMaxWidth = renderer . GetMinMaxWidth ( MinMaxWidthUtils . GetMax ( ) ) ;
396396 Table minTable = new Table ( new float [ ] { - 1 , - 1 , - 1 } ) . SetWidth ( UnitValue . CreatePointValue ( 1 ) ) . SetBorder ( new
397397 SolidBorder ( Color . BLACK , 20 ) ) . SetMarginTop ( 20 ) . AddCell ( mediumCell . Clone ( true ) ) . AddCell ( mediumCell . Clone
398398 ( true ) ) . AddCell ( mediumCell . Clone ( true ) ) . AddFooterCell ( cell . Clone ( true ) ) . AddFooterCell ( cell . Clone ( true )
0 commit comments