Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to set up custom pdf export style for only one page in space pdf style sheet?

Róbert Szabó
Contributor
December 14, 2017

Hi Guys,

 

What do you think, it is possible to set up custom pdf export style for only one page in space pdf style sheet if the space already has a custom style set?

 

Code for the whole space:

body,p,li,td,table,tr,.bodytext,.stepfield
{
font-size: 10pt;
/* was 8 */
/*line-height: 1.1;*/
color: #000;
font-weight: normal;
}

.print-only
{
display: none;
}

.monospaceInput
{
font: 12pt monospace;
/* was 10 */
}

h1
{
font-size: 28px;
/* was 26 */
margin: 36px 0 4px 0;
text-align:center;
}

h2
{
font-size: 24px;
/* was 20 */
margin: 27px 0 4px 0;
}

h3
{
font-size: 22px;
/* was 18 */
margin: 21px 0 4px 0;
}

h4
{
font-size: 20px;
/* was 16 */
margin: 18px 0 4px 0;
}

h5
{
font-size: 17px;
/* was 14 */
margin: 14px 0 4px 0;
}

h6
{
font-size: 12px;
margin: 14px 0 4px 0;
display: block;
}

h7
{
font-size: 12px;
margin: 14px 0 4px 0;
display: block;
font-style: italic;
}

h8
{
font-size: 12px;
/* was 8 */
margin: 14px 0 4px 0;
display: block;
}

h9
{
font-size: 12px;
/* was 10 */
font-style: italic;
margin: 14px 0 4px 0;
display: block;
}

/* block quote */
blockquote
{
font-style: italic;
border-left-width: 1px;
border-left-style: solid;
padding: 0 20px;
margin: 10px 20px;
}

div.small
{
font-size: 10px;
/* was 9 */
}

h1.pagetitle
{
page-break-before: always;
}

h1.pagename
{
margin-top: 0;
}


.panelMacro td
{
font-size: 1em;
padding: 14px 7px;
}

.panelContent
{
color:#000000;
font-size:0.95em;
margin:0;
padding:0 12px;
text-align:left;
}

.code, .preformatted
{
background-color:#FFFFFF;
}

.preformattedHeader, .codeContent, .preformattedContent
{
background:#FFFFFF none repeat scroll 0 0;
}

.code pre, .preformatted pre
{
font-family:"Courier New",Courier,monospace;
line-height:1.3;
}

pre
{
margin:10px 0;
overflow:auto;
padding:0;
text-align:left;
page-break-inside: avoid;
}

.code
{
border-style:dashed;
border-width:1px;
overflow:auto;
page-break-inside: avoid;
}

@page
{
/*The A4 paper size is 210 mm wide by 297mm long*/
size: 210mm 297mm;
font-size: 10pt;
padding-top: 100px ;
padding-bottom: 100px;
background-image: url('https://confluence.giganet.hu/download/attachments/327739/bg1.jpg?api=v2');
background-repeat: no-repeat;
background-position: bottom right; /*adapt position to your liking*/




@bottom-center
{
content: "Oldal " counter(page);
font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;
font-size: 10pt;
}

}

 

Code for the single page in the style sheet (how can add this to the one above without crash? Is there any page ID somewhere?)

@page
{
/*A4-sized pages in landscape orientation are 297 mm wide by 210 mm long*/
size: 297mm 210mm;
margin: 0mm;
}

body {
font-family:
font-size: 14px;
}
.wiki-content b,

 

Thanks in advance!

Robert

3 answers

1 accepted

0 votes
Answer accepted
Róbert Szabó
Contributor
December 19, 2017

Hi Guys,

thanks for the suggestions, but the final solution is a user macro with this code:

## @noparams
<style>

@page {
size: 297mm 210mm;

margin-top: 2mm;
margin-bottom: 0mm;
margin-left: 2mm;
margin-right: 2mm;
padding: 2px;
background-image: none;
}

body,p,li,td,table,tr,.bodytext,.stepfield
{
font-size: 10px;
/*line-height: 1.1;*/
color: #000;
font-weight: normal;
}

</style>

 

The idea is from here: https://jira.atlassian.com/browse/CONFSERVER-22115?focusedCommentId=699391&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-699391

"You can put anywhere this user macro in the page you want to export in landscape orientation and the PDF export will be entirely landscape oriented."

0 votes
GG
Contributor
December 18, 2017

Hey Robert,

You can do that easily on-the-fly when exporting the page with Content Exporter for Confluence addon.

Here's more details how: https://metainf.atlassian.net/wiki/spaces/CEX/pages/53968900/Custom+Stylesheets

CEX_apply_custom_stylesheet.PNGCheers,
Greg

0 votes
AnnWorley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 14, 2017

Hi Robert,

The PDF space stylesheet will apply to every page in the space.

I do not know a way to apply the stylesheet to a specific page by ID; pages do have page IDs, which appear in the browser when you use the page tools menu, for example: <Base_URL>/wiki/pages/viewpreviousversions.action?pageId=210534415

I suggest you create a test space and apply the stylesheet there. You can copy the specific page to that test space and export it from there. This approach will avoid "breaking" Production during any trial and error you work through.

Best wishes,

Ann

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events