Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to change the font-size in code snippets when exporting to PDF?

I think the subject says it all.

The monotype font in the PDF exports for code snippets is much too big for my liking. 

I have tried with some CSS, but I couldn't make the text of the code snippets change size at all. I tried changing the font-size for the '.prismjs' class, and the '.language-json' class. Nothing worked.

Anyone know how to change that font size in the PDF?

2 answers

0 votes
Bill Bailey Community Leader Dec 19, 2021

Hello @Per Thomsen , have you tried changing the CSS syles for code tag? If you look at the display, the code macro renders on the page as (depending on format setting):

<code class="plain plain">

</code>

I tried the following: 

code.plain {font-size: 8px;}
code {font-size: 8px;} 
code.plain.plain {font-size: 8px;}
.prismjs {font-size: 8px; }
.language-json {font-size: 8px;}

For the last one, I obviously only expected it to change my JSON blocks.

None of these made a difference as far as the font size for the code snippets.

It feels like I'm barking up the wrong tree?

Hi @Per Thomsen 

I haven't tried this option. But this link might guide you how to customize pdf export which has font-size configure option too

https://confluence.atlassian.com/doc/advanced-pdf-export-customizations-198806890.html

Regards,

Vishwas

I looked at both of the PDF export customization pages, and I can get the regular body font to change, but not the code snippets. At least I wasn't able to glean how to change the code snippet font size from those two documents.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Confluence Cloud

🏠 Say hello to the new Confluence Home!

Hi Atlassian Community, My name is DJ Chung, and I’m a Product Manager on the Confluence Cloud team. Today, I’m excited to share a new and improved version of Home. The new Home helps you ...

43,206 views 30 134
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you