Hi Aspose Support,
Using Aspose Pdf 9.4 for .NET 4.0, I’m trying to add a fixed-space textbox field by using the ForceCombs and MaxLen properties.
The output pdf is created successfully. When opening the pdf in Adobe Reader the appearance/state of the textbox does not appear as fixed space. Editing the textfield then displays the textfield as fixed space.
Is there a reason why the textfield doesn’t display as fixed space when first opened in Adobe Reader?
Thanks, Alan
using System.IO;using Aspose.Pdf;
using Aspose.Pdf.InteractiveFeatures.Forms;
using Aspose.Pdf.InteractiveFeatures.Annotations;namespace AddingTextBoxField
{
public class Program
{
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Path.GetFullPath(“…/…/…/Data/”);//Open document Document pdfDocument = new Document(); pdfDocument.Pages.Add(); //Create a field TextBoxField textBoxField = new TextBoxField(pdfDocument.Pages[1], new Aspose.Pdf.Rectangle(100, 200, 300, 250)); textBoxField.PartialName = "textbox1"; textBoxField.Value = "Text Box"; textBoxField.MaxLen = 8; textBoxField.ForceCombs = true; //textBoxField.Border = new Border( /*Border border = new Border(textBoxField); border.Width = 5; border.Dash = new Dash(1, 1); textBoxField.Border = border;*/ //textBoxField.Color = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Green); //Add field to the document pdfDocument.Form.Add(textBoxField, 1); //Save modified PDF pdfDocument.Save(dataDir + "output.pdf"); } }
}