LayoutOptions.CommentDisplayMode property

Gets or sets the way comments are rendered. Default value is ShowInBalloons.

public CommentDisplayMode CommentDisplayMode { get; set; }


Note that revisions are not rendered in balloons for ShowInAnnotations.


Shows how to show comments when saving a document to a rendered format.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.Write("Hello world!");

Comment comment = new Comment(doc, "John Doe", "J.D.", DateTime.Now);
comment.SetText("My comment.");

// ShowInAnnotations is only available in Pdf1.7 and Pdf1.5 formats.
// In other formats, it will work similarly to Hide.
doc.LayoutOptions.CommentDisplayMode = CommentDisplayMode.ShowInAnnotations;

doc.Save(ArtifactsDir + "Document.ShowCommentsInAnnotations.pdf");

// Note that it's required to rebuild the document page layout (via Document.UpdatePageLayout() method)
// after changing the Document.LayoutOptions values.
doc.LayoutOptions.CommentDisplayMode = CommentDisplayMode.ShowInBalloons;

doc.Save(ArtifactsDir + "Document.ShowCommentsInBalloons.pdf");

See Also