ByteScout tutorials are designed to explain the code for both C# beginners and advanced programmers. ByteScout PDF SDK is the component to help programmers in generating new pdf files, modifying and updating existing pdf documents or pdf forms. Provides support for auto-filling pdf forms, adding text with adjustable font, style, size, font family, new form fields, vector and raster drawings. It can be used to add annotation with markup in PDF using C#.
This rich sample source code in C# for ByteScout PDF SDK includes the number of functions and options you should do calling the API to add annotation with markup in PDF. Just copy and paste the code into your C# application’s code and follow the instruction. Enjoy writing a code with ready-to-use sample codes in C#.
Our website provides trial version of ByteScout PDF SDK for free. It also includes documentation and source code samples.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
using System.Diagnostics; using System.Drawing; using Bytescout.PDF; namespace MarkupAnnotation { /// <summary> /// This example demonstrates how to add markup annotations. /// </summary> class Program { static void Main() { // Create new document Document pdfDocument = new Document(); pdfDocument.RegistrationName = "demo"; pdfDocument.RegistrationKey = "demo"; // Add page Page page = new Page(PaperFormat.A4); pdfDocument.Pages.Add(page); // Draw sample markup annotations SquareAnnotation squareAnnotation = new SquareAnnotation(20, 20, 80, 80); squareAnnotation.BackgroundColor = new ColorRGB(255, 240, 240); squareAnnotation.BorderStyle.Style = BorderStyle.Dashed; squareAnnotation.BorderStyle.DashPattern = new DashPattern(new float[] { 3, 1, 3}); page.Annotations.Add(squareAnnotation); CircleAnnotation circleAnnotation = new CircleAnnotation(120, 20, 80, 80); circleAnnotation.BackgroundColor = new ColorRGB(240, 250, 240); circleAnnotation.Color = new ColorRGB(128, 0 ,128); circleAnnotation.BorderEffect.Effect = BorderEffect.Cloudy; circleAnnotation.BorderEffect.Intensity = 2; page.Annotations.Add(circleAnnotation); LineAnnotation lineAnnotation = new LineAnnotation(20, 180, 100, 120); lineAnnotation.Color = new ColorRGB(255, 0, 0); lineAnnotation.StartLineStyle = LineEndingStyle.Butt; lineAnnotation.EndLineStyle = LineEndingStyle.OpenArrow; page.Annotations.Add(lineAnnotation); PointF[] pp = { new PointF(120, 120), new PointF(130, 130), new PointF(140, 120), new PointF(150, 130), new PointF(160, 120), new PointF(170, 130) }; PointsArray points = new PointsArray(pp); PolylineAnnotation polylineAnnotation = new PolylineAnnotation(points); polylineAnnotation.BorderStyle.Width = 2; page.Annotations.Add(polylineAnnotation); // Save document to file pdfDocument.Save("result.pdf"); // Cleanup pdfDocument.Dispose(); // Open result document in default associated application (for demo purpose) ProcessStartInfo processStartInfo = new ProcessStartInfo("result.pdf"); processStartInfo.UseShellExecute = true; Process.Start(processStartInfo); } } }
60 Day Free Trial or Visit ByteScout PDF SDK Home Page
Explore ByteScout PDF SDK Documentation
Explore Samples
Sign Up for ByteScout PDF SDK Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout PDF SDK Home Page
Explore ByteScout PDF SDK Documentation
Explore Samples
Sign Up for ByteScout PDF SDK Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: