XDoc.PDF
Features
Tech Specs
How-to C#
Pricing
How to Start Convert PDF Read PDF Build PDF Work with PDF Modules PDF Document PDF Pages Text Image Graph & Path Annotation, Markup & Drawing Redaction Security Digital Signature Forms Watermark Bookmark Link File Attachment File Metadata Printing Work with Other SDKs Barcode read Barcode create OCR Twain

C# PDF Text Edit Library
How to add, delete, update text box to existing pdf file using C# .net


C# Explanation to How to Add Text Box to PDF Page in C# Project with .NET PDF Library. ASP.NET Annotate PDF function is based on C# PDF Annotate SDK.










  • A best PDF annotator for Visual Studio .NET supports to add text box to PDF file in Visual C#.NET project
  • Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint
  • Provide .NET SDK library for adding text box to PDF document in .NET WinForms application
  • A web based PDF annotation application able to add text box comments to adobe PDF file online in ASP.NET
  • Support to use C# source code to add text box to specified PDF position in C#.NET framework
  • Able to create a fillable and editable text box to PDF document in C#.NET class
  • Support to change font color in PDF text box
  • Ability to change text size in PDF text box


Adding text box is another way to add text to PDF page. With RasterEdge XDoc.PDF annotation control, users can also perform this work on PDF page in their C# program.



Since RasterEdge XDoc.PDF SDK is based on .NET framework 2.0, users are enabled to use it in any type of a 32-bit or 64-bit .NET application, including ASP.NET web service and Windows Forms for any .NET Framework version from 2.0 to 4.5.







C# add text box annotation to pdf document


String inputFilePath = Program.RootPath + "\\" + "2.pdf";
String outputFilePath = Program.RootPath + "\\" + "Annot_9.pdf";

//  open a PDF file
PDFDocument doc = new PDFDocument(inputFilePath);
//  get the 1st page
PDFPage page = (PDFPage)doc.GetPage(0);

//  create the annotation
PDFAnnotTextBox annot = new PDFAnnotTextBox();

annot.Boundary = new RectangleF(100F, 100F, 400F, 300F);

//  add annotation to the page
PDFAnnotHandler.AddAnnotation(page, annot);

//  save to a new file
doc.Save(outputFilePath);




C# read text box annotation from pdf document


String inputFilePath = Program.RootPath + "\\" + "Annot_9.pdf";

PDFDocument doc = new PDFDocument(inputFilePath);
List<IPDFAnnot> annots = PDFAnnotHandler.GetAllAnnotations(doc);
foreach (IPDFAnnot annot in annots)
{
    if (annot is PDFAnnotTextBox)
    {
        PDFAnnotTextBox obj = (PDFAnnotTextBox)annot;
        Console.WriteLine("Textbox Boundary: " + obj.Boundary.ToString());
        Console.WriteLine("Textbox Border Color: " + obj.LineColor.ToString());
        Console.WriteLine("Textbox Border Width: " + obj.LineWidth);
        Console.WriteLine("Textbox Fill Color: " + obj.FillColor.ToString());
    }
}




C# delete all annotations from pdf document


String inputFilePath = Program.RootPath + "\\" + "1_Annots.pdf";

PDFDocument doc = new PDFDocument(inputFilePath);
//  get all annotations in the 1st page
PDFPage page = (PDFPage)doc.GetPage(0);
List<IPDFAnnot> annots = PDFAnnotHandler.GetAllAnnotations(page);
//  remove all annotations in the 1st page
PDFAnnotHandler.DeleteAnnotation(doc, annots);