Link Search Menu Expand Document

Fill PDF Form - C#

PDF SDK sample in C# demonstrating ‘Fill PDF Form’

using System;
using System.Diagnostics;
using Bytescout.PDF;

namespace FillFormExample
    /// <summary>
    /// This example demonstrates how to fill PDF form programmatically.
    /// </summary>
    class Program
        static void Main()
            // Load PDF form
            Document pdfDocument = new Document(@"form.pdf");
            pdfDocument.RegistrationName = "demo";
            pdfDocument.RegistrationKey = "demo";

            Page page = pdfDocument.Pages[0];

            // Get widget by its name and change value
            ((EditBox) page.Annotations["editBox1"]).Text = "Test 123";
            ((EditBox) page.Annotations["editBox2"]).Text = "Test 456";
            ((CheckBox) page.Annotations["checkBox1"]).Checked = true;

            // Save modified document

            // Cleanup 

            // Open result document in default associated application (for demo purpose)
            ProcessStartInfo processStartInfo = new ProcessStartInfo("result.pdf");
            processStartInfo.UseShellExecute = true;

Download Source Code (.zip)

Return to the previous page Explore PDF SDK