We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Create multiple textbox in Horizontal direction

i have one doubt in Aspose.pdf .Net library, i need to create a multiple text box at horizontal direction, but now i am able to create single text box at the Horizontal direction

ex:

Name : [ text box1 ] Address : [ text box2 ] City : [ text box3]

like this format

Hello Infognana,

Thanks for using our products.

In order to display the text fields in the same line, you can create a table and place the Text Fields inside the table cells. But I am afraid in recent version of Aspose.Pdf for .NET 4.2.0, when adding the form field inside the table cell, it's disturbing the table layout. For the sake of correction, I have logged this issue as PDFNET-15675 in our issue tracking system. We will look into the details of this problem and will keep you updated on the status of correction. Please be patient and spare us little time.

We apologize for your inconvenience.

FYI, You may take a look over the following code snippet on how to add the text fields inside the table cells.

[C#]

// Instantiate an object PDF class
Pdf pdf = new Pdf();
// add the section to PDF document sections collection
Aspose.Pdf.Section section = pdf.Sections.Add();

//Instantiate a table object
Aspose.Pdf.Table tab1 = new Aspose.Pdf.Table();
//Set default cell border using BorderInfo object
tab1.DefaultCellBorder = new BorderInfo((int)BorderSide.All, 0.1F);
//Add the table in paragraphs collection of the desired section
section.Paragraphs.Add(tab1);
//Set with column widths of the table
tab1.ColumnWidths = "50 50 50 50 50 50";

//create a First FormField.
FormField f1 = new FormField();
f1.FormFieldType = FormFieldType.Text;
f1.FieldName = "Name";

//create a Second FormField.
FormField f2 = new FormField();
f2.FormFieldType = FormFieldType.Text;
f2.FieldName = "Address";

//create a Third FormField.
FormField f3 = new FormField();
f3.FormFieldType = FormFieldType.Text;
f3.FieldName = "City";

//Create rows in the table and then cells in the rows
Aspose.Pdf.Row row1 = tab1.Rows.Add();
row1.Cells.Add("Name :");
// create a table cell to hold the FirstForm Field
Aspose.Pdf.Cell c1 = new Aspose.Pdf.Cell(row1);
// add the form field to the paragraphs collection of table cell
c1.Paragraphs.Add(f1);
row1.Cells.Add(c1);

row1.Cells.Add("Address :");
// create a table cell to hold the SecondForm Field
Aspose.Pdf.Cell c2 = new Aspose.Pdf.Cell(row1);
// add the form field to the paragraphs collection of table cell
c2.Paragraphs.Add(f2);
row1.Cells.Add(c2);

row1.Cells.Add("City :");

// create a table cell to hold the ThirdForm Field
Aspose.Pdf.Cell c3 = new Aspose.Pdf.Cell(row1);
// add the form field to the paragraphs collection of table cell
c3.Paragraphs.Add(f3);
row1.Cells.Add(c3);

pdf.Save("D:/pdftest/InLineFormField.pdf");