Forums

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

PDF Export: Entire page scales down due to wide code block

ara September 24, 2025

Hello,

I have a question about the PDF export feature in Confluence.

 

The Issue

When I export a page containing a code block to PDF, the entire document is scaled down to fit the width of the code block. As a result, all the text becomes very small and difficult to read.

 

Suspected Cause

By looking at the page source, I believe the problem is caused by the following attributes being automatically set on the code block:

  • breakoutMode="wide"

  • breakoutWidth="1800"

 

What I Want to Achieve

When exporting to PDF, I would like to adjust the width of the code block to fit within the page margins. (For example, by making the text wrap automatically within the code block, or by setting a maximum width.)

Is there a good way to prevent the entire document from scaling down? Any suggestions, perhaps involving custom CSS, would be greatly appreciated.

Thank you.

1 answer

0 votes
Tomislav Tobijas
Community Champion
September 26, 2025

Hi @ara ,

This seems to be known limitation/bug - CONFCLOUD-82793: Confluence PDF Export is not exporting content as it is displayed on view page 

What you could try is the following: Customize layout for PDF exports in Confluence Cloud 👀
In short:

  1. Go to Space Settings > Look and Feel > PDF export.

  2. Enter your CSS in the PDF stylesheet field and save.

Potentially something like this would work (note, I haven't tested this myself):

.code, pre {
max-width: 100% !important;
white-space: pre-wrap !important;
word-break: break-all !important;
}

But try to test out variations of CSS to get what you want (AI can be your friend here 🙂).

Additionally, there's an open bug related to code snippets on pages and PDF exports: CONFCLOUD-81038: PDF Export fails for Confluence pages with extensive code snippets 

Hope you'll get it to work.

Cheers,
Tobi

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events