Hi, I am a newbie with page styles and pdf exports and so I'd appreciate some help with exporting pages to PDF and correctly using page breaks.
I would like to use an image or (ideally) a hidden element of the page content to force a page break when exporting to PDF. I have seen style sheet code which breaks on h1, h2 etc.... but I don't know what h1, h2 etc are.
Ideally I would like to be able to insert a user macro at the point I want the page to break when exported. When viewing it would remain invisible.
Please be gentle in pointing out the scale of my ignorance.
Regards, Jon
Hi Jonathan.
H1 etc is HTML tags (paired) It is tag for Headings. H1 is top level heading, h2 second one ....
H1 tags, p tags etc is blocked, so everytime is there break new line after them.
If you need break, use <br> tag.
HTML is covered by W3 Consorcium. They have many examples and tutorials and really awesome web http://www.w3schools.com/html/html_basic.asp
If you need a new page, you have to use styles for it. It is called CSS (Cascade Style Sheet), more info on w3 web :)
If you have some element (HTML tag) on page, for example H1, and you want to have it on a new page , you can create class in CSS, define there that page breaking, and then use H1 with class definition of breaking. Examples :)
<style> .break { page-break-before: always; } </style> <body> content on page 1... <h1 class="break">text of Heading 1 on page 2</h1> content on page 2... <h1 class="break">text of Heading 1 on page 3</h1> content on page 3... <p class="break">content on top of page 4</p> content on page 4... </body>
And here it could be for ALL H tags :)
<style> h1{ page-break-before: always; } </style> <body> content on page 1... <h1>text of Heading 1 on page 2</h1> content on page 2... <h1>text of Heading 1 on page 3</h1> content on page 3... </body>
Thanks for this, I can see some study is in order. You've helped me a great deal.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I hope that It will help you :) If you need any advice in CSS, write comment here :)
Have a nice day!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You could do the + trick :)
hr + hr {
page-break-before: always;
}
So you can do a single hr when you want it.
If you take two hr in a row, the page-break will formated as needed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you put the hr + hr definition from above in your customized CSS-file for the export.
After that you can get a manual page-break with two hr in a row at the export.
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Markus hr means divider right ?? But it causing me an under line which i don't want
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That last answer works well and is the simplest. In steps it is:
page-
break
-after:always;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am relatively new to using Confluence, so please pardon my ineptitude. When I click "Formatting", I don't see "div" as an option. Listed alphabetically, it goes from "CSV" to "Expand". Is there something I need to do first to be able to see it? Have they removed this as an option since this post?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for this! I've been looking for this solution for a while. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Steven, good morning,
This is a very old post but today helped me a lot. Thank you so much for that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Insert, anywhere you want the page break to happen, a "Div" macro with the "Style":
page-break-after:always;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
FYI, this still works (May 2017). I particularly like it because unlike other "solutions" here, it doesn't require you to have access to create user macros or edit stylesheets.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yep, still works. I wish there was a way to achieve the same result globally for all pages, without using any macros. Seems like it should be a simple enough option.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I second Nir! How is this not native to Confluence?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This doesnt seem to work when i try to Export using the Browser "Print as PDF" setting. Does anyone know how i can achieve that?
The reason why i dont export as PDF using the Confluence Option is because it doesnt pull my Jira graphs (it just pulls the iframe query text)
PS i am a newbie here so please bear with me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Wow, this shouldn't be so hard. Or am I missing something?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jonathan.
Content Exporter for Confluence addon has a built-in page break macro. That should be an easy fix for your question:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jonathan,
You could use the OneOffixx Exporter App for Confluence. There are macros for page breaks, portrait, landscape, etc.
You can find it on the Marketplace and there is also a link to our example page, where you can test the app easy and fast.
Regards,
Stephan (CEO of EPS Software Engineering AG, the vendor of the OneOffixx Exporter)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I realize this question is ancient, but I couldn't find that they've ever come up with a better way to solve the problem and was able to make BenoitP's solution work with some modification.
I wanted to add that div is no longer available under Other Macros -> Formatting, and instead replaced with Divbox. Adding page-break-after:always; still works, but the Divbox will display an empty tan colored box with a border.
To get rid of the tan background and the border, you'll now want to enter this into the style field.
page-break-after:always; background-color:transparent; border: 0px
Now you'll have an invisible page break that will format your PDF's the way you want them to.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for posting this Jordan. I'm using the Cloud version and Div is still available, but it wasn't working for me, until I read the text for the Div command which says about wrapping the selected text in the Div. I put the cursor at the end of the page, selected all the page content and then inserted the Div and it worked. I had one page containing a table which refused to play ball, and kept replacing the selected text with the Div so I had an empty page (!) but apart from that, all good.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Benoit thank you for taking the time to post this. This worked for me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jonathan,
if you are using our Scroll PDF Exporter, you can create a user-macro to insert page-breaks. The usermacro is not visible in the Confluence view, but will be inserted when exporting to PDF.
Please have a look at the following page for further details how to create this macro: Adding Pagebreaks.
Besides you can simply define page breaks using CSS, e.g. to always break before a heading 1 (h1), see Enforcing Pagebreaks.
Hope that helps.
If you have any further questions regarding Scroll PDF Exporter, please feel free to contact support@k15t.com. I'll be happy to help.
Cheers,
Nils
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.