iText - Modifying PDFWriter# Verticle Alignment manually
- by simon622
Ive hit upon a problem using iText (java), despite hours of looking thru the docs..
Most of the code I use goes via the Document# API which tracks (via the PDFWriter instance) the current Y position. HOWEVER, we need to use the PdfContentByte part of the API to insert some Java2d into the document, but in doing so this appears to bypass the logic which tracks verticle writes. So next time I use the Document API, it overwrites the contents of the manually inserted things. I want to mimick the behaviour of the Document# API by manually moving the cursor on N number of units (N being the height of the element inserted by the PDFContentByte API), such that when I then use the Document object again, bingo, its cursor is in the correct location. I can see that a method to obtain the cursor exists;
PdfWriter#getVerticalPosition(boolean);
But not one to set it?!
Any ideas anyone?
Thanks.