Home

Bytescout.PDF for .NET



Bytescout.PDF library for .NET - fill PDF form and save as new PDF file

Download Free Trial Buy Now More Information
For HTML2PDF and XML2PDF solution check our PDFDoc Scout ActiveX library instead

Filling existing PDF form with values and saving as new PDF document

This example demonstrates how to stamp PDF pages with page numbers using Bytescout.PDF library

PDF form filled using BytescoutPDF library\

Download example source code: bytescoutpdf_fill_pdf_form_text_and_checkboxes.zip (10 KB)

using System;
using System.Collections.Generic;
using System.Text;
using Bytescout.PDF;
using System.Diagnostics;

namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
// Create main PDF Doc Engine
PDFDocEngine engine = new PDFDocEngine("", "");

// Add new document
Document document = engine.AddDocument("InputForm.pdf");

// Append new page to the document
Page page = document.GetPage(0);

// Get control list
ControlList controlList = document.Controls;

// Get indices
uint editBoxNameIndex = controlList.GetIndexByName("editBoxName");
uint editBoxSurnameIndex = controlList.GetIndexByName("editBoxSurname");
uint checkBoxMarried = controlList.GetIndexByName("Married");

// Set values
controlList.SetValueByIndex(editBoxNameIndex, "John");
controlList.SetValueByIndex(editBoxSurnameIndex, "Doe");
controlList.SetValueByIndex(checkBoxMarried, "1");

// Save document
document.Save("FillForm.pdf");

// open generated PDF document in default PDF viewer installed in Windows
Process.Start("FillForm.pdf");
}
}
}

Download example source code: bytescoutpdf_fill_pdf_form_text_and_checkboxes.zip (10 KB)

Download Free Trial Buy Now More Information
For HTML2PDF and XML2PDF solution check our PDFDoc Scout ActiveX library instead

"Hello, World!" quick start step-by-step tutorials:

Advanced Examples:
Products  |  Download  |  Purchase  |  Support  |  Contacts  |  Testimonials  |  News |  

ByteScout, 2003-2008. All other company and product names may be trademarks of their respective companies. Privacy Statement