ByteScout Premium Suite - C# - Add annotation with markup in pdf with pdf sdk - ByteScout

ByteScout Premium Suite – C# – Add annotation with markup in pdf with pdf sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Premium Suite – C# – Add annotation with markup in pdf with pdf sdk

How to add annotation with markup in pdf with pdf sdk in C# and ByteScout Premium Suite

This code in C# shows how to add annotation with markup in pdf with pdf sdk with this how to tutorial

Every ByteScout tool includes simple example C# source codes that you can get here or in the folder with installed ByteScout product. ByteScout Premium Suite is the bundle that includes twelve SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording and you can use it to add annotation with markup in pdf with pdf sdk with C#.

These C# code samples for C# guide developers to speed up coding of the application when using ByteScout Premium Suite. IF you want to implement the functionality, just copy and paste this code for C# below into your code editor with your app, compile and run your application. Complete and detailed tutorials and documentation are available along with installed ByteScout Premium Suite if you’d like to learn more about the topic and the details of the API.

If you want to try other source code samples then the free trial version of ByteScout Premium Suite is available for download from our website. Just try other source code samples for C#.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
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); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next