diff --git a/README.md b/README.md index b7fe687d..44cb37a7 100644 --- a/README.md +++ b/README.md @@ -239,6 +239,51 @@ In case if both of them specified 'existing_wi_id' has higher priority. (Style package, Stylesheets) there's no `Quick Help` section as their content is self-evident. 4. To change configuration of PDF Exporter extension just edit corresponding section and press `Save` button. +### CSS for booklet layout + +If you export PDF to be printed as a booklet, then you may need to alternate blocks in header/footer depending on the fact if it's even or odd page. +This can be achieved (since version 8.1.0) by CSS modification. Let us give you an example. Find following definition in standard CSS of the extension: + +``` +@page :left { + @top-left { + content: element(top-left); + } + @top-right { + content: element(top-right); + } + @bottom-left { + content: element(bottom-left); + } + @bottom-right { + content: element(bottom-right); + } +} +``` + +...and replace it by this code: + +``` +@page :left { + @top-left { + content: element(top-right); + } + @top-right { + content: element(top-left); + } + @bottom-left { + content: element(bottom-right); + } + @bottom-right { + content: element(bottom-left); + } +} +``` + +As a result blocks in header and footer which in normal case are displayed at right side of the header/footer will be displayed at left side and vice versa. +This is only an example to illustrate an idea, if your use case is different feel free to modify this code according to your requirements. + + ## Usage 1. Open a document in Polarion. diff --git a/src/main/resources/default/dle-pdf-export.css b/src/main/resources/default/dle-pdf-export.css index 604d8e59..1e4958c5 100644 --- a/src/main/resources/default/dle-pdf-export.css +++ b/src/main/resources/default/dle-pdf-export.css @@ -73,9 +73,8 @@ th { border: none; } -.footer { - margin-top: 10px; - margin-bottom: 50px; +.header .top-center, .footer .bottom-center { + text-align: center; } .page-number .number::after { @@ -140,29 +139,47 @@ ul.toc li > a.page-number::after { @page { margin: 120px 60px 90px 80px; border-bottom: 1px solid #aaa; - @top-left { - content: element(top-left); - display: none; - } @top-center { content: element(top-center); - width: 100%; + width: 50%; + } + @bottom-center { + content: element(bottom-center); + width: 50%; + } +} + +@page :left { + @top-left { + content: element(top-left); } @top-right { content: element(top-right); - display: none; } @bottom-left { content: element(bottom-left); - display: none; } - @bottom-center { - content: element(bottom-center); - width: 100%; + @bottom-right { + content: element(bottom-right); + } +} + +@page :right { + @top-left { + content: element(top-left); + text-align: left; + } + @top-right { + content: element(top-right); + text-align: right; + } + @bottom-left { + content: element(bottom-left); + text-align: left; } @bottom-right { content: element(bottom-right); - display: none; + text-align: right; } } @@ -306,31 +323,34 @@ ul.toc li > a.page-number::after { } .header, .footer { - display: inline-block; + display: block; } - .header.top-left { + .header .top-left { position: running(top-left); } - .header.top-center { + .header .top-center { position: running(top-center); } - .header.top-right { + .header .top-right { position: running(top-right); } - .footer.bottom-left { + .footer .bottom-left { position: running(bottom-left); + margin-bottom: 40px; } - .footer.bottom-center { + .footer .bottom-center { position: running(bottom-center); + margin-bottom: 40px; } - .footer.bottom-right { + .footer .bottom-right { position: running(bottom-right); + margin-bottom: 40px; } h1 { @@ -868,24 +888,6 @@ li span { line-height: 1em !important; } -.header-footer-wrapper { - display: flex; -} - -.header-footer-left { - flex: 1; -} - -.header-footer-center { - max-width: 30%; - text-align: center; -} - -.header-footer-right { - flex: 1; - text-align: right; -} - .comment { background: #eee; border-left: 5px solid #aaa; @@ -971,4 +973,4 @@ table.polarion-rp-column-layout td { } .polarion-TestRunOverviewWidget-buttonName { padding-top: 20px; -} \ No newline at end of file +} diff --git a/src/main/resources/webapp/pdf-exporter/html/headerAndFooter.html b/src/main/resources/webapp/pdf-exporter/html/headerAndFooter.html index 3422b2a1..a528f0c3 100644 --- a/src/main/resources/webapp/pdf-exporter/html/headerAndFooter.html +++ b/src/main/resources/webapp/pdf-exporter/html/headerAndFooter.html @@ -1,22 +1,22 @@ -