Forums

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

Header on first page of single page PDF export

Will Maclean September 19, 2018

Hi,

I'm trying to figure out how to use CSS to put a header on only the first page of a single page export. This is the code I have so far:

@page {
margin-top: 4cm;
margin-bottom: 2cm;
@top-center {
width: 100%;
background-image: url("https://path.to/headerimage.png");
background-repeat: no-repeat;
background-position: center;
background-size: contain;
}
@bottom-center {
width: 100%;
background-image: url("https://path.to/footerimage.png");
background-repeat: no-repeat;
background-position: center;
background-size: contain;
}
}

@font-face {
font-family: "Century Gothic";
src: url("https://path.to/font.ttf");
}

body { font-family: "Century Gothic", serif !important}

 

As you can see, the header specified in the '@top-center'  tags appears on every page. Is there a '@header{}' rule or similar that I can use? Or some other way to make this work?

 

Thanks in advance

1 answer

1 accepted

0 votes
Answer accepted
Sireesha Dugginapeddi [Appfire]
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 4, 2018

Hi @Will Maclean,

Yes! There is a way to export your header content specific to the first page of the document. Try using this - 

@page :first {

@top-center
{
width: 100%;
background-image: url("https://path.to/headerimage.png");
background-position: center;
background-size: contain;
}
}

Include all the specifics to your first page in @page: first{} and others in @page {}.

Hope this works!

Thanks

Sireesha

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events