Atlassian Confluence User Macro (tested on CONF 6.9) to show page comments in print and exported PDF.
Issue: currently page comments are not shown in PDF Export in Atlassian Confluence.
The code of the user macro:
## Macro title: page-comments ## Macro has a body: N ## ## Developed by: Stefan Baader ## Date created: 24/11/2018 ## Installed by: Stefan Baader ## https://docs.atlassian.com/ConfluenceServer/javadoc/6.12.2/com/atlassian/confluence/pages/AbstractPage.html#getTopLevelComments-- ## https://docs.atlassian.com/ConfluenceServer/javadoc/6.12.2/com/atlassian/confluence/pages/Comment.html ## @noparams #set( $comments = $content.getTopLevelComments() ) #set( $commentsTotal = $content.getPageLevelComments().size() ) #set( $margin = 0 ) ########################################### ## define VelociMacro #macro( showComments $comments $margin ) #foreach( $comment in $comments ) <div style="margin:5px 5px 5px ${margin}px; border-top:1px solid #ccc; padding-left:10px; "> <p style="font-size:x-small; color:grey; ">$comment.getContentEntityObject().getCreator().getFullName()</p> <p>$comment.getContentEntityObject().getBodyContent().getBody()</p> <p style="font-size:x-small; color: grey"> #set($date = $comment.getContentEntityObject().getCreationDate() ) $action.formatFriendlyDate($date) </p> #set($margin = $margin + 10 ) ## macro calls itself repeated #set( $commentChilds = $comment.getChildren() ) #showComments ( $commentChilds ) </div> #end #end ########################################### <style> @media screen { #showCommentsInBody {display: none;} } </style> <div id="showCommentsInBody"> <h2>$commentsTotal Comments</h2> ## use the VelociMacro #showComments ( $comments ) </div>