How to export an entire page in landscape?

I've read this topic on some page content printing in landscape: https://answers.atlassian.com/questions/170484/how-can-we-export-a-specific-pdf-page-in-portrait-or-landscape-for-big-pictures-or-tables

However, I need for the entire page to export in landscape. If I include the div and put all content in it, the page title still exports because it believes it should be in portrait and so I have the first page that is portrait an only includes the page title, then the page content that is in landscape, then the last page is always blank and in portrait.

How do I get the page title to be included on the first page in landscape mode? I was trying various CSS entries in the space and on the page itself without any luck regarding pagetitle.

3 answers

1 accepted

This widget could not be displayed.

Yes, since the available workaround resources to a CSS it is gets lost when the context of the PDF export (i.e. global, multipage, etc) changes. :( This feature request may be of interest for the case:

  • https://jira.atlassian.com/browse/CONF-22115

I provided the same comment on that issue. Thanks for pointing me to it. This is such a critical need for anyone reusing content and for generating documents, a core feature of a wiki, I'm suprised it hasn't gotten more attention/support from Atlassian.

This widget could not be displayed.

Hello Karie, there is a similar topic in this thread, it suggests that one use the following:

@page {
size: 210mm 297mm; /* DinA4 */
}

I did include that in the CSS; however, if you use that, when you include that page using the includepage macro, it is ignored (whereas div tags aren't ignored). Also, if you select that page in a global export, the CSS is assumed for all selected pages - thus, everything gets transformed to landscape when that's not what you want. Div tags are respected in a global export, unless there is that CSS, and then its overwritten. Consequently, I was trying to use a div tag instead of a css in order to have a complete solution that works for single page export, global export, and exports when it is included.

This widget could not be displayed.

Hi Karie,

I have the same problem. I'm using a user macro as a workaround to get the page title to be included on the page in landscape. The macro adds a div-element with the class "landscape" and then adds the page title to this page. I still have the first page in portrait with the title only.

You can use a user macro like this:

## Macro title: pdf-landscape-export
## Macro has a body: Y
## Body processing: Rendered
##
## Developed by: Frederik Teuber
## Date created: 26/05/2014

## This is the pdf-landscape-export macro
## @param showTitle:title=Show Title?|type=boolean|desc=Display the page title?|default=true

<div class="landscape">
  #if (!$paramshowTitle)
    <div class="print-only"><h1>$content.getTitle()</h1></div>
  #end
$body
</div>

You can choose then in the macro browser wether you want the title to be displayed on the landscape page or not.

Add this line to your custom css to avoid the page title to be displayed twice on your page:

.print-only {
display: none;
}

There is also some css you have to add for your pdf export like described in the question you mentioned in your post. Use something like

div.landscape {
page: landscape;
width:150%;
}

and fit for your needs.

I would appreciate if anybody had a clean solution for avoiding the first page to be in portrait with title only.

Cheers,

Frederik

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

477 views 6 6
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