Juanjo wrote:

Hi,

I'm a new user of iText. I want to build a PDF with text in a absolute possition to the margin of the page (in this case, the margin is 0). I'm using the follow: cb.moveText(85f, (PageSize.A4.height() - 99f)); cb.showText("Fagor"); cb.moveText(85f, (PageSize.A4.height() - 133f)); cb.showText("XML394"); cb.moveText(28f, (PageSize.A4.height() - 198f)); cb.showText("-"); cb.moveText(14f, (PageSize.A4.height() - 382f)); cb.showText("25€"); cb.moveText(141f, (PageSize.A4.height() - 382f)); cb.showText("345€");
(cb is a PDFContentByte object)
                                
But when I run the program, in the PDF generated, I only can see the first line (Fagor).... Anyboy can help me?

With moveText, you insert a Td operator.
In the PDF Reference Manual, Td is explained like this:
Move to the start of the next line, offset from the start of the current line by
(tx , ty ). tx and ty are numbers expressed in unscaled text space units.

See also: http://itextdocs.lowagie.com/docs/com/lowagie/text/pdf/PdfContentByte.html#moveText(float,%20float)

So Fagor is printed at the correct location, but all the rest is added almost
a pageheight lower (thus falling off the page). You should use an x and an y
that are relative to the position of Fagor instead of absolute coordinates.

br,
Bruno


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to