Suppress Resolved Comments in PDF Format

Hello, We can mark a comment as resolved, by using Comment.setDone(true). However, when saving the document as PDF, SaveFormat.PDF, is there a way to suppress the resolved comments so that they do not show up in the output PDF ?

@kml2020 There is no way to suppress resolved comments upon conversion document to PDF. However, you can simply remove them before conversion document to PDF. For example see the following code:

Document doc = new Document("C:\\Temp\\in.docx");

Iterable<Comment> comments = doc.getChildNodes(NodeType.COMMENT, true);
for (Comment c : comments)
{
    if (c.getDone())
        c.remove();
}

doc.save("C:\\Temp\\out.pdf");
1 Like

Thank you for a quick response, @alexey.noskov !
That is also the approach we had in mind, but wanted to confirm if there was a recommended way. :slight_smile:

1 Like