HTML JPG PDF XML DOCX
  Product Family
PDF

Create PDF Forms in .NET SDK

Add Form Fields to a PDF Document on .NET apps to create Fillable document.

Get Started

How to create an AcroForm via Cloud .NET SDK

In order to create an AcroForm via Cloud .NET SDK , we’ll use Aspose.PDF Cloud .NET SDK This Cloud SDK allows you to easily build cloud-based PDF creator, editor & converter apps in C#, ASP.NET, or other .NET languages for various cloud platforms. Open NuGet package manager, search for Aspose.PDF Cloud and install. You may also use the following command from the Package Manager Console.

Package Manager Console Command


    PM> Install-Package Aspose.Pdf-Cloud
     

Steps to create AcroForms via .NET SDK

Aspose.PDF Cloud developers can easily load & create acroforms in PDF in just a few lines of code.

  1. Create a new Configuration object with your Application Secret and Key
  2. Create an object to connect to the Cloud API
  3. Upload your document file
  4. Perform the creating
  5. Download the result
 

This sample code shows creating an AcroForms in PDF documents


    public static async Task AddFormField()
    {
        const string localPdfDocumentName = @"C:\Samples\sample.pdf";
        const string storageFileName = "sample.pdf";
        const string localFolder = @"C:\\Samples";
        const string resultFileName = "output_add_form_filed.pdf";

        // Get your AppSid and AppSecret from https://dashboard.aspose.cloud (free registration required).            
        var pdfApi = new PdfApi(AppSecret, AppSid);

        var filesOnStorage = await pdfApi.GetFilesListAsync("");
        if (filesOnStorage.Value.All(f => f.Name != storageFileName))
        {
            using var file = File.OpenRead(localPdfDocumentName);
            var uploadResult = await pdfApi.UploadFileAsync(storageFileName, file);
            Console.WriteLine(uploadResult.Uploaded[0]);
        }
        var textBoxField = new TextBoxField(
            PageIndex: 1,            
            PartialName: "First Name",
            Rect: new Rectangle(100, 100, 180, 120),
            Value: "Your text box field value",
            Border: new Border(Width: 5, Dash: new Dash(1, 1), Color: new Color(255, 0, 255, 0))
        );

        var response = await pdfApi.PutTextBoxFieldAsync(storageFileName, "Email", textBoxField);
        Console.WriteLine(response.Status);

        await (await pdfApi.DownloadFileAsync(storageFileName))
            .CopyToAsync(File.Create(Path.Combine(localFolder, resultFileName)));

        Console.WriteLine("AddFormField(): TextBox form field added to the document '{0}.", resultFileName);
    }