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.

Reply via email to