Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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