I intend to have a different String for every Start of Page depending on values I read from another File. I have Placed this in my onStartPage Method Like this:
@Override
public void onStartPage(PdfWriter writer, Document output) {
try {
File finish = new File("C:/Statements final/");
File[] finf = finish.listFiles();
Font f1 = new Font(Font.NORMAL, 12);
f1.setColor(Color.BLACK);
String firstline = "";
for (int k = 0; k < filenames1.length; k++) {
FileInputStream fs = new FileInputStream("C:/Statements final/" + filenames1[k]);
BufferedReader br = new BufferedReader(new InputStreamReader(fs));
for (int i = 0; i < 0; i++) {
br.readLine();
}
firstline = br.readLine();
System.out.println(firstline);
output.add(new Paragraph(new Phrase(new Chunk(firstline, f1))));
}
} catch (Exception ex) {
System.out.println(ex);
}
}
I am getting this StackOverflow error:
Exception in thread "main" java.lang.StackOverflowError
at java.lang.String.toLowerCase(String.java:2524)
at com.lowagie.text.pdf.PdfEncodings.convertToBytes(PdfEncodings.java:149)
at com.lowagie.text.pdf.BaseFont.convertToBytes(BaseFont.java:795)
at com.lowagie.text.pdf.FontDetails.convertToBytes(FontDetails.java:160)
at com.lowagie.text.pdf.PdfContentByte.showText2(PdfContentByte.java:1386)
at com.lowagie.text.pdf.PdfContentByte.showText(PdfContentByte.java:1396)
at com.lowagie.text.pdf.PdfDocument.writeLineToContent(PdfDocument.java:1587)
at com.lowagie.text.pdf.ColumnText.go(ColumnText.java:841)
at com.lowagie.text.pdf.ColumnText.go(ColumnText.java:752)
at com.lowagie.text.pdf.PdfPRow.writeCells(PdfPRow.java:513)
at com.lowagie.text.pdf.PdfPTable.writeSelectedRows(PdfPTable.java:511)
at com.lowagie.text.pdf.PdfPTable.writeSelectedRows(PdfPTable.java:587)
at com.lowagie.text.pdf.PdfPTable.writeSelectedRows(PdfPTable.java:543)
at com.lowagie.text.pdf.PdfDocument.newPage(PdfDocument.java:830)
at com.lowagie.text.pdf.PdfDocument.carriageReturn(PdfDocument.java:1192)
at com.lowagie.text.pdf.PdfDocument.add(PdfDocument.java:482)
at estatement.Border.onStartPage(Border.java:112)
Anyone who knows what I should Do.