AcroForm 채우기 - C#를 사용하여 PDF 양식 채우기

다음 코드 스니펫은 Aspose.PDF.Drawing 라이브러리와 함께 작동합니다.

PDF 문서에서 양식 필드 채우기

양식 필드를 채우려면 Document 객체의 Form 컬렉션에서 필드를 가져옵니다. 그런 다음 필드의 Value 속성을 사용하여 필드 값을 설정합니다.

이 예제는 TextBoxField를 선택하고 Value 속성을 사용하여 값을 설정합니다.

// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void FillFormField()
{
    // The path to the documents directory
    var dataDir = RunExamples.GetDataDir_AsposePdf_Forms();

    // Open PDF document
    using (var document = new Aspose.Pdf.Document(dataDir + "FillFormField.pdf"))
    {
        // Get a field
        if (document.Form["textbox1"] is Aspose.Pdf.Forms.TextBoxField textBoxField)
        {
            // Modify field value
            textBoxField.Value = "Value to be filled in the field";
        }

        // Save PDF document
        document.Save(dataDir + "FillFormField_out.pdf");
    }
}