PDF Mosaic: How to add text field to PDF document


Home       Features       Download       License       Tutorial       Version History       Source Code

 

This sample shows how to use text fields in your PDF document.

Use PDFEditBox class to add a text field.


 

using PDFMosaic;
using System;
 
namespace Buttons
{
    class TextFields
    {
        static void Main()
        {
            PDFDocument document = new PDFDocument();
            PDFPage page = new PDFPage(PDFPaperFormat.A4);
 
            PDFEditBox edit1 = new PDFEditBox(20, 40, 100, 25, "edit1");
            edit1.Text = "Simple text";
 
            PDFEditBox edit2 = new PDFEditBox(20, 70, 100, 25, "edit2");
            edit2.Text = "password";
            edit2.BorderStyle = PDFBorderStyle.Dashed;
            edit2.Password = true;
 
            PDFEditBox edit3 = new PDFEditBox(20, 100, 100, 50, "edit3");
            edit3.Multiline = true;
            edit3.Font.Size = 8;
            edit3.Text = "The quick brown fox jumps over, the lazy dog.";
 
            page.Annotations.Add(edit1);
            page.Annotations.Add(edit2);
            page.Annotations.Add(edit3);
 
            document.Pages.Add(page);
            document.Save("TextFields.pdf", true);
        }
    }
}

 


Home       Features       Download       License       Tutorial       Version History       Source Code