Hi,
Here the problem is indesign get the x y cordinate from the center.
So i use like this
Public Function CalculateXY() As Double()
Dim xFrame As Double = 211.89
Dim yFrame As Double = 158.031
Dim WFrame As Double = 85.039
Dim HFrame As Double = 85.039
Dim P_Width As Double = 595.276
Dim P_Height As Double = 841.89
Dim arr(1) As Double
arr(0) = xFrame - (WFrame / 2)
arr(1) = P_Height - (yFrame + (HFrame / 2))
Return arr
End Function
And i am not drawing a rectangle. I just want to create a text with applied font
Dim Verdana As Font = FontFactory.GetFont("Verdana", 9, Font.NORMAL, New
BaseColor(0, 0, 0))
Dim bf As BaseFont = Verdana.BaseFont
pdfContentByte.BeginText()
pdfContentByte.SetFontAndSize(bf, 18)
pdfContentByte.SetTextMatrix(arr(0), arr(1))
pdfContentByte.ShowText("Sample Text")
pdfContentByte.Stroke()
pdfContentByte.EndText()
When i do like this i get the text started at same x position but the y
coordinate varies.
Thanks & Regards
Karthik B
--- On Thu, 19/5/11, 1T3XT BVBA <[email protected]> wrote:
> From: 1T3XT BVBA <[email protected]>
> Subject: Re: [iText-questions] Place text in speacified x y coordinate
> To: [email protected]
> Date: Thursday, 19 May, 2011, 3:46 PM
> 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
> [email protected]
> 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
>
------------------------------------------------------------------------------
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
[email protected]
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