Title: Writing text in absolute positions

I'm a new moderatly new user and I'm building some very basic PDF's with images and text.  Because of a list of reasons, I want to use absolute positions on the text I enter, mainly because the page does not flow like a normal document at all.  I'm trying to set the contenByte to a particular (x,y) position and then write a line of text.  Here is what I'm doing:

try {
        BaseFont bfArial = BaseFont.createFont( "c:\\windows\\fonts\\arial.ttf", BaseFont.CP1252,                               BaseFont.NOT_EMBEDDED);                        

                        cb.setFontAndSize( bfArial, 12f );

                        //Paragraph is an object wrapper I used that wraps the iText paragraph object
                                Paragraph paragraph =
                                        (Paragraph)template.getComponents().get( counter );

                                cb.moveText( paragraph.getX(), paragraph.getY() );
                                cb.showText( paragraph.getText() );
                                } catch (DocumentException e) {
                                        e.printStackTrace();
                                } catch (IOException e) {
                                        e.printStackTrace();
}

The program runs fine, except when I open the PDF, I get a message "Illegal Operation 'Td' outside text object".  After pressing OK, the PDF loads fine and the one line of text is shown.  Any idea how I can get that error message to go away?? Thanks

Innovene USA
Strategy
D. Andrew Tietz
Ext. 38814
Cell 630.707.4229

Reply via email to