text position

38 views
Skip to first unread message

Erwan Jegouzo

unread,
Jul 16, 2012, 2:25:31 PM7/16/12
to purepdf...@googlegroups.com
Hey guys,

I'm having a hard time positioning text in a pdf using both the code from the trunk and the version 0.77.20110116 from the downloads page.
I've tried setSimpleColumn, as demonstrated in the example ColumnTextExample.as, but the y position becomes wrong when the text should be displayed on the 2nd half of the page.

ct.addElement(new Paragraph('my paragraph', fontParagraph) );

ct.setSimpleColumn(450, 190, 595, PageSize.A4.height - 190);

ct.go();

I've also tried using showTextAligned, as demonstrated in HelloWorld4, but the text is not displayed in the right y coordinate and stays at the top left corner.

var cb: PdfContentByte = document.getDirectContent();

var font: BaseFont = BaseFont.createFont( BaseFont.HELVETICA, BaseFont.WINANSI );

cb.beginText();

cb.setFontAndSize( font, 24 );

cb.showTextAligned( Element.ALIGN_LEFT, "Hello spammed world!", 36, 788, 0 );

cb.endText(); 


I might have missed something, but I can't figure out why the text isn't displayed at the right y coordinate.

Does someone have any ideas/working examples?

Thanks fo your help.


Reply all
Reply to author
Forward
0 new messages