How to Manage PDF Forms Using Cloud .NET SDK
In order to work with AcroForms 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: 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.
- Create an instance of PdfApi using your AppSid and AppSecret from Aspose Cloud Dashboard.
- Check Cloud Storage for File. Retrieve the list of files in cloud storage using GetFilesList(""). If the target file is not found, proceed to upload it.
- Upload PDF to Cloud Storage (if needed).
- Create a TextBox Field. Instantiate a TextBoxField object for page 1 and set properties.
- Add the Field to the PDF. Use PutTextBoxField to insert the field into the document stored in the cloud.
- Print Operation Status. Output the result status to the console.
This sample code shows creating an AcroForms in PDF documents
public static void AddFormField()
{
const string localPdfDocumentName = @"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(localPdfDocumentName);
var uploadResult = pdfApi.UploadFile(storageFileName, file);
Console.WriteLine(uploadResult.Uploaded[0]);
}
var textBoxField = new TextBoxField(PageIndex: 1)
{
PartialName = "Email",
Rect = new Rectangle(100, 100, 180, 120),
Value = "aspose-pdf-cloud@example.com",
Border = new Border(Width: 5, Dash: new Dash(1, 1))
};
var response = pdfApi.PutTextBoxField(storageFileName, "Email", textBoxField);
Console.WriteLine(response.Status);
}
- Learning Resources
- Documentation
- Source Code
- API References
- Product Support
- Free Support
- Paid Support
- Blog
- Why Aspose.PDF Cloud for .NET?
- Customers List
- Security