Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-24661

Add possibility to show header and/or footer in PDF cover and/or pdf toc

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • 17.10.9
    • Export - PDF
    • None
    • Unknown

    Description

      With the new Web PDF export it's difficult to show the PDF header or the footer in the TOC or the cover page. It's possible but a bit hackish and require to customize platform code (see below the workaround). Also with the old FOP PDF export the Footer and the header was shown on the TOC, so when migrating from FOP, it's a change that we might not want and we want to keep the old behavior.

      So this issue is to add "a simple" possibility to show the header and the footer on the toc and/or in the cover pages. This could be done as a field in the PDF template class or a CSS rule in the PDF template.

      Workaround

      Until this feature is implemented we still can do it this way:

      • Add theses CSS rules in the PDF template:
          .pdf-header, .pdf-footer {
            /* Need to add this otherwise we will have a blanc page */
            display: none;
          }
        
          @page cover {
            @top-center {
              content: element(header) !important;
            }
        
            @bottom-center {
              content: element(footer) !important;
            }
          }
        
      • In the PDF sheet, edit this line with this new content (so the header and footer is between cover and toc, this way pagedjs will load enough early the header and the footer elements):
        #set ($pdfElements = ['cover', 'toc', 'header', 'footer'])
        

      Attachments

        Activity

          People

            Unassigned Unassigned
            josue Josué Tille
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: