Struggling with this problem in iText with PdfContentByte. When I try to create new page I'm using below code-
canvas = writer.getDirectContent();
canvas.saveState();
canvas.stroke();
canvas.restoreState();
...
canvas.endText();
itextDocument.newPage();
setUpperFontAndSize(canvas);
canvas.beginText();
The issue is occurring at the time of calling endText(). Is there any solution for it??