Check that you don't have a crop box in the page.

----- Original Message ----- From: "lloyd thompson" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, April 10, 2006 6:44 PM
Subject: [iText-questions] Image appears 0.5cm off correct Y coordinate when printed


Hi,



I'm creating a Class that will be used to stamp headers, footers and
barcodes on existing documents and to do this I intend to use a PDFStamper. I am aware that the (0,0) co-ordinate in I-Text is at the bottom left corner and so assuming I want to add a picture at X=10cm and Y=25cm I have written
some code as follows:





double xInMM=100;

double yInMM=250;

double mmToPoint=2.834644567;

float xInPoints=(float)(xInMM*mmToPoint);

float yInPoints=(float)(yInMM*mmToPoint);



PdfReader reader = new PdfReader("C://input.pdf");

PdfStamper stamp = new PdfStamper(reader, new
FileOutputStream("C://output.pdf"));



Image img = Image.getInstance("C://square.bmp");

img.setAbsolutePosition(xInPoints, yInPoints);



// text over the existing page

PdfContentByte over = stamp.getOverContent(1);

over.addImage(img);



Having printed the 'stamped' document, I find that the X co-ordinate is
correct, yet the Y co-ordinate is approximately 1/2cm out, i.e. my square
appears at 24.5cm. Where is this offset coming from? Which object can I use
to get hold of this value.



Many thanks,



Lloyd




____________________________________________________________________________

This e-mail (and any attachments) may contain privileged and/or confidential
information. If you are not the intended recipient please do not disclose,
copy, distribute, disseminate or take any action in reliance on it.

If you have received this message in error please inform us and delete it.
Should you wish to communicate with us by e-mail we cannot guarantee the security
of any data outside our own computer systems.

For the protection of our systems and staff, incoming and outgoing
emails are automatically scanned for viruses and content.





-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to