// Open document
auto document = MakeObject<Document>(_dataDir + u"TextField.pdf");
// Create a field
auto textBoxField = MakeObject<TextBoxField>(
document->get_Pages()->idx_get(1),
MakeObject<Aspose::Pdf::Rectangle>(100, 200, 300, 300)
);
textBoxField->set_PartialName (u"textbox1");
textBoxField->set_Value (u"Text Box");
// TextBoxField.Border = new Border(
auto border = MakeObject<Aspose::Pdf::Annotations::Border>(textBoxField);
border->set_Width(5);
border->set_Dash (MakeObject<Aspose::Pdf::Annotations::Dash>(1, 1));
textBoxField->set_Border(border);
textBoxField->set_Color(Aspose::Pdf::Color::get_Green());
// Add field to the document
document->get_Form()->Add(textBoxField, 1);
// Save modified PDF
document->Save(_dataDir + u"TextBox_out.pdf");