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.
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:
Go to Space Settings > Look and Feel > PDF export.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.