PDFRasterizer.NET 4.0 is now available. Supports .NET Core. Renders pixel-perfectly.

Relevant products

Create formfields in PDF documents

This codesample shows how you can create different types of formfields in PDF.

This sample may seem long, but it uses a lot of different field types in a lot of ways. The key-message here is to create an instance of a formfield, assigning a widget to it and setting layout values of the widget.

Create Form Fields Pdf

//New document
Document document = new Document();

Page page = new Page(PageSize.A4);
document.Pages.Add(page);

//TextBox Field with all default values
{
    TextShape textShape = new TextShape( 250, page.Height - 50, "TextBox Field with all default values", Font.Helvetica, 12 );
    page.VisualOverlay.Add( textShape );

    TextField field = new TextField("FieldName1");
    Widget widget = new Widget(10, page.Height - 50, 200, 15);

    field.Widgets.Add(widget);
    page.Widgets.Add(widget);
    document.Fields.Add(field);
}

//TextBox Field with text (and Cmyk black)
{
    TextShape textShape = new TextShape( 250, page.Height - 75, "TextBox Field with text (and Cmyk black)", Font.Helvetica, 12 );
    page.VisualOverlay.Add( textShape );

    TextField field = new TextField("FieldName2");
    field.Value = "Hello World!";

    Widget widget = new Widget(10, page.Height - 75, 200, 15);
    widget.TextColor = TallComponents.PDF.Colors.CmykColor.Black;
                 
    field.Widgets.Add(widget);
    page.Widgets.Add(widget);
    document.Fields.Add(field);
}

//TextBox Field with multiline text
{
    TextShape textShape = new TextShape( 250, page.Height - 150, "TextBox Field with multiline text", Font.Helvetica, 12 );
    page.VisualOverlay.Add( textShape );

    TextField field = new TextField("FieldName3");
    field.Value = "Default text...\n...already included new-lines";
    field.ToolTip = "Tooltip for field 3";
    field.MappingName = "Mappingname3";

    field.MaxLength = 200;
    field.Multiline = true;
    field.RequiredMode = RequiredMode.Required;

    Widget widget = new Widget(10, page.Height - 150, 200, 65);
           
    widget.TextColor = System.Drawing.Color.Purple;
    widget.BorderStyle = BorderStyle.Dashed;
    widget.BorderColor = System.Drawing.Color.Red;
    widget.BackgroundColor = System.Drawing.Color.Yellow;

    widget.Font = TallComponents.PDF.Fonts.Font.TimesBoldItalic;
    widget.FontSize = 9;

    widget.HorizontalAlignment = HorizontalAlignment.Center;

    field.Widgets.Add(widget);
    page.Widgets.Add(widget);
    document.Fields.Add(field);
}

//DropDownList Field  -- no options but editable
{
    TextShape textShape = new TextShape( 250, page.Height - 200, "DropDownList Field -- no options but editable", Font.Helvetica, 12 );
    page.VisualOverlay.Add( textShape );

    DropDownListField field = new DropDownListField("FieldName4");
    field.AllowTextEntry = true;

    Widget widget = new Widget(10, page.Height - 200, 200, 15);
    widget.BorderColor = System.Drawing.Color.Black;

    field.Widgets.Add(widget);
    page.Widgets.Add(widget);
    document.Fields.Add(field);
}

//DropDownList Field -- with options
{
    TextShape textShape = new TextShape( 250, page.Height - 225, "DropDownList Field -- with options", Font.Helvetica, 12 );
    page.VisualOverlay.Add( textShape );

    DropDownListField field = new DropDownListField("FieldName5");
    field.Options.Add(new ListOption("opt1"));
    field.Options.Add(new ListOption("opt2"));
    field.Options.Add(new ListOption("opt3"));
    field.Value = "opt2";

    Widget widget = new Widget(10, page.Height - 225, 200, 15);
    widget.BorderColor = System.Drawing.Color.Black;
    widget.BorderStyle = BorderStyle.Inset;

    field.Widgets.Add(widget);
    page.Widgets.Add(widget);
    document.Fields.Add(field);
}

//ListBox Field -- with options
{
    TextShape textShape = new TextShape( 250, page.Height - 300, "ListBox Field -- with 6 options", Font.Helvetica, 12 );
    page.VisualOverlay.Add( textShape );

    ListBoxField field = new ListBoxField("FieldName6");
    field.Options.Add(new ListOption("1", "opt1"));
    field.Options.Add(new ListOption("2", "opt2"));
    field.Options.Add(new ListOption("3", "opt3"));
    field.Options.Add(new ListOption("4", "opt4"));
    field.Options.Add(new ListOption("5", "opt5"));
    field.Options.Add(new ListOption("6", "opt6"));
    field.ListBoxValue = new ListOption[1] { field.Options[1] };

    Widget widget = new Widget(10, page.Height - 300, 200, 50);
    widget.BorderColor = System.Drawing.Color.DarkBlue;

    field.Widgets.Add(widget);
    page.Widgets.Add(widget);
    document.Fields.Add(field);
}


//CheckBox Field -- unchecked
{
    TextShape textShape = new TextShape( 250, page.Height - 350, "CheckBox Field -- unchecked", Font.Helvetica, 12 );
    page.VisualOverlay.Add( textShape );

    CheckBoxField field = new CheckBoxField("FieldName7");

    CheckBoxWidget widget = new CheckBoxWidget(10, page.Height - 350, 15, 15);
    widget.BorderColor = System.Drawing.Color.Black;
    widget.BorderStyle = BorderStyle.Inset;

    field.Widgets.Add(widget);
    page.Widgets.Add(widget);
    document.Fields.Add(field);
}

//CheckBox Field -- checked, custom on-value
{
    TextShape textShape = new TextShape( 250, page.Height - 375, "CheckBox Field -- checked, custom on-value", Font.Helvetica, 12 );
    page.VisualOverlay.Add( textShape );

    CheckBoxField field = new CheckBoxField("FieldName8");
    field.CheckBoxValue = CheckState.On;
           
    CheckBoxWidget widget = new CheckBoxWidget(10, page.Height - 375, 15, 15);
    widget.CheckMarkAppearance = CheckMarkAppearance.Check;
    widget.TextColor = System.Drawing.Color.Purple;
    widget.BorderColor = System.Drawing.Color.Green;
    widget.BorderStyle = BorderStyle.Inset;

    field.Widgets.Add(widget);
    page.Widgets.Add(widget);
    document.Fields.Add(field);
}

//PushButton Field -- default
{
    TextShape textShape = new TextShape( 250, page.Height - 425, "PushButton Field -- default", Font.Helvetica, 12 );
    page.VisualOverlay.Add( textShape );

    PushButtonField field = new PushButtonField("FieldName9");

    PushButtonWidget widget = new PushButtonWidget(10, page.Height - 425, 100, 30);
    widget.BackgroundColor = System.Drawing.Color.LightGray;
    widget.BorderColor = System.Drawing.Color.Black;
    widget.BorderStyle = BorderStyle.Beveled;

    field.Widgets.Add(widget);
    page.Widgets.Add(widget);
    document.Fields.Add(field);
}

//PushButton Field -- with label
{
    TextShape textShape = new TextShape( 250, page.Height - 474, "PushButton Field -- with label", Font.Helvetica, 12 );
    page.VisualOverlay.Add( textShape );

    PushButtonField field = new PushButtonField("FieldName10");

    PushButtonWidget widget = new PushButtonWidget(10, page.Height - 475, 200, 30);
    widget.BackgroundColor = System.Drawing.Color.LightGray;
    widget.BorderColor = System.Drawing.Color.Gray;
    widget.BorderStyle = BorderStyle.Beveled;

    widget.Label = "Push me!";

    field.Widgets.Add(widget);
    page.Widgets.Add(widget);
    document.Fields.Add(field);

    //Show how a submit action must be included.
    TallComponents.PDF.Actions.SubmitFormAction action = new TallComponents.PDF.Actions.SubmitFormAction();
    action.SubmitFormat = TallComponents.PDF.Actions.SubmitFormat.Xfdf;
    action.Url = @"http://www.yourname.com/receiver.aspx";
    widget.MouseUpActions.Add(  action );
}

//PushButton Field -- with icon
{
    TextShape textShape = new TextShape( 250, page.Height - 545, "PushButton Field -- with icon", Font.Helvetica, 12 );
    page.VisualOverlay.Add( textShape );

    PushButtonField field = new PushButtonField("FieldName11");

    PushButtonWidget widget = new PushButtonWidget(10, page.Height - 545, 100, 50);
    widget.BackgroundColor = System.Drawing.Color.LightGray;
    widget.BorderColor = System.Drawing.Color.Gray;
    widget.BorderStyle = BorderStyle.Beveled;

    widget.Layout = PushButtonLayout.IconOnly;

    using (System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap( @"..\..\..\inputDocuments\logo_pdfkit.gif"))
    {
    widget.SetIcon(bitmap);
    }

    field.Widgets.Add(widget);
    page.Widgets.Add(widget);
    document.Fields.Add(field);
}

//RadioButtonField -- with 3 options
{
    TextShape textShape = new TextShape( 250, page.Height - 600, "RadioButtonField -- with 3 options", Font.Helvetica, 12 );
    page.VisualOverlay.Add( textShape );

    RadioButtonField field = new RadioButtonField( "FieldName12");

    RadioButtonWidget widget = new RadioButtonWidget(10, page.Height - 600, 15, 15, "Option1");
    widget.BorderColor = System.Drawing.Color.Black;
    field.Widgets.Add(widget);
    page.Widgets.Add(widget);

    widget = new RadioButtonWidget(35, page.Height - 600, 15, 15, "Option2");
    widget.BorderColor = System.Drawing.Color.Purple;
    widget.BackgroundColor = System.Drawing.Color.Yellow;
    widget.TextColor = System.Drawing.Color.Blue;
    field.Widgets.Add(widget);
    page.Widgets.Add(widget);

    widget = new RadioButtonWidget(60, page.Height - 600, 15, 15, "Option3");
    widget.BorderColor = System.Drawing.Color.Green;
    widget.BorderStyle = BorderStyle.Dashed;
    widget.TextColor = System.Drawing.Color.Red;
    field.Widgets.Add(widget);
    page.Widgets.Add(widget);

    field.RadioButtonValue = field.Options[1] as RadioButtonOption;
    field.RadioButtonDefaultValue = field.Options[2] as RadioButtonOption;
    document.Fields.Add(field);
}
       
//SignatureField -- unsigned
{
    TextShape textShape = new TextShape( 250, page.Height - 650, "SignatureField -- unsigned", Font.Helvetica, 12 );
    page.VisualOverlay.Add( textShape );

    SignatureField field = new SignatureField("FieldName13");

    SignatureWidget widget = new SignatureWidget(10, page.Height - 650, 150, 40);
    widget.BorderColor = System.Drawing.Color.Indigo;

    field.Widgets.Add(widget);
    page.Widgets.Add(widget);
    document.Fields.Add(field);
}

//SignatureField -- signed
{
    TextShape textShape = new TextShape( 250, page.Height - 700, "SignatureField -- signed", Font.Helvetica, 12 );
    page.VisualOverlay.Add( textShape );

    SignatureField field = new SignatureField("FieldName14");

    Pkcs12Store ks = null;
    using (FileStream file = new FileStream( @"..\..\..\inputdocuments\ChrisSharp.pfx", FileMode.Open, FileAccess.Read))
    {
    ks = new Pkcs12Store(file, "Sample");
    }

    SignatureHandler handler = StandardSignatureHandler.Create(ks);

    field.SignatureHandler = handler;

    field.ContactInfo = "+31(0)77 4748677";
    field.Location = "The Netherlands";
    field.Reason = "I fully agree!";

    SignatureWidget widget = new SignatureWidget(10, page.Height - 700, 150, 40);

    field.Widgets.Add(widget);
    page.Widgets.Add(widget);
    document.Fields.Add(field);
}

//PasswordField
{
    TextShape textShape = new TextShape( 250, page.Height - 725, "PasswordField", Font.Helvetica, 12 );
    page.VisualOverlay.Add( textShape );

    PasswordField field = new PasswordField("FieldName15");

    Widget widget = new Widget(10, page.Height - 725, 100, 15);
    widget.BorderColor = System.Drawing.Color.HotPink;

    field.Widgets.Add(widget);
    page.Widgets.Add(widget);
    document.Fields.Add(field);
}
       
// write the modified document to disk, note: signing requires read-write file access
using ( FileStream outFile = new FileStream( @"..\..\createformfields.pdf", FileMode.Create, FileAccess.ReadWrite ) )
{
    document.Write( outFile );
}
'New document
Dim document As New Document()

Dim page As New Page(PageSize.A4)
document.Pages.Add(page)

'TextBox Field with all default values
Dim textShape1 As New TextShape(250, page.Height - 50, "TextBox Field with all default values", Font.Helvetica, 12)
page.VisualOverlay.Add(textShape1)

Dim field1 As New TextField("FieldName1")
Dim widget1 As New Widget(10, page.Height - 50, 200, 15)

field1.Widgets.Add(widget1)
page.Widgets.Add(widget1)
document.Fields.Add(field1)

'TextBox Field with text (and Cmyk black)
Dim textShape2 As New TextShape(250, page.Height - 75, "TextBox Field with text (and Cmyk black)", Font.Helvetica, 12)
page.VisualOverlay.Add(textShape2)

Dim field2 As New TextField("FieldName2")
field2.Value = "Hello World!"

Dim widget2 As New Widget(10, page.Height - 75, 200, 15)
widget2.TextColor = TallComponents.PDF.Colors.CmykColor.Black

field2.Widgets.Add(widget2)
page.Widgets.Add(widget2)
document.Fields.Add(field2)

'TextBox Field with multiline text
Dim textShape3 As New TextShape(250, page.Height - 150, "TextBox Field with multiline text", Font.Helvetica, 12)
page.VisualOverlay.Add(textShape3)

Dim field3 As New TextField("FieldName3")
field3.Value = "Default text..." & Environment.NewLine & "...already included new-lines"
field3.ToolTip = "Tooltip for field 3"
field3.MappingName = "Mappingname3"

field3.MaxLength = 200
field3.Multiline = True
field3.RequiredMode = RequiredMode.Required

Dim widget3 As New Widget(10, page.Height - 150, 200, 65)

widget3.TextColor = System.Drawing.Color.Purple
widget3.BorderStyle = BorderStyle.Dashed
widget3.BorderColor = System.Drawing.Color.Red
widget3.BackgroundColor = System.Drawing.Color.Yellow

widget3.Font = TallComponents.PDF.Fonts.Font.TimesBoldItalic
widget3.FontSize = 9

widget3.HorizontalAlignment = HorizontalAlignment.Center

field3.Widgets.Add(widget3)
page.Widgets.Add(widget3)
document.Fields.Add(field3)

'DropDownList Field  -- no options but editable
Dim textShape4 As New TextShape(250, page.Height - 200, "DropDownList Field -- no options but editable", Font.Helvetica, 12)
page.VisualOverlay.Add(textShape4)

Dim field4 As New DropDownListField("FieldName4")
field4.AllowTextEntry = True

Dim widget4 As New Widget(10, page.Height - 200, 200, 15)
widget4.BorderColor = System.Drawing.Color.Black

field4.Widgets.Add(widget4)
page.Widgets.Add(widget4)
document.Fields.Add(field4)

'DropDownList Field -- with options
Dim textShape5 As New TextShape(250, page.Height - 225, "DropDownList Field -- with options", Font.Helvetica, 12)
page.VisualOverlay.Add(textShape5)

Dim field5 As New DropDownListField("FieldName5")
field5.Options.Add(New ListOption("opt1"))
field5.Options.Add(New ListOption("opt2"))
field5.Options.Add(New ListOption("opt3"))
field5.Value = "opt2"

Dim widget5 As New Widget(10, page.Height - 225, 200, 15)
widget5.BorderColor = System.Drawing.Color.Black
widget5.BorderStyle = BorderStyle.Inset

field5.Widgets.Add(widget5)
page.Widgets.Add(widget5)
document.Fields.Add(field5)

'ListBox Field -- with options
Dim textShape6 As New TextShape(250, page.Height - 300, "ListBox Field -- with 6 options", Font.Helvetica, 12)
page.VisualOverlay.Add(textShape6)

Dim field6 As New ListBoxField("FieldName6")
field6.Options.Add(New ListOption("1", "opt1"))
field6.Options.Add(New ListOption("2", "opt2"))
field6.Options.Add(New ListOption("3", "opt3"))
field6.Options.Add(New ListOption("4", "opt4"))
field6.Options.Add(New ListOption("5", "opt5"))
field6.Options.Add(New ListOption("6", "opt6"))
field6.ListBoxValue = New ListOption(0) {field6.Options(1)}

Dim widget6 As New Widget(10, page.Height - 300, 200, 50)
widget6.BorderColor = System.Drawing.Color.DarkBlue

field6.Widgets.Add(widget6)
page.Widgets.Add(widget6)
document.Fields.Add(field6)


'CheckBox Field -- unchecked
Dim textShape7 As New TextShape(250, page.Height - 350, "CheckBox Field -- unchecked", Font.Helvetica, 12)
page.VisualOverlay.Add(textShape7)

Dim field7 As New CheckBoxField("FieldName7")

Dim widget7 As New CheckBoxWidget(10, page.Height - 350, 15, 15)
widget7.BorderColor = System.Drawing.Color.Black
widget7.BorderStyle = BorderStyle.Inset

field7.Widgets.Add(widget7)
page.Widgets.Add(widget7)
document.Fields.Add(field7)

'CheckBox Field -- checked, custom on-value
Dim textShape8 As New TextShape(250, page.Height - 375, "CheckBox Field -- checked, custom on-value", Font.Helvetica, 12)
page.VisualOverlay.Add(textShape8)

Dim field8 As New CheckBoxField("FieldName8")
field8.CheckBoxValue = CheckState.[On]

Dim widget8 As New CheckBoxWidget(10, page.Height - 375, 15, 15)
widget8.CheckMarkAppearance = CheckMarkAppearance.Check
widget8.TextColor = System.Drawing.Color.Purple
widget8.BorderColor = System.Drawing.Color.Green
widget8.BorderStyle = BorderStyle.Inset

field8.Widgets.Add(widget8)
page.Widgets.Add(widget8)
document.Fields.Add(field8)

'PushButton Field -- default
Dim textShape9 As New TextShape(250, page.Height - 425, "PushButton Field -- default", Font.Helvetica, 12)
page.VisualOverlay.Add(textShape9)

Dim field9 As New PushButtonField("FieldName9")

Dim widget9 As New PushButtonWidget(10, page.Height - 425, 100, 30)
widget9.BackgroundColor = System.Drawing.Color.LightGray
widget9.BorderColor = System.Drawing.Color.Black
widget9.BorderStyle = BorderStyle.Beveled

field9.Widgets.Add(widget9)
page.Widgets.Add(widget9)
document.Fields.Add(field9)

'PushButton Field -- with label
Dim textShape10 As New TextShape(250, page.Height - 474, "PushButton Field -- with label", Font.Helvetica, 12)
page.VisualOverlay.Add(textShape10)

Dim field10 As New PushButtonField("FieldName10")

Dim widget10 As New PushButtonWidget(10, page.Height - 475, 200, 30)
widget10.BackgroundColor = System.Drawing.Color.LightGray
widget10.BorderColor = System.Drawing.Color.Gray
widget10.BorderStyle = BorderStyle.Beveled

widget10.Label = "Push me!"

field10.Widgets.Add(widget10)
page.Widgets.Add(widget10)
document.Fields.Add(field10)

'Show how a submit action must be included.
Dim action As New TallComponents.PDF.Actions.SubmitFormAction()
action.SubmitFormat = TallComponents.PDF.Actions.SubmitFormat.Xfdf
action.Url = "http://www.yourname.com/receiver.aspx"
widget10.MouseUpActions.Add(action)

'PushButton Field -- with icon
Dim textShape11 As New TextShape(250, page.Height - 545, "PushButton Field -- with icon", Font.Helvetica, 12)
page.VisualOverlay.Add(textShape11)

Dim field11 As New PushButtonField("FieldName11")

Dim widget11 As New PushButtonWidget(10, page.Height - 545, 100, 50)
widget11.BackgroundColor = System.Drawing.Color.LightGray
widget11.BorderColor = System.Drawing.Color.Gray
widget11.BorderStyle = BorderStyle.Beveled

widget11.Layout = PushButtonLayout.IconOnly

Using bitmap As New System.Drawing.Bitmap("..\..\..\inputDocuments\logo_pdfkit.gif")
    widget11.SetIcon(bitmap)
End Using

field11.Widgets.Add(widget11)
page.Widgets.Add(widget11)
document.Fields.Add(field11)

'RadioButtonField -- with 3 options
Dim textShape12 As New TextShape(250, page.Height - 600, "RadioButtonField -- with 3 options", Font.Helvetica, 12)
page.VisualOverlay.Add(textShape12)

Dim field12 As New RadioButtonField("FieldName12")

Dim widget12 As New RadioButtonWidget(10, page.Height - 600, 15, 15, "Option1")
widget12.BorderColor = System.Drawing.Color.Black
field12.Widgets.Add(widget12)
page.Widgets.Add(widget12)

widget12 = New RadioButtonWidget(35, page.Height - 600, 15, 15, "Option2")
widget12.BorderColor = System.Drawing.Color.Purple
widget12.BackgroundColor = System.Drawing.Color.Yellow
widget12.TextColor = System.Drawing.Color.Blue
field12.Widgets.Add(widget12)
page.Widgets.Add(widget12)

widget12 = New RadioButtonWidget(60, page.Height - 600, 15, 15, "Option3")
widget12.BorderColor = System.Drawing.Color.Green
widget12.BorderStyle = BorderStyle.Dashed
widget12.TextColor = System.Drawing.Color.Red
field12.Widgets.Add(widget12)
page.Widgets.Add(widget12)

field12.RadioButtonValue = TryCast(field12.Options(1), RadioButtonOption)
field12.RadioButtonDefaultValue = TryCast(field12.Options(2), RadioButtonOption)
document.Fields.Add(field12)

'SignatureField -- unsigned
Dim textShape13 As New TextShape(250, page.Height - 650, "SignatureField -- unsigned", Font.Helvetica, 12)
page.VisualOverlay.Add(textShape13)

Dim field13 As New SignatureField("FieldName13")

Dim widget13 As New SignatureWidget(10, page.Height - 650, 150, 40)
widget13.BorderColor = System.Drawing.Color.Indigo

field13.Widgets.Add(widget13)
page.Widgets.Add(widget13)
document.Fields.Add(field13)

'SignatureField -- signed
Dim textShape14 As New TextShape(250, page.Height - 700, "SignatureField -- signed", Font.Helvetica, 12)
page.VisualOverlay.Add(textShape14)

Dim field14 As New SignatureField("FieldName14")

Dim ks As Pkcs12Store = Nothing
Using file As New FileStream("..\..\..\inputdocuments\ChrisSharp.pfx", FileMode.Open, FileAccess.Read)
    ks = New Pkcs12Store(file, "Sample")
End Using

Dim handler As SignatureHandler = StandardSignatureHandler.Create(ks)

field14.SignatureHandler = handler

field14.ContactInfo = "+31(0)77 4748677"
field14.Location = "The Netherlands"
field14.Reason = "I fully agree!"

Dim widget14 As New SignatureWidget(10, page.Height - 700, 150, 40)

field14.Widgets.Add(widget14)
page.Widgets.Add(widget14)
document.Fields.Add(field14)

'PasswordField
Dim textShape15 As New TextShape(250, page.Height - 725, "PasswordField", Font.Helvetica, 12)
page.VisualOverlay.Add(textShape15)

Dim field15 As New PasswordField("FieldName15")

Dim widget15 As New Widget(10, page.Height - 725, 100, 15)
widget15.BorderColor = System.Drawing.Color.HotPink

field15.Widgets.Add(widget15)
page.Widgets.Add(widget15)
document.Fields.Add(field15)

' write the modified document to disk, note: signing requires read-write file access
Using outFile As New FileStream("..\..\createformfields.pdf", FileMode.Create, FileAccess.ReadWrite)
    document.Write(outFile)
End Using

No results

Render PDF to multipage color TIFF
Render PDF page to Skia surface
Render PDF page as PNG
How to downscale all images in a PDF
This code sample shows how to downscale images in a PDF file. Read this Tall Components code sample or search our code sample base.
How to generate and export certificates
In this Tall Components code sample we will show you how you can create an RSA 2048-bit PEM certificate and how you can export it.
How to downscale all images in a PDF
This code sample shows how to downscale images in a PDF file. Read this Tall Components code sample or search our code sample base.
Add Stamp to PDF
This code sample shows how to stamp a PDF in C#. You can stamp images and watermarks to your PDF for example.
How to use a system font for rendering text
This code sample shows how you can render text using a system font. Read this Tall Components code sample or search our code sample base.
Customize the GUI interaction of a radio button
This sample shows how one can create a custom radio button interactor that responds to other key strokes than just the space bar.
Customize the UI interaction of a check box
This sample shows how one can create a custom check box interactor that responds to other key strokes than just the space bar.
PDF to grayscale TIFF
In the .NET framework the support for grayscale bitmaps is a bit puzzling. There is a way to convert PDF to grayscale Tiff in C#.
How to reduce PDF file size
Adobe Acrobat has an option to save a document with a reduced size. This article shows how to reduce pdf file size with PDFKit.NET.
How do I create graphics with Icc based colors
This article explains how one creates graphics that use Icc based colors. Read this code sample or search our code sample base.
Highlight fields in PDF
This code sample shows how to mark all fields in a PDF document. Read this Tall Components code sample or search our code sample base.
Add a note to PDF
This code sample shows how to add a note to a PDF document. Read this Tall Components code sample or search our code sample base.
Display PDF in a WPF app and stay responsive – the code
This article helps how to stay responsive while rendering a a PDF document in a WPF application. Read this or search our code sample base.
Draw interactively on a PDF page
This article allows users to interactively draw lines on PDF pages and save the resulting document. Read this or search our code sample base.
Resize PDF pages
This sample demonstrates how to change the size of pages in the PDF file. Read this code sample or search our code sample base.
Verify a custom digital PDF signature
In the article we explain how to verify a custom digital PDF signature. Read this Tall Components code sample or search our code sample base.
C# Print PDF documents from a WPF application
This code sample shows how to print PDF documents from a WPF application using C#. Read this code sample or search our code sample base.
Extract glyph boxes from PDF
This sample creates a bitmap for each page and draws boxes for each glyph. Read this code sample or search our code sample base.
Use TrueType font collections
This article describes how to select a font from a font collection and how this is embedded in a PDF document. Read or search our base.
Layout text with MultilineTextShape
This sample demonstrates how to format and layout text with MultilineTextShape. Read this code sample or search our code sample base.
Calculate the height of a paragraph in PDF
This code sample demonstrates how to use the event mechanism to calculate the height of a paragraph in a PDF.
Merge PDF files in C# .NET
In the following code sample you can see how you can easily merge PDF files into one. Read this code sample or search our code sample base.
How do I extract page destinations from bookmarks?
This article explains how one can determine which page a particular bookmark refers to. Read this code sample or search our code sample base.
Clip PDF page content in C#
This sample demonstrates how to mask out a rectangular area on a PDF page using a clip shape in C#. Read this or search our code sample base.
How do I use PDFControls.NET in a WPF application
This code sample shows you how PDFControls.NET can be used in a WPF application. Read this code sample or search our code sample base.
Fill PDF form
This code sample shows how to assign values to various types of PDF form fields. Read this code sample or search our code sample base.
Extract glyphs and sort by reading order
This code sample shows how to extract glyphs from PDF and sort. Read this Tall Components code sample or search our code sample base.
Add bookmarks to PDF
This code sample shows how to create bookmarks in an existing PDF document. Read this code sample or search our code sample base.
How to scale content of PDF
This code sample creates a copy of a PDF document but the content in the output PDF is scaled. Read this or search our code sample base.
Create rectangles with rounded corners
A Rectangle with rounded corners is not a standard shape. However it is easy to create these. Read this or search our code sample base.
Create text with decorations
Create a document with text with decorations like gradient color, shadow, emboss and glow. Read this or search our code sample base.
Create layers in PDF and draw on each layer
This code sample shows how to create a document and adds two new layers. Read this code sample or search our code sample base.
Multipage TIFF to PDF
This article shows you how to convert a multipage TIFF to PDF using TallPDF.NET. Read this code sample or search our code sample base.
TIFF to PDF C#
This article shows you how to convert a multipage TIFF to PDF using PDFKit.NET. Read this code sample or search our code sample base.
Crop content on a PDF page
This code sample shows how to remove all content that is outside a crop rectangle. Read this code sample or search our code sample base.
How to embed files in a PDF document
This code sample shows how to add embedded files (attachments) to a PDF document. Read this code sample or search our code sample base.
Remove graphics from PDF
This code sample shows how to partly erase images from a PDF under an explicitly specified rectangle. Read or search our code sample base.
Change the color inside a PDF
This code sample shows how to change color in a PDF using C# and VB.NET. Read this code sample or search our code sample base.
Create PDF in C#
This simple code sample shows you how to create a PDF using C# and print "Hello World" to it. Read or search our code sample base.
Text formatting
This code sample shows how to format your text. Read this Tall Components code sample or search our code sample base.
Import FDF into PDF
In this code sample we will show how you can easily import an FDF file and populate the form fields in a PDF.
Flatten PDF form
This code sample shows how to fill out a form and then flatten it. Read this code sample or search our code sample base.
Digitally sign a PDF form in C# or VB.NET
This code sample shows you how you can import a digital signature and use it to sign a PDF document in C# or VB.NET.
Vector graphics in PDF
This code sample shows how to draw different vector graphics such as line, ellipses and bezier curves. Read code sample or search our base.
Translate PDF page content
This code sample shows how to apply a single translation to all the content on a PDF page. Read or search our code sample base.
Extract graphics from PDF
This c# code sample shows how to extract text, images and curves as shapes from a PDF document. Read or search our code sample base.
Determine the content bounding box
This article shows how to determine the content bounding of a page. Read this Tall Components code sample or search our code sample base.
How to add page numbers to your PDF
This article shows how to add page numbers to PDF using TallPDF built-in features. Read or search our code sample base.
Create / impose PDF 2-up
This code sample shows how to do 2-up imposition using the PageShape class. Read this code sample or search our code sample base.
Search text in PDF
This article shows how to search a PDF for text in C# using the Document. Read this code sample or search our code sample base.
Append multiple PDF documents
This code sample illustrates to loop through a given folder and append each PDF documents found into a new generated PDF document.
Convert PDF to plain text
The following code sample shows how to convert the collection of glyphs on a PDF page to a text string. Read or search our code sample base.
Flatten Markup Annotation
This article illustrate how to turn markups to images by flatten markups. Read this code sample or search our code sample base.
Add text field to PDF
This code sample illustrates how you can add TextFields to your PDF. Read this Tall Components code sample or search our code sample base.
Extract embedded files from PDF
This code sample illustrates how to loop through embedded files in an existing PDF document and extract those attachments. Read more.
Extract images from PDF
This code sample illustrates how to iterate through existing content in a PDF document and save each images found as a new Image file.
Add a Diagonal Watermark to PDF in C#
This code sample shows how to add a diagonal watermark to an existing PDF in C#. Read this code sample or search our code sample base.
Fit image to PDF page
This code sample shows how to stamp an image on a PDF page and have the image fit to the size of the page. Read this code sample.
Add simple html text to PDF
The SimpleXhtmlShape lets you add text with simple HTML mark-up to a PDF document. Read or search our code sample base.
Add multiline text to a PDF document
The MultilineTextShape lets you add multiline text to PDF with mixed formatting and line-breaking. Read this code sample or search our code sample base.
Add single-line text to PDF
TextShape allows you to add single-line text to a PDF document. Read this Tall Components code sample or search our code sample base.
Create a new digitally signed PDF document
This code sample creates a new PDF document, adds a signature fields, and then digitally signs it. Read or search our code sample base.
PDF Viewer Preferences
The following code sample shows how to set the viewer preferences of a PDF document. Read or search our code sample base.
Change page orientation PDF
Code sample to change the page orientation PDF. Read this Tall Components code sample or search our code sample base.
Split PDF pages in C# and VB.NET
The following code sample shows how to split PDF pages in C# and VB.NET. Read this code sample or search our code sample base.
Append two or more existing PDF files
The following code sample shows how to append PDF files. Read this Tall Components code sample or search our code sample base.
Change colors of black-and-white TIFF after converting from PDF
In this article, we will demonstrate how to change the color palette after converting a PDF document to 1bpp TIFF in C#.
Determine if a PDF only contains images
The following sample code determines whether a PDF document only contains images (and not other shapes such as text fragments).
Add footer to PDF
This code sample shows how to add a footer in a PDF document. Read this Tall Components code sample or search our code sample base.
Convert SVG to PDF
This article explains how to use these text and fonts in SVG documents. Read this code sample or search our code sample base.
Fill in a PDF form using MVC
In this sample we will create a small ASP.NET application to fill in pdf forms, using a webform. Read or search our code sample base.
C# render pdf in browser using MVC
In this code sample we will be using the PDF Rasterizer package in a MVC context to render specific PDF pages in a browser.
Convert XHTML to PDF
This code sample shows how to add a note to a PDF document C#. Read this code sample or search our code sample base.
Add hyperlink to PDF
This code samples draws a hyperlink on an existing PDF page. Read this code sample or search our code sample base.
Rotate a PDF page
This code sample creates a copy of a PDF document with each page rotated 90 degrees. Read or search our code sample base.
Change the formatting of a numeric field
This code sample changes the format by changing the JavaScript of the action. Read or search our code sample base.
How to mirror PDF pages and other shapes
In this code sample we will mirror the pages in an existing PDF document. Read this code sample or search our code sample base.
Fill in a template PDF document
This code sample shows you how you can import a template document and fill it in with data from a database.
How to add autosized text to PDF
This code sample shows you how you can add a piece of auto-sized text to your PDF document. Read or search our code sample base.
Create formfields in PDF documents
This codesample shows how you can create different types of formfields in PDF. Read this code sample or search our code sample base.
Export FDF from PDF form
This code sample helps to exports FDF from PDF. Read this Tall Components code sample or search our code sample base.
Add a link with an internal destination to PDF
This code sample helps with internal links in a PDF. Read this Tall Components code sample or search our code sample base.
Remove PDF security settings
This code sample shows how you can remove the security setting of a PDF quite easily; just set the security attribute to null.
Add a link to PDF with an external destination
This code sample helps adding an external link to your PDF. Read this code sample or search our code sample base.
How to sign and verify updates to a PDF document
This code sample shows how you can sign PDF documents and how to handle updates to form data. Read or search our code sample base.
Convert PDF to PNG using WPF
In this code sample we take a look how you can create PNG images from a PDF using the Windows Presentation Foundation.
Embed TrueType font
This code sample shows how to draw text on a page using a TrueType font and embed this font in the PDF. Read or search our code sample base.
Override MouseWheel event
This code sample helps to override MouseWheel event. Read this Tall Components code sample or search our code sample base.
Convert PDF to an image using a dither matrix
This code sample shows how to convert a PDF page to a bitmap image, while applying a dither matrix to the generated image.
Font mapping
If you have a PDF document which uses non-embedded fonts, you can specify your font substitution map to specify which fonts need to be used.
Convert PDF with layers to image
In the code sample below you see how you can incorporate multiple layers into your rendering process. Read or search our code sample base.
C# Print PDF Document
C# Print PDF? With this sample you can get an impression of how to print a PDF in C#. Read this code sample or search our code sample base!
Render PDF with ResolveFont event handler
When you try to render a PDF which uses non-system fonts, you can add your own specified fonts to make sure it is rendered correctly.
Render PDF to EMF
This code sample helps render PDF to EMF. Read this Tall Components code sample or search our code sample base.
Convert PDF to XPS
In this sample you can see how you convert your PDF document to an XPS format (which is Microsoft Windows' version of PDF).
How to create a thumbnail viewer
This sample shows how you can create a thumbnail viewer for your PDF application and it builds on the SimpleViewer code sample.
How to create a tiling for shapes in PDF
In this code sample we will show you how you can create a rectangle and fill it using a TilingBrush containing dots.
Add footer with left and right aligned text on same line
Add a footer to a PDF document that has left aligned text with a page number and right aligned text on the same line.
Convert PDF to JPG in C#
This code sample shows how to convert PDF to JPG or JPEG in C#. Read this Tall Components code sample or search our code sample base.
EMF to PDF as vector image
EMF is the Windows Meta file file format for images. Read this Tall Components code sample or search our code sample base.
EMF to PDF as raster image
This code sample helps to create a Bitmap (PDF) from an EMF file in C#. Read this Tall Components code sample or search our code sample base.
Replace field with image
This code sample opens a PDF with a textfield and replaces this textfield with an image. Read or search our code sample base.
Add a rubber stamp annotation with a custom icon
This article shows how to create a customized rubber stamp annotation. Read this code sample or search our code sample base.
Create a text annotation in PDF with rich text
This sample shows how to create annotations in PDF that use a rich text for their appearance. Read or search our code sample base.
XhtmlParagraph and TrueType fonts
The following code converts XHTML to PDF using the XhtmlParagraph. Read this code sample or search our code sample base.
What is the resulting fontsize in PDF for rich text used in a SimpleXhtmlShape
TallPDF supports the SimpleXhtmlShape. This shape accepts PDF rich text as its Text attribute. Read or search our code sample base.
Read and write meta data from PDF
This article shows a sample for reading and writing meta data from PDF using C#. Read this code sample or search our code sample base.
Create a custom signature handler to sign and verify PDF documents
This code sample shows how to create your own signature handler. Read this code sample or search our code sample base.
Merge PDF
In this code sample we will create a new PDF by stitching two existing PDF documents. Read or search our code sample base.
Stitch PDF documents
This code sample shows how to stich PDF pages from an existing PDF document to a newly generated PDF using TallPDF.NET.
Download and convert image to PDF
This article shows how to download an image on a web page as a PDF document. Read this code sample or search our code sample base.
Convert TXT to PDF
This code sample helpt converting TXT to PDF. Read this Tall Components code sample or search our code sample base.
Add barcodes to PDF
This article demonstrates how to add barcodes to a PDF document. Read this code sample or search our code sample base.
Convert PDF to multipage TIFF in C# .NET
This article shows how to convert PDF to multipage TIFF in C# using PDFRasterizer.NET 3.0. Read or search our code sample base.
Convert multiple PDF pages to bitmap
In this article, we will convert multple pages of a PDF to a single bitmap. Read this code sample or search our code sample base.
Render a PDF to bitmap
This article explains the most basic way to convert PDF to bitmap. Read this code sample or search our code sample base.
Bulleted list from XML and XSL
This code sample helps getting a bulleted list from XML and XSL. Read this code sample or search our code sample base.
Tagged PDF
This code sample helps create and consume tagged PDF documents. Read this code sample or search our code sample base.
PDFKit.NET 5.0 – detailed changes to the API
This article compares the builds that 4.0 and 5.0 have in common: net20, net40, net40-client and net40-wpf.
Create tagged PDF
This code sample demonstrate how to create a new tagged PDF. Read this Tall Components code sample or search our code sample base.
PDFKit.NET 5.0 and .NET Core
PDFKit.NET 5.0 includes a build targeting .NET Standard 1.5. According to the following table, it supports .NET Core 1.0 and higher.
PDFKit.NET 5.0 and Xamarin
This code samples helps with PDFKit.NET 5.0 and Xamarin. Read this Tall Components code sample or search our code sample base.
Dynamic XFA
The new dynamic XFA API of PDFKit.NET 5.0 allows populating and consuming dynamic XFA documents. Read or search our code sample base.
PDFKit.NET 5.0 .NET Standard API
This code sample helps with PDFKit.NET 5.0 .NET Standard API. Read this Tall Components code sample or search our code sample base.
.NET Core console app on MacOS
In this article we create step by step a simple .NET Core console application on MacOS. Read or search our code sample base.
Add tags to existing PDF
This article demonstrates how to open existing PDF document, read visual content and tag the visual content based on its type and content.
Read PDF tags
This code sample enumerates the tags in an existing PDF document. Read this code sample or search our code sample base.
Merge XDP data with dynamic XFA form
The following code imports XDP data into a dynamic XFA form. Read this Tall Components code sample or search our code sample base.
Fill XFA form and export XDP data
The following code opens an XFA form and programmatically fills text field and selects items from drop-down lists and exports data as XDP.
Fill and save dynamic XFA form
The following code opens a XFA form and programmatically fills text fields, selects an item from a drop-down list and 'clicks' a button.
Use PDFKit.NET 5.0 with a Xamarin.Forms app
This article demonstrates a simple Xamrin.Forms app that runs on Android, iOS and UWP. Read or search our code sample base.
Use multiple licenses
This code sample explains how to register multiple license keys with a single application. Read or search our code sample base.
Licensing and .NET Standard
This code sample helps with licensing and .NET Standard. Read this Tall Components code sample or search our code sample base.
Reduce PDF size
PDFKit5 includes support for non-desctructive PDF compresssion. Read this code sample or search our code sample base.
Generate PDF form from XML
The following code sample shows how to generate a PDF form from XML. Read this code sample or search our code sample base.
Generate PDF with local images from XML with Xamarin.iOS
This code sample generates a PDF from XML with an image that is included as resource. Read or search our code sample base.
Disable submit button after submitting
The following code adds a JavaScript action to a submit button that will disable the button after submitting.
Write Document to HttpResponse
In PDFKit.NET 5.0 we decided to remove the Document.Write(HttpResponse) because it required the client to add a reference to System.