iText - Modifying PDFWriter# Verticle Alignment manually

Posted by simon622 on Stack Overflow See other posts from Stack Overflow or by simon622
Published on 2010-03-07T23:01:58Z Indexed on 2010/03/07 23:11 UTC
Read the original article Hit count: 804

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about java

Related posts about itext