Strikethrough Text C#

Applying a strikethrough to text within a document is a common editing feature, often used in revision, proofreading, and collaborative editing. This method visually indicates which text is to be removed or replaced, while keeping the original content readable. In this post, we’ll walk through how to add a strikethrough effect using C# with the help of Conholdate.Total for .NET. This powerful SDK lets you annotate documents precisely and flexibly, making it ideal for marking changes in PDFs and other formats.

Why Use Strikethrough in Documents?

  • It helps reviewers and editors clearly communicate which parts of the content should be removed or revised.
  • Keeping the original text visible, even when marked for deletion, improves traceability during revisions.
  • Strikethrough annotations make version control and document tracking more manageable in team environments.
  • Legal, academic, and business documents often require visible edits for compliance, transparency, and accuracy.

Strikethrough Text in C# - SDK Installation

You need to install Conholdate.Total for .NET to strikethrough text in documents including PDF, DOC, DOCX, etc. Simply run the following NuGet installation command in MS Visual Studio:

Install-Package Conholdate.Total

Add Strikethrough Text using C#

The following C# code demonstrates how to add a strikeout annotation to a PDF document. This approach uses coordinate‑based positioning to specify the exact area that should receive the strikethrough effect.

 // Initialize the annotator with the input PDF file
 GroupDocs.Annotation.Annotator annotator = new GroupDocs.Annotation.Annotator("document.pdf");

 // Create a StrikeoutAnnotation object
 GroupDocs.Annotation.Models.AnnotationModels.StrikeoutAnnotation strikeout = new GroupDocs.Annotation.Models.AnnotationModels.StrikeoutAnnotation();

 // Set color and opacity
 strikeout.FontColor = 0xFF0000;
 strikeout.Opacity = 0.7;

 // Target page number (zero‑based index)
 strikeout.PageNumber = 0;

 // Define the rectangle where the strikethrough will be applied
 List<Point> points = new List<Point>();
 points.Add(new Point(180, 730));
 points.Add(new Point(300, 730));
 points.Add(new Point(180, 700));
 points.Add(new Point(300, 700));
 strikeout.Points = points;

 // Add the strikeout annotation to the document
 annotator.Add(strikeout);

 // Save the modified document
 annotator.Save("strikethrough-text.pdf");

This example configures the strikeout annotation with red color and partial transparency, then applies it to a rectangular area on the first page of the PDF. After adding the annotation, the document is saved with the visual edits included.

Conclusion

Strikethrough annotations are a practical feature for reviewing and editing documents effectively. With Conholdate.Total for .NET, you can add this functionality to your C# applications quickly and accurately. Whether you are building a desktop app, a web platform, or a document workflow system, strikeout annotations improve clarity, communication, and revision efficiency. The SDK’s flexibility keeps your documents editable, collaborative, and visually consistent across formats.

See Also