XDoc.PDF
Features
Tech Specs
How-to C#
How-to VB.NET
Pricing
C# PDF: How to PDF Create PDF Export File and Page Process PDF Read PDF Write Form Process Document Protect Annotation & Drawing PDF Print WPF Viewer & Editor Work with Other SDKs Barcode Read Barcode Create OCR Twain
Annotation & Drawing
  |  
Home ›› XDoc.PDF ›› C# PDF: Annotation & Drawing

C#.NET PDF SDK - PDF Annotation in C#.NET


Excellent C# Solutions to Draw, Add and Edit Various Annotations on PDF File in C# Class Using .NET DLLs




A best and highly-rated PDF document processing SDK library for PDF annotating in C#.NET WinForms and ASP.NET web application


A powerful PDF annotator control enables C# developers to annotate PDF document in various annotation types in Visual Studio .NET


C# source code for adding or removing annotation from PDF file in .NET framework


Support to add flatten comments to PDF document online in ASPX webpage


Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint


Support to take notes on adobe PDF file without adobe reader installed


Support to add text, text box, text field and crop marks to PDF document


Able to edit and change PDF annotation properties such as font size or color


Abilities to draw markups on PDF document or stamp on PDF file


Users are able to delete annotation from PDF document in C#.NET class


The combination of RasterEdge's PDF document processing control and its annotating library enables C# developers and end-users to integrate robust PDF document annotation capabilities to any type of a 32-bit or 64-bit .NET application for .NET Framework 2.0 and above.




Perform Various annotations on PDF Page using C#.NET Demo Codes



C#.NET: Add Sticky Note on PDF Page


Tell users how to add sticky note annotations on PDF document, detailed references and demo code are given for quick integration in C#.NET application.


C#.NET: Highlight Text on PDF File


Provide C# class demo code to help users highlight selected text on PDF page in Visual C# .NET application.


C#.NET: Add Text to PDF Document


This page will guide C# users how to add text comments on PDF page using C# demo code in Visual Stuodio .NET class.


C#.NET: Add Text Box to PDF Document


Provide users with examples for adding text box to PDF and edit font size and color in text box field in C#.NET program.


C#.NET: Draw Markups on PDF File


Enable users to draw various annotation markups on PDF page. C# class demo code and .NET dll files are give to achieve these features.






C# Project Libraries: PDF Annotation in C#.NET



In order to run the sample code, the following steps would be necessary.


Add necessary references:


  RasterEdge.Imaging.Basic.dll


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XImage.Raster.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XDoc.PDF.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.PDF;


Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:

       

       If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.

       

       If using x86, the platform target should be x86.




C#.NET Demo Code: Retrieve All Annotations Information from PDF Document



Learn how to retrieve all annotations from PDF file in C# project.




// Get PDF document.
String fileInpath = @"";
PDFDocument doc = new PDFDocument(fileInpath);

// Get all annotations.
List<IPDFAnnot> allAnnotation = PDFAnnotHandler.GetAllAnnotations(doc);





C#.NET Demo Code: Retrieve All Annotations Information from PDF Page



Learn how to retrieve all annotations from PDF page in C# project.




// Get PDF document.
String fileInpath = @"";
PDFDocument doc = new PDFDocument(fileInpath);

// Get PDF page.
PDFPage page = (PDFPage)doc.GetPage(0);

// Get all annotations of PDF page.
List<IPDFAnnot> allAnnotation = PDFAnnotHandler.GetAllAnnotations(page);





C#.NET Demo Code: Add an Annotation to a PDF Page



Use the C# code below to add an annotation to a PDF page in C# project.




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

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

{
    //  create the annotation
    PDFAnnotLine annot = new PDFAnnotLine();

    annot.Start = new PointF(100F, 100F);
    annot.End = new PointF(200F, 200F);

    //  add annotation to the page
    PDFAnnotHandler.AddAnnotation(page, annot);
}
{
    //  create the annotation
    PDFAnnotArrow annot = new PDFAnnotArrow();

    annot.Start = new PointF(300F, 100F);
    annot.End = new PointF(400F, 150F);

    //  add annotation to the page
    PDFAnnotHandler.AddAnnotation(page, annot);
}
{
    //  create the annotation
    PDFAnnotEllipse annot = new PDFAnnotEllipse();

    annot.Location = new PointF(300, 300);
    annot.Width = 50F;
    annot.Height = 50F;

    //  add annotation to the page
    PDFAnnotHandler.AddAnnotation(page, annot);
}
{
    //  create the annotation
    PDFAnnotRectangle annot = new PDFAnnotRectangle();

    annot.Location = new PointF(400, 400);
    annot.Width = 50F;
    annot.Height = 50F;

    //  add annotation to the page
    PDFAnnotHandler.AddAnnotation(page, annot);
}
{
    //  create the annotation
    PDFAnnotPolygon annot = new PDFAnnotPolygon();

    annot.Points = new PointF[5] {
        new PointF(50F, 450F),
        new PointF(100F, 450F),
        new PointF(120F, 480F),
        new PointF(100F, 500F),
        new PointF(50F, 500F)
    };

    //  add annotation to the page
    PDFAnnotHandler.AddAnnotation(page, annot);
}
{
    //  create the annotation
    PDFAnnotPolyline annot = new PDFAnnotPolyline();

    annot.Points = new PointF[] {
        new PointF(250F, 450F),
        new PointF(300F, 450F),
        new PointF(320F, 480F),
        new PointF(300F, 500F),
        new PointF(250F, 500F)
    };

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

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