I try reading a text file and then generate a pdf from the text but the resulting PDF does not contain all the text.
Here is a snippet of my code:
PDDocument document = new PDDocument();
PDPage page = new PDPage();
document.addPage(page);
PDPageContentStream contentStream = new PDPageContentStream(document,page);
contentStream.beginText();
contentStream.setFont(PDType1Font.HELVETICA, 14);
contentStream.newLineAtOffset(25, 700);
contentStream.setLeading(18f);
while ((line = reader.readLine()) != null) {
contentStream.showText(line);
contentStream.newLine();
}
contentStream.endText();
contentStream.close();
document.save(targetPath);
document.close();