How do you apply a custom font to an exported PDF?

The instructions make it sound easy, but when I attempt it, nothing happens. For example:

@font-face {
  font-family: BryantBold;
  src: url(file:///usr/share/fonts/BryantBold.otf);
  -fs-pdf-font-embed: embed;
}  
      
h1, h2, h3, h4, h5, h6, .blogHeading {  
  font-family: "BryantBold", "Trebuchet MS",Trebuchet,sans-serif;  
  font-weight: normal !important;    
}

From what I understand, if that font is located on the the Confluence server (which it is) that CSS there should embed the BryantBold font into the PDF and apply it to headings. The problem is, that it doesn't seem to do so.

Two differences I have in my code to the example is that I user the font-family: element in @font-face and I'm using an opentype font instead of a truetype one. Could either of these be a factor? (I know that the h1 etc styling is targeting correctly as dumping in a font-size: 4em; into the mix makes all my headings in the PDF large. It's just that damn font-face not being applied.

Any suggestions?

1 answer

1 accepted

This widget could not be displayed.

Hello Dan,

From the following KB we see that Confluence only suports true type fonts.

https://confluence.atlassian.com/display/CONFKB/How+to+Export+PDF+Using+OpenType+.otf+Font+File

This article hepfully links to a converter that will allow you to convert your .otf into the proper format.

Please let us know if you have any troubles.

Thanks for your help. I converted the font to a TTF, tried again and still no luck. :-(

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published Tuesday in Confluence

Add-on evaluation with confluence templates

Atlassian market place contains number of Apps/Addons which improves the capability of out of the box Atlassian products. It is good to follow a plugin evaluation process before install add-ons. So t...

169 views 12 7
Read article

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