-
Bug
-
Resolution: Fixed
-
Medium
NOTE: This bug report is for Confluence Cloud. Using Confluence Server? See the corresponding bug report.
Using the pdf export results in a broken format for code macro blocks. The font-size is much larger compared to < 4.1 which used the same size as the sourrounding text.
See the attachment for an example. This is an export out of Atlassian's Confluence instance (http://confluence.atlassian.com/display/DOC/Customising+Exports+to+PDF).
Note:
- There are no pdf export customizings in our local instance; neither global nor for the space itself.
- I tried to override ".code .panel" export css, in order to get a smaller font size, but it was ignored completely
- is related to
-
CONFSERVER-25312 PDF Export is using a very large font size for code-macro blocks
-
- Closed
-
- relates to
-
CONFCLOUD-25233 tables in PDF export are full-width
-
- Closed
-
[CONFCLOUD-25312] PDF Export is using a very large font size for code-macro blocks
Related issue: "Preformatted" text exports HUGE, and affects text outside the paragraph tagged as performatted:
https://jira.atlassian.com/browse/CONF-25483
I should note that while I was able to resolve the problem for the {code} block, this does not solve the problem for using the "preformatted" style tag from the list of styles. "preformatted" blocks render as HUGE text, AND the huge-ness bleeds onto subsequent paragraphs of text.... I do not have a solve for this one.
Documented here: https://support.atlassian.com/browse/CSP-81305 (not public and should not be...)
By adding the CSS, that does not solve the problem for me, the formating and size of the Java sniplet of code (formatted with the macro) os still very big and without the line numbering.
Add the following line to your CSS and it will work :
.panelContent { font-size:10pt; font-weight:normal; }
OK, the workaround does work. If you put in ALL the css, not just the top 20 lines!
pita...
This did not work.
a) I already had a header and footer defined in the pdf export css.
b) I addded the margin and padding lines, but that made no diff.
Please advise!
See shot I attached of my current pdf export stylesheet
A OnDemand user seems to have hit upon a potential solution to this problem. They used the following css:
8<-- @page { margin: 0.5in; padding: 1em; @top-left { content: element(header); } @bottom-center { content: "Copyright © 2012, Encap AS"; font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif; font-size: 8pt; } @bottom-right { content: "Page " counter(page); font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif; font-size: 8pt; } } @page title { margin: 0.5in; padding: 1em; @top-left { } @bottom-left { } } .fsTitlePage { position:relative; left:0px; } /* Turn off the default section numbering for this TOC item */ .toclvl0:before { content: " "; counter-reset: chapter 0; } /* Hide the default page numbering for this TOC item */ .toclvl0 .tocnum { display: none; } /* Move and style this TOC item */ .toclvl0 { position:absolute; top:250px; font-size: 42px; font-weight: bold; margin: 72px 0 4px 0; text-align:center; } a { text-decoration:none; } div.titlepage,div.toc { page:title; } img { page-break-inside: avoid; -fs-fit-images-to-width:6in; } table.lozenge { page-break-inside: avoid; } table.confluenceTable tr { page-break-inside: avoid; } body { margin: 0; padding: 0; font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif; } a, #default-labels-header a.add { color:#003366; } /* list numbering */ .wiki-content ol, .wiki-content ol ol ol ol, .wiki-content ol ol ol ol ol ol ol, .wiki-content ol ol ol ol ol ol ol ol ol ol { list-style-type:decimal; } .wiki-content ol ol, .wiki-content ol ol ol ol ol, .wiki-content ol ol ol ol ol ol ol ol, .wiki-content ol ol ol ol ol ol ol ol ol ol ol { list-style-type:lower-alpha; } .wiki-content ol ol ol, .wiki-content ol ol ol ol ol ol, .wiki-content ol ol ol ol ol ol ol ol ol, .wiki-content ol ol ol ol ol ol ol ol ol ol ol ol { list-style-type:lower-roman; } .wiki-content ul { list-style-type:disc; } /* table view for several macros*/ .tableview td { border-color:#CCCCCC; border-style:solid; border-width:0 0 1px; margin:0; padding:4px 10px 4px 5px; text-align:left; } /* built in gallery macro */ div.gallery>table { display: table-cell; } div.gallery>table>tr { display: inline; } div.gallery>table>tr>td { display: inline; } div.gallery>table>tr>th { display: inline; } div.gallery>table>tr:first-child { display: block; } pre { white-space: pre-wrap; } table { border-collapse: collapse; } div.panelMacro { page-break-inside: avoid; } th.confluenceTh { color: #003366; background-color: #f0f0f0; } /* wraps the section columns underneath each other so they don't run off the page */ table.sectionMacro { display: block; } table.sectionMacro>tbody { display: block; } table.sectionMacro>tbody>tr { display: block; } table.sectionMacro>tbody>tr>td { display: block; } table.sectionMacro>tbody>tr>td { width: 100% } table.sectionMacroWithBorder { display: block; } table.sectionMacroWithBorder>tbody { display: block; } table.sectionMacroWithBorder>tbody>tr { display: block; } table.sectionMacroWithBorder>tbody>tr>td { display: block; } table.sectionMacroWithBorder>tbody>tr>td { /* why 99 you ask? because the right border won't show in the export up if it's 100 */ width: 99% } body.content-preview { background-color: #fff; border: none; } body,p,li,td,table,tr,.bodytext,.stepfield { font-size: 8pt; /*line-height: 1.1;*/ color: #000; font-weight: normal; } .print-only { display: none; } .monospaceInput { font: 10pt monospace; } pre { padding: 0; margin: 10px 0; text-align: left; overflow: auto; } a.grey:link { color: #666; } a.grey:visited { color: #666; } a.grey:active { color: #666; } a.grey:hover { color: #666; } hr { color: #3c78b5; height: 1px; } h1 a:link,h1 a:visited,h1 a:active { text-decoration: none; } h1,h2,h3,h4,h5,h6,h7,h8,h9 { line-height: normal; font-weight: bold; padding: 2px; } h1 { font-size: 26px; margin: 36px 0 4px 0; } h2 { font-size: 20px; margin: 27px 0 4px 0; } h3 { font-size: 18px; margin: 21px 0 4px 0; } h4 { font-size: 16px; margin: 18px 0 4px 0; } h5 { font-size: 14px; margin: 14px 0 4px 0; } h6 { font-size: 12px; margin: 14px 0 4px 0; display: block; } h7 { font-size: 12px; margin: 14px 0 4px 0; display: block; font-style: italic; } h8 { font-size: 10px; margin: 14px 0 4px 0; display: block; } h9 { font-size: 10px; font-style: italic; margin: 14px 0 4px 0; display: block; } .grid { margin: 2px 0 5px 0; border-collapse: collapse; } .grid th { border: 1px solid #ccc; padding: 2px 4px 2px 4px; background: #f0f0f0; text-align: center; } .grid td { border: 1px solid #ccc; padding: 3px 4px 3px 4px; } .gridHover { background-color: #f9f9f9; } td.infocell { background-color: #f0f0f0; } /* block quote */ blockquote { font-style: italic; border-left-width: 1px; border-left-style: solid; padding: 0 20px; margin: 10px 20px; } blockquote em { font-style: normal; } table.admin { margin: 5px; border-collapse: collapse; width: 100%; } table.admin td,table.admin th { width: 50%; border: 1px solid #ccc; padding: 5px; vertical-align: top; } table.admin th { background-color: #f0f0f0; text-align: right; font-weight: bold; } table.admin td.controls { text-align: center; } div.small { font-size: 9px; } h1.pagetitle { page-break-before: always; } h1.pagename { margin-top: 0; } span.toclead:before { content: leader(dotted); } span.tocnum:before { content: target-counter(attr(href), page, decimal ); } div.toc { page-break-after: always; counter-reset: chapter 0; } div.toc a { text-decoration: none; color: black; } div.toclvl0:before { content: counter(chapter) ". "; counter-increment: chapter; /* Add 1 to chapter */ } div.toclvl0 { padding-left: 20px; counter-reset: section 0; /* Set section to 0 */ } div.toclvl1:before { content: counter(chapter) "." counter(section) " "; counter-increment:section; } div.toclvl1 { padding-left: 40px; counter-reset: subsection 0; } div.toclvl2:before { content: counter(chapter) "." counter(section) "." counter(subsection) " "; counter-increment:subsection; } div.toclvl2 { padding-left: 60px; counter-reset: subsubsection 0; } div.toclvl3:before { content: counter(chapter) "." counter(section) "." counter(subsection) "." counter(subsubsection) " "; counter-increment:subsubsection; } div.toclvl3 { padding-left: 80px; counter-reset: subsubsubsection 0; } div.toclvl4:before { content: counter(chapter) "." counter(section) "." counter(subsection) "." counter(subsubsection) "." counter(subsubsubsection) " "; counter-increment:subsubsubsection; } div.toclvl4 { padding-left: 100px; } /* hide any toc items beyond lvl 4 */ div.toclvl5, div.toclvl6, div.toclvl7,div.toclvl8,div.toclvl9,div.toclvl10,div.toclvl11,div.toclvl12 { display:none; } span.pageName:before { content: counter(page); } /* title area of tables for certain bundled macros (favpages)*/ .tabletitle, .heading-text-color { color:#003366; } .tabletitle, .pageSectionHeader { border-bottom-color:#6699CC; } .tabletitle { border-bottom-style:solid; border-bottom-width:2px; font-weight:bold; margin:8px 4px 2px 0; padding:3px 0 2px; } /* tabs */ .tabnav, .comment .tabnav, ul.tabnav { border-bottom-color:#6699CC; } .tabnav, .comment .tabnav { border-bottom-style:solid; border-bottom-width:1px; display:inline; float:left; font-weight:bold; list-style-position:outside; margin:0; padding:0; width:100%; } .tabnav .tabs a:hover { background:#003366 none repeat scroll 0 0; border-color:#003366; color:#FFFFFF; } .tabnav .tabs a:link, .tabnav .tabs a:visited { color:#FFFFFF; } .tabnav .tabs a { border-bottom:medium none; border-style:solid solid none; border-width:1px 1px medium; display:block; float:left; margin:5px 3px 0 0; padding:5px 5px 4px; text-decoration:none; } .tabnav .tabs a { background:#6699CC none repeat scroll 0 0; border-color:#6699CC; } .tabnav .tabs a.current { background:white none repeat scroll 0 0; border-bottom:1px solid white; color:black; } .tabnav li.tabs { display:block; float:left; list-style-image:none; list-style-position:outside; list-style-type:none; margin:0 0 -1px 10px; } /* space list macro */ tr.spaceList td { border-bottom:1px solid #CCCCCC; padding:5px 0 5px 5px; vertical-align:top; } #spacesLabel { float:left; margin-top:5px; padding:4px 6px; } /* built in macro: popular-labels style = heatmap */ .heatmap { list-style-image:none; list-style-position:outside; list-style-type:none; margin:0 auto; width:95%; } .heatmap li { display:inline; } .heatmap a { text-decoration:none; } /* built in macros: panel, code, info, note, warning, noformat, tip */ .noteMacro { background-color:#FFFFCE; } .panelMacro { margin:10px 20px; overflow:hidden; } .panelMacro table { text-align:left; width:100%; padding:0px 20px; } .panelMacro td { font-size: 1em; padding: 14px 7px; } .panel { border-color:#6699CC; background:#F0F0F0 none repeat scroll 0 0; border-style:solid; border-width:1px; color:black; margin:10px 20px; overflow:hidden; padding:0; page-break-inside: avoid; } .codeHeader, .panelHeader, .panelContent { background:#F0F0F0 none repeat scroll 0 0; } .panelHeader { font-size:10pt; border-bottom-style:solid; border-bottom-width:1px; line-height:2; padding:0 12px; text-align:center; } .panelHeader, .menuheading, .pageheader, .sectionbottom { border-bottom-color:#6699CC; } .panelContent { color:#000000; font-size:10pt; margin:0; padding:0 12px; text-align:left; } .code, .preformatted { background-color:#FFFFFF; } .preformattedHeader, .codeContent, .preformattedContent { background:#FFFFFF none repeat scroll 0 0; } .code pre, .preformatted pre { font-family:"Courier New",Courier,monospace; line-height:1.3; } pre { margin:10px 0; overflow:auto; padding:0; text-align:left; page-break-inside: avoid; } .code { border-style:dashed; border-width:1px; overflow:auto; page-break-inside: avoid; } .code-object { background-color:inherit; color:#910091; } .code-keyword { background-color:inherit; color:#000091; } .code-tag { background-color:inherit; color:#000091; } .code-quote { background-color:inherit; color:#009100; } .infoMacro { background-color:#D8E4F1; page-break-inside: avoid; } .tipMacro { background-color:#DDFFDD; page-break-inside: avoid; } .warningMacro { background-color:#FFCCCC; page-break-inside: avoid; } .errorBox { background-color:#FFCCCC; border:1px solid #CC0000; margin:5px; padding:5px; } /* tables */ table.sectionMacro td { border:medium none; } table { clear:left; } .wiki-content .confluenceTable, .grid { margin:10px 0 10px 0; padding:0; } table.confluenceTable { border-collapse:collapse; } th.confluenceTh, table.confluenceTable th.confluenceTh { background-color:#F0F0F0; border:1px solid #CCCCCC; padding:5px; text-align:left; vertical-align:top; } td.confluenceTd, table.confluenceTable td.confluenceTd { border:1px solid #CCCCCC; padding:5px; vertical-align:top; } .wiki-content td.confluenceTd, .wiki-content th.confluenceTh { margin:0; padding:0; } .wiki-content td.confluenceTd { padding-right:10px; } .wiki-content td.confluenceTd, .wiki-content th.confluenceTh { margin:0; padding:0; } /* Attachments macro */ table.attachments { width: 100%; } table.attachments th { color:#003366; border-bottom-style:solid; border-bottom-width:2px; font-weight:bold; } table.attachments a { text-decoration: none; color: black; } /* expand user macro */ .toggle-answer { display: block !important; } -->8
Apparently just changing the stylesheet for that PDF in the Wiki was enough to make it work. Sounds like a fix worth trying to me.
I've tested this out locally in 4.2 and it is reproducible so as in CAC which is in version 4.2.1. Replicate the same issue in 3.5.13 and 4.1.9 but it works fine. This is a confirmed bug of Export to PDF functionality.
I'm actually using this feature for generating customer facing documentation. This bug is actually pretty bad for me. Any ETA?