Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Created December 24, 2021 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GroupDocsGists/d248b7146303cf285b8b51f6af40549b to your computer and use it in GitHub Desktop.
Save GroupDocsGists/d248b7146303cf285b8b51f6af40549b to your computer and use it in GitHub Desktop.
Strikethrough Text in Documents using Java
/*
* Strikethrough Text in Word, PDF, Spreadsheets, Presentations using Java
*/
Annotator annotator = new Annotator("path/document.pdf");
StrikeoutAnnotation strikeout = new StrikeoutAnnotation();
strikeout.setFontColor(0xFF0000);
strikeout.setOpacity(0.7);
strikeout.setPageNumber(0);
// Add points for strikeout
List<Point> points = new ArrayList<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.setPoints(points);
annotator.add(strikeout);
annotator.save("path/strikethrough-text.pdf");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment