PDF-Export. Images that doesn´t fit on the same page always starts on a new page

PDF export:

Images that doesn t fit on the same page after any element (headline, paragraph... ) always starts on a new page.

Can I avoid this?

5 answers

1 accepted

Based on this documentation:
https://confluence.atlassian.com/display/DOC/Customising+Exports+to+PDF

You will need to modify the attributes for the image elements, e.g.

img
{ 
page-break-inside: avoid;
-fs-fit-images-to-width: 6in; 
}

set page-break-inside to auto. (A value of avoid instructs the browser to start the element on the following page if there is not enough room for it on the current page)

Additional references: http://msdn.microsoft.com/en-us/library/ie/cc304067(v=vs.85).aspx

If that don't work, maybe you can apply some form of CSS (im not very good at css, you gotta find a solution yourself) that constrains the size of the image to its parent element. (so it doesn't overflow and do a page break)

It don't work, so i have to try another solution.

This solution does not work.. Is there any other solution available to resolve this issue?

@Anselmo: Better control for page breaks

In CSS you can use selectors to define elements more specifically. At http://www.w3.org/TR/CSS2/selector.html#adjacent-selectors you find an example:

E + F -> Matches any F element immediately preceded by a sibling element E.

So if you want to avoid page breaks between headlines and images you can use something like:

h1+img {
page-break-before: avoid;
}

But beware, it is not that simple. Always check the real html code because sometimes the image itself is inside another <div>, <p> or <table> and doesn't follow the headline directly or there is an unrecognized empty paragraph after the headline and so on...

Hi Thomas,

I took the liberty to raise a feature request for you, about this problem, as you can see here:
https://jira.atlassian.com/browse/CONF-27654

I did a test in my local environment and I was able to reproduce the same behavior that you're facing there.
I would strongly suggest that you vote on this feature request to increase its popularity and add it to your watchlist for future updates.

Cheers,

WZ

Hi Thomas,

Hi Atlassians,

I face a related problem in pdf-export. We often have page breaks between headlines and pictures belonging to this headline. There is no setting implemented so far, that standard text and pictures may break, but headlines and the following paragraph or picture not. This would hopefully lead to a page break before the headline and keep content together, which belongs together just by definition of the previous paragraph's format.

Another help to reduce the number of bad looking page breaks could be the choice between portrait or landscape pdf-export. If your article deals with many screenshots and little text (easy to translate!), a landscape format uses the page space much more efficiently and keeps most screenshots easy to read (bigger).

Many users still love to put printed documentation rather on shelves than reading it online. So making better use of page space is an ecological point too.

Thanks, Steffen,

this is at least worth a try and may be useful in the majority of cases. I could explain all other phenomena and ask editors to handle their code adequately.

An even better solution, which analyses a preview completely to improve its look and feel may be used within Acrobat, although it is additional effort.

My special interest is a wiki wiki way of exporting pdf in an idiot-safe manner, because it's not only me being told to do it. I'm just a good test candidate as an idiot :-)

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

902 views 23 12
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