i am reading pdf through java and write that data in .csv file.problem is like that when i read 500 pages from pdf at that time they can write only 496 lines what can i do for that i can read all 500 pages from the pdf
my code is like..............
public class pdf1 {
public static void main(String[] args) throws SQLException, ClassNotFoundException {
try {
PdfReader reader = new PdfReader("me1.pdf");
// int n = reader.getNumberOfPages();
File outFile = new File("b.csv");
int n=500;
int count=0;
BufferedWriter writer = new BufferedWriter(new FileWriter(outFile));
for(int i=1;i<=n;i++)
{
String str=PdfTextExtractor.getTextFromPage(reader, i);
System.out.println(str);
writer.write(str);
count++;
System.out.println(count);
} catch (IOException e) {
e.printStackTrace();
}
}
}