How to get the HTML export to respect the NoPrint user Macro?

I would like to find out if it would be possible to get the HTML export to respect the NoPrint user macro in Confluence? We are upgrading to 5.3. I would ideally like to get this to work with the HTML export, Word export, and the Scroll PDF export. But I will be satisfied with one at a time for now.

Let me know if anyone else has had any success. Thanks.

1 answer

1 accepted

1 vote
Accepted answer
Davin Studer Community Champion Oct 22, 2013

If you have modern browsers viewing the wiki you could use a css media declaration such as this.

@media print {
.noprint { display: none; }

Put this into your space or global stylesheet. Then in your user macro you just put a class of noprint on the outermost container. There is also a PDF stylesheet in space admin and confluence admin where you could put ...

.noprint { display: none; }

PDFs will then do the same thing and hide those blocks.

I have added your exact text to the global stylesheet as well as the Space stylesheet, and it doesn't look like it is taking effect anywhere. I am using the most recent version of Firefox, and i can't even find the @media section in the source of the page, and it is definitely not there if i export it to HTML. Am i missing something here? Let me know. Thanks.

Davin Studer Community Champion Oct 22, 2013

Ah yeah, that wouldn't work for html export. However the PDF one should work. To get it to work for html export (assuming you use the documentation theme) go to Glbal Layouts and edit the Page Export Layout. Add the below to the html head section

.noprint {display: none;}

Thanks, that does work, i was kinda hoping for a more permanent solution that would completely remove the content from the HTML source and everything.

We are trying to use Confluence as a tool to build our documentation for users, but still allow our employees to place notes and confidential information in no-print sections that will keep the content permanently out of any printed or exported material. I can use the CSS for now, but would like a slightly better solution.

Davin Studer Community Champion Oct 29, 2013

If you want something like that you will probably have to resort to an add-on to do it.

Hi All

We are facing issues in noprint macro for html. can you please tell us where we can put the CSS configuration forhtml no print


Didn't Davin already answer this above? (see "To get it to work for...")

Sorry, this did kinda get lost, and you are correct. The initial question as was stated was answered, but my more advanced question has no answer currently, I will accept this as the answer and create another answer to hopefully find a solution to completely removing the noprint text from even the source of the HTML after export.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Feb 06, 2019 in Confluence

Try out the new editing experience

Hi team, I’m Avinoam, a product manager on Confluence Cloud, and today I’m really excited to let the Community know that all customers can now try out the new editing experience and see some of the ...

1,016 views 51 8
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you