Free Support Forum -

Text Insert X position tracking

My application requires me to add text in the following way (pseudo code):

Function AddText()
//Obj is just an arbitrary reference to an object used to store various values
Dim CurrentX = Obj.X * 72
Dim CurerntY = Obj.Y * 72
Dim pageWidth = Page.PageInfo.Width - LeftMargin - RightMargin
Dim Fragment = New TextFragment(Text)

Fragment.isInline = true

//Storing the Fragment X and Y positions in object properties

Obj.X = (Fragment.Rectangle.Width Mod PageWidth) / 72 //conversion to inches
Obj.Y = (Fragment.Rectangle.Height + NumberofLines) / 72 //assume number of lines is already calculated


Then repeat the process with new Text

The problem is when adding a new TextFragment and then the line is greater than the page width and begins wrapping the Mod calculation doesn’t work because the word wrapping generates empty space depending on the location of the wrap. Is it possible to somehow obtain this measurement?


Would you kindly provide following information so that we can test the scenario in our environment and share our feedback with you accordingly:

  • Sample PDF document
  • Values for X,Y coordinates and their unit
  • Expected output PDF
  • Original generated PDF output

Hi Asad,

Thanks for the reply but I resolved the issue a different way. You can close this.