Overview

Read, create and manipulate PDF documents and PDF forms on the fly. Split, append, stamp, encrypt, extract, fill and more. PDFKit.NET is deployed as a single assembly, it is written entirely in C# and has no external dependencies.

Feature highlights

  • Fill and flatten PDF forms
  • Split and append PDF documents/pages
  • Extract, modify and add graphics
  • Digitally sign and verify PDF documents
  • Written in C# - no unsafe code
  • Single assembly - no dependencies

What's new in 4.0?

  • Generate QR codes
  • Import JBIG2 images
  • New build without System.Drawing.dll: required to run on Server 2008 x64

Fill PDF form

1 using (var fileIn = new FileStream("form.pdf", FileMode.Open, FileAccess.Read)) 2 { 3 // open PDF 4 Document document = new Document(fileIn); 5 6 // set the value of text field 7 TextField textField = document.Fields["Text1"] as TextField; 8 textField.Value = "Hello"; 9 10 // check check box 11 CheckBoxField checkBox = document.Fields["CheckBox2"] as CheckBoxField; 12 checkBox.CheckBoxValue = CheckState.On; 13 14 // select second radio button option 15 // (range checking omitted for the purpose of this code sample) 16 RadioButtonField radioButton = document.Fields["Radio Button4"] as RadioButtonField; 17 radioButton.RadioButtonValue = radioButton.Options[0]; //select first option 18 19 // select second item in list box 20 ListBoxField listBox = document.Fields["ListBox7"] as ListBoxField; 21 listBox.ListBoxValue = new ListOption[] { listBox.Options[1] }; // select second option 22 23 // set the value of a drop down 24 DropDownListField dropDown = document.Fields["ComboBox8"] as DropDownListField; 25 dropDown.DropDownListValue = dropDown.Options[1]; // select second option 26 27 // save PDF 28 using (var fileOut = new FileStream("filled.pdf", FileMode.Create, FileAccess.Write)) 29 { 30 document.Write(fileOut); 31 } 32 }