
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, all while maintaining the readability of the original content. 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 enables you to annotate documents with precision and flexibility, making it an ideal solution for marking text changes in PDFs and other formats.
Why Use Strikethrough in Documents?
It helps reviewers and editors to 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 content 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 of the document that should have 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 and applies it to a specified region on the first page of the PDF. The Points collection defines a rectangular area where the strikeout will appear. After applying the annotation, the document is saved with the visual edits included.
Conclusion
Strikethrough annotations are a practical and essential feature for reviewing and editing documents effectively. With Conholdate.Total for .NET, you can implement this functionality in your C# applications with ease and precision. Whether you’re developing a desktop application, a web-based platform, or a document workflow system, adding redline functionality using strikeout annotations helps enhance clarity, improve communication, and streamline revision processes. The SDK’s flexibility ensures that your documents remain editable, collaborative, and visually consistent across formats.