CommentDisplayMode

CommentDisplayMode enumeration

Specifies the rendering mode for document comments.

public enum CommentDisplayMode

Values

NameValueDescription
Hide0No document comments are rendered.
ShowInBalloons1Renders document comments in balloons in the margin. This is the default value.
ShowInAnnotations2Renders document comments in annotations. This is only available for Pdf format.

Examples

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.");
builder.CurrentParagraph.AppendChild(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.UpdatePageLayout();

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

See Also