Multiline field: The position of the text depends on a single-line text or a multiline text

Product: PDFNet.dll (PDFNet SDK for .NET)

Product Version: 9.4.8.503

The starting position of the text is different

Add two Fields/TextWidgets with the Multiline flag and set a multiline text to the first TextWidget and a single-line text to the second TextWidget.

The postion of the multiline text is some Twips/Pixel above of the postion of the single-line text.

using (PDFDoc doc = new PDFDoc())
{
	// Create a blank new page and add some form fields.
	Page blank_page = doc.PageCreate();

	// Text Widget Creation 
	Field field1 = doc.FieldCreate("basicone", Field.Type.e_text);
	field1.SetFlag(Field.Flag.e_multiline, true);
	TextWidget text1 = TextWidget.Create(doc, new Rect(100, 700, 350, 730), field1);

	System.Text.StringBuilder basicText1 = new System.Text.StringBuilder();
	basicText1.AppendLine("Line #1");
	basicText1.Append("Line #2");
	text1.SetText(basicText1.ToString());
	text1.SetBorderColor(new ColorPt(0, 0, 0), 3);
	text1.RefreshAppearance();
	blank_page.AnnotPushBack(text1);

	Field field2 = doc.FieldCreate("basictwo", Field.Type.e_text);
	field2.SetFlag(Field.Flag.e_multiline, true);
	TextWidget text2 = TextWidget.Create(doc, new Rect(100, 650, 350, 680), field2);

	System.Text.StringBuilder basicText2 = new System.Text.StringBuilder();
	basicText2.Append("Line #1");
	text2.SetText(basicText2.ToString());
	text2.SetBorderColor(new ColorPt(0, 0, 0), 3);

	text2.RefreshAppearance();
	blank_page.AnnotPushBack(text2);

	// Add the page as the last page in the document.
	doc.PagePushBack(blank_page);

	doc.RefreshFieldAppearances();				

	doc.Save(output_path + "forms_test1.pdf", 0);
}

It would be nice, if all texts start at the exact same relative position.

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

It would be nice, if all texts start at the exact same relative position.

Could you elaborate on how exactly this difference affects your users?

Hi Ryan,

i use a “Notice form” with diffenrent sections like this
grafik

If you enter a single-line text … it look so
grafik

If you enter a multiline text … you get this
grafik

Starting tomorrow you can download a developer preview build of the improvement the team made in this regard.

Please try it out and let us know how it works for you.

Hi Ryan,
Thank you. I will try it and give you feedback on it

Hi Ryan,

looks much better
grafik