There are 72 PPI (Points Per Inch). This means that a standard A4 page would be 595 x 842 points.
To properly position your text you must give the coordinates of were you would like to place the text. You can set the coordinates using the SetTextMatrix method.
Please see the following links to get further information on how the coordinates work: PDFTron Systems Inc. | Documentation Class ElementWriter
To put text below that, you can simply use the SetTextMatrix to re-position your text to another set of coordinates. You can also look for the method CreateTextNewLine().
You can take a look at the following sample for some guidance: PDFTron Systems Inc. | Documentation
Alternatively, you can use higher level API stamper class to create the new line. Please see the following sample for more information: PDFTron Systems Inc. | Documentation
Finally, if you need reflow, many users use html or docx to pdf conversion.
For further help, here is some code that will create an A4 page and print “Hello World!” to the top left corner and then prints “Second Line” on the next line.
using (PDFDoc doc = new PDFDoc())
using (ElementBuilder eb = new ElementBuilder()) // ElementBuilder is used to build new Element objects
using (ElementWriter writer = new ElementWriter()) // ElementWriter is used to write Elements to the page
{
// Start a new page ------------------------------------
// Position an image stream on several places on the page
// A4 dimensions
int w = 595;
int h = 842;
Page page = doc.PageCreate(new Rect(0,0,w,h));
writer.Begin(page, ElementWriter.WriteMode.e_overlay, true); // begin writing to this page
// Begin writing a block of text
Element element = eb.CreateTextBegin(Font.Create(doc, Font.StandardType1Font.e_times_roman), 24);
writer.WriteElement(element);
string data = "Hello World!";
element = eb.CreateTextRun(data);
element.SetTextMatrix(1, 0, 0, 1, 0, h - 28);
writer.WriteElement(element);
writer.WriteElement(eb.CreateTextNewLine())
element = eb.CreateTextRun("Second Line");
writer.WriteElement(element);
writer.WriteElement(eb.CreateTextEnd());
writer.End(); // save changes to the current page
doc.PagePushBack(page);
// End page ------------------------------------
doc.Save(output_path + "element_builder_03.pdf", SDFDoc.SaveOptions.e_remove_unused);
Console.WriteLine("Done. Result saved in element_builder.pdf...");