HTML JPG PDF XML DOCX
  Product Family
PDF

Add PDF Forms in Go SDK

Add Form Fields to a PDF Document using Go Cloud SDK

Get Started

How to create an AcroForm via Go SDK

In order to create an AcroForm to PDF, we’ll use Aspose.PDF Cloud Go SDK. This Cloud SDK assists Go programmers in developing cloud-based PDF creator, annotator, editor, and converter apps using Go programming language via Aspose.PDF REST API. Simply create an account at Aspose for Cloud and get your application information. Once you have the App SID & key, you are ready to give the Aspose.PDF Cloud Go SDK.

Package Manager Console Command


     
    go get -u github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v25
     
     

Steps to create AcroForms via Go

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

  1. Uploads the PDF file to the Aspose.PDF Cloud service.
  2. Creates a new text box field with the necessary properties
  3. Adds the text box field to the PDF file stored in the Aspose.PDF Cloud service.
  4. Download the result if needed it
 

This sample code shows creating an AcroForms in PDF documents using Go


    package main

    import (
        "fmt"

        asposepdfcloud "github.com/aspose-pdf-cloud/aspose-pdf-cloud-go/v25"
    )

    func appendFormFiled(document_name string, output_name string, local_folder string, remote_folder string) {
        // Initialize Credentials and create Pdf.Cloud service object
	AppSID := "YOUR_APP_SID" // Your Application SID
	AppKey := "YOUR_APP_KEY" // Your Application Key

	pdfApi := asposepdfcloud.NewPdfApiService(AppSID, AppKey, "")

	args := map[string]interface{}{
            "folder": remote_folder,
	}

	file, _ := os.Open(filepath.Join(local_folder, document_name))
	_, _, _ = pdfApi.UploadFile(filepath.Join(remote_folder, document_name), file, args)


	textBox := asposepdfcloud.TextBoxField{
		PageIndex:   1,
		PartialName: "EMail",
		Rect:        &asposepdfcloud.Rectangle{LLX: 100, LLY: 100, URX: 180, URY: 120},
		Value:       "aspose-pdf-cloud@example.com",
		Border:      &asposepdfcloud.Border {
                    Width: 5,
                    Dash:  &asposepdfcloud.Dash{On: 1, Off: 1},
		},
	}

	_, httpResponse, err := pdfApi.PutTextBoxField(document_name, "EMail", textBox, args)

	if err != nil {
            fmt.Println(err.Error())
	} else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
            fmt.Println("Unexpected error!")
	} else {
            result_data, _, _ := pdfApi.DownloadFile(path.Join(remote_folder, document_name), args)
	    fileName := path.Join(local_folder, output_name)
	    f, _ := os.Create(fileName)
	    _, _ = f.Write(result_data)
	}
    }
 

Work with the AcroForms via Go SDK

AcroForms allows users to interact directly with the PDF by filling out fields, selecting options, or clicking buttons, making the document more dynamic. Interactive forms enable efficient data collection, reducing the need for manual data entry or external tools. This is ideal for surveys, registrations, and application processes. Users can fill in forms electronically without printing, scanning, or using other tools, saving time and effort. Including AcroForms in documents creates a polished and modern presentation, reflecting professionalism and attention to detail. Add the AcroForms into PDF documents with Aspose.PDF Cloud Go SDK.

With our Go library you can

  • Add PDF document’s header & footer in text or image format.
  • Add tables & stamps (text or image) to PDF documents.
  • Append multiple PDF documents to an existing file.
  • Work with PDF attachments, annotations, & form fields.
  • Apply encryption or decryption to PDF documents & set a password.
  • Delete all stamps & tables from a page or entire PDF document.
  • Delete a specific stamp or table from the PDF document by its ID.
  • Replace single or multiple instances of text on a PDF page or from the entire document.
  • Extensive support for converting PDF documents to various other file formats.
  • Extract various elements of PDF files & make PDF documents optimized.
  • You can try out our free App to add the AcroForms into PDF files online and test the functionality.