ByteScout PDF SDK – C# – Read Form Values from W-9 form

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF SDK – C# – Read Form Values from W-9 form

ByteScout PDF SDK – C# – Read Form Values from W-9 form

Program.cs

using Bytescout.PDF;
using System;

namespace ReadForm
{
    class Program
    {
        static void Main(string[] args)
        {
            // Load PDF form
            Document pdfDocument = new Document(@"W-9_Filled.pdf");
            pdfDocument.RegistrationName = "demo";
            pdfDocument.RegistrationKey = "demo";

            Page page = pdfDocument.Pages[0];

            Console.WriteLine("W-9 Form values are as follows");

            // Name
            var cName = ((EditBox)page.Annotations["f1_1[0]"]).Text;
            Console.WriteLine($"Name: {cName}");

            // Business Address
            var cAddress = ((EditBox)page.Annotations["f1_2[0]"]).Text;
            Console.WriteLine($"Address: {cAddress}");

            // Cleanup 
            pdfDocument.Dispose();

            Console.WriteLine();
            Console.WriteLine("Press any key to exit....");
            Console.ReadLine();
        }
    }
}


  Click here to get your Free Trial version of the SDK

Tutorials:

prev
next