The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

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

Per Thomsen
December 17, 2021

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?

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Alberto Jimenez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 24, 2025

I have the same problem here, and I cannot make it work neither. I used also the same formulas as @Per Thomsen , but failed.

Please, advice.

0 votes
Bill Bailey
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 Champions.
December 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>

Per Thomsen
December 21, 2021

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?

Like Alberto Jimenez likes this
0 votes
Vishwas
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 Champions.
December 18, 2021

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

Per Thomsen
December 18, 2021

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.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events