Op 19/05/2011 12:05, karthik B schreef: > Hi, > I am not using any form field. I just have the coordinates given by the > indesign system. I need to place a text in the specified coordinate into the > PDF. > > For example: > I get an input from indesign as > X 211.89 pt > Y 158.031 pt > W 85.039 pt > H 85.039 pt > Page Width 595.276 pt > Page Height 841.89 pt > > With this input i need to place the text in the right area in the PDF. > > I use the following code to place > > pdfContentByte.BeginText() > pdfContentByte.SetFontAndSize(bf, 9) > pdfContentByte.SetTextMatrix(x, y) > pdfContentByte.ShowText("Sample text") > pdfContentByte.Stroke() > pdfContentByte.EndText()
And I'm 100% sure that iText adds the text at the exact X Y coordinate. But maybe you're not interpreting the coordinate correctly. Use iText to draw a rectangle with those coordinates. How are you going to do this? Will you draw a rectangle with lower left corner (211.89, 158.031) and upper right corner (296.929, 243.07)? Or will you draw a rectangle with lower left corner (211.89, 72.992) and upper right corner (296.929, 158.031)? That's one possible reason why Y might be wrong: you're interpreting the H value in the wrong direction. Another reason can be: iText assumes Y = 0 at the bottom of the page and Y = 841.89 at the top of the page. In other coordinate systems, Y = 0 at the top of the page and Y = 841.89 at the bottom of the page. Also: are there any coordinate transformations at play? I repeat: you're doing something wrong, but you're not showing us what you're doing, so we can't say what you're doing wrong. ------------------------------------------------------------------------------ What Every C/C++ and Fortran developer Should Know! Read this article and learn how Intel has extended the reach of its next-generation tools to help Windows* and Linux* C/C++ and Fortran developers boost performance applications - including clusters. http://p.sf.net/sfu/intel-dev2devmay _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php