@@ -235,12 +235,12 @@ public void createPDFFromText( PDDocument doc, Reader text ) throws IOException
235235 font = new PDType1Font (standardFont );
236236 }
237237 final int margin = 40 ;
238- float height = font .getBoundingBox ().getHeight () / FONTSCALE ;
238+ float fontHeight = font .getBoundingBox ().getHeight () / FONTSCALE ;
239239 PDRectangle actualMediaBox =
240240 landscape ? new PDRectangle (mediaBox .getHeight (), mediaBox .getWidth ()) : mediaBox ;
241241
242- //calculate font height and increase by a factor.
243- height = height * fontSize * LINE_HEIGHT_FACTOR ;
242+ // calculate line height and increase by a factor.
243+ float lineHeight = fontHeight * fontSize * LINE_HEIGHT_FACTOR ;
244244 BufferedReader data = new BufferedReader (text );
245245 String nextLine ;
246246 PDPage page = new PDPage (actualMediaBox );
@@ -344,16 +344,16 @@ public void createPDFFromText( PDDocument doc, Reader text ) throws IOException
344344 contentStream = new PDPageContentStream (doc , page );
345345 contentStream .setFont (font , fontSize );
346346 contentStream .beginText ();
347- y = page .getMediaBox ().getHeight () - margin + height ;
347+ y = page .getMediaBox ().getHeight () - margin + lineHeight ;
348348 contentStream .newLineAtOffset (margin , y );
349349 }
350350
351351 if (contentStream == null )
352352 {
353353 throw new IOException ("Error:Expected non-null content stream." );
354354 }
355- contentStream .newLineAtOffset (0 , -height );
356- y -= height ;
355+ contentStream .newLineAtOffset (0 , -lineHeight );
356+ y -= lineHeight ;
357357 contentStream .showText (nextLineToDraw .toString ());
358358 if (ff )
359359 {
@@ -364,7 +364,7 @@ public void createPDFFromText( PDDocument doc, Reader text ) throws IOException
364364 contentStream = new PDPageContentStream (doc , page );
365365 contentStream .setFont (font , fontSize );
366366 contentStream .beginText ();
367- y = page .getMediaBox ().getHeight () - margin + height ;
367+ y = page .getMediaBox ().getHeight () - margin + lineHeight ;
368368 contentStream .newLineAtOffset (margin , y );
369369 }
370370 }
0 commit comments