Set Form Fields in PDF via .NET SDK
Build your own Cloud apps to set Fillable document files using server-side APIs.
Get StartedHow to Set Form Fields from PDF Document using Cloud .NET SDK
In order to set Form Fields in PDF 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 set Form Fields in PDF via via .NET SDK
Aspose.PDF Cloud developers can easily load & set Form Fields in PDF via in just a few lines of code.
- Create a new Configuration object with your Application Secret and Key
- Create an object to connect to the Cloud API
- Upload your document file
- Perform the setting
- Download the result
System Requirements
It is easy to set started with Aspose.PDF Cloud .NET SDK and there is nothing to install. Simply create an account at Aspose for Cloud and set your application information. Once you have the App SID & key, you are ready to give the Aspose.PDF Cloud .NET SDK.
- .NET Framework 2.0 or later
- JSON.NET
This sample code shows setting Form Fields in PDF documents
public static void SetFormField()
{
const string localImageFileName = @"C:\Samples\StudentInfoFormElectronic.pdf";
const string storageFileName = "StudentInfoFormElectronic.pdf";
// Get your AppSid and AppSecret from https://dashboard.aspose.cloud (free registration required).
var pdfApi = new PdfApi(AppSecret, AppSid);
var filesOnStorage = pdfApi.GetFilesList("");
if (filesOnStorage.Value.All(f => f.Name != storageFileName))
{
using var file = File.OpenRead(localImageFileName);
var uploadResult = pdfApi.UploadFile(storageFileName, file);
Console.WriteLine(uploadResult.Uploaded[0]);
}
var response = pdfApi.PutUpdateField(storageFileName, "First Name", new Field(
Name: "First Name",
Type: FieldType.Text,
Values: ["James"],
Rect: new Rectangle(125, 735, 200, 752)
));
Console.WriteLine(response.Status);
}