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

Thomas Zobel December 26, 2012

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

1 vote
Answer accepted
dleng
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.
December 26, 2012

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

dleng
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.
December 26, 2012

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)

Thomas Zobel December 27, 2012

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

Trupti Kanase July 8, 2016

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

1 vote
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.
February 24, 2013

@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...

0 votes
Anselmo February 27, 2013

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 :-)

0 votes
Anselmo January 22, 2013

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.

0 votes
William Zanchet [Atlassian]
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.
January 2, 2013

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events