Add CSS (page-break-after) to horizontal line
Asked by Danny Brandt:

Hello,

i am trying to add "page-break-after" to the horizontal lines on a page to manipulate the way it is printed.

Due to our Company policies i sadly can't install Plug-Ins or edit the source code.

Anyways: I do have the ability to add a CSS-Stylesheet to the site and i can **succesfully** add

table {

page-break-after: always;

}

I couldn't find a way though to use that on horizontal lines, which would be the perfect solution for my problem. Using it on "table" doesn't create the desired effect, because i am using too many tables on that site.

Is it because the horizontal line (hr) is just missing an ID that i can refer to or am i missing the correct allocation?

Edit: I've just found out, that i can use

hr {  
border-width: 30px;  
}

to make the lines thicker, so i guess "page-break-after: always;" simply doesn't work with "hr"?

Best Regards,

Danny from Germany


Answers:
author: Bill Bailey
body: So basically company policy has tied your hands behind your back? Will they allow you a user macro?

When you say printed, or you doing a native export to PDF?

comments: author: Danny Brandt
body: Hi Bill, thank you for the quick answer!

Yeah basically, it's a bit complicated and i'm not really allowed to go further into that :D Let's just say my company policies are at the same time governmental policies (which now sounds way more dramatic than it really is)

I do have a decent amount of Macros available though, with "user macro" do you mean a personalized?

I could use "User List" and "User Space".

The optimal solution would be to directly print it from the Website, but if there's a workaround by exporting it to PDF before and get the desired layout that way, that would be fine too.

I also thought about a redesign, since it works fine with

table {

page-break-after: always;

}

I'd have to get rid of some tables and a bit of restructuring by that though.


author: Bill Bailey
body: When I set up a similar instance in the past for customer documentation, we enable (via the Scroll PDF plugin) to create a PDF of the documentation tree. One, this gets you a professional looking output generally, and two, it has a page break macro to force a page break when you want one.

Printing a page from the browser is a bit more complicate, and [a user macro](https://confluence.atlassian.com/doc/writing-user-macros-4485.html) could help with a more targeted solution. But you will need an admin to install this macro -- which sounds like the dreaded policies will get in the way.

Another thought is to hijack some other macro, for example the panel macro. Basically only use it for this purpose, and use CSS to make it invisible on the page, but do what you want.


author: Danny Brandt
body: i guess the user or pdf scroll macro are no options, sadly. I'll definitely try the idea with the panel macro, sounds like it should work!   

If not, i guess i'll redesign it, so that i can use page-Break-after on the tables, which works exactly as i need it, just that i also use tables for other informations, where the break is disruptive.   

Thank you for all the advice!


Tags: confluence-server

server