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

Adam Barylak
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 22, 2013

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
Answer accepted
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 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.

Adam Barylak
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 22, 2013

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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 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

<style>
.noprint {display: none;}
</style>

Adam Barylak
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 29, 2013

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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 29, 2013

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

l August 20, 2014

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

Steffen Heller
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 20, 2014

@lynn_jira:

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

Adam Barylak
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 20, 2014

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
TAGS
AUG Leaders

Atlassian Community Events