• 1
    • 0
    • We collect Confluence feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      NOTE: This suggestion is for Confluence Server. Using Confluence Cloud? See the corresponding suggestion.

      Due to the advent of the new PDF export functionalities in Confluence 3.0, customising the export via Velocity files is no longer relevant.

      This results in some limitations where it is no longer possible to use Velocity Content Objects for the PDF exports. For instance, there is no way to include the following items in the exports:

      • Page title
      • Page version
      • Page authors

      It would be nice if this feature can be used again in Confluence 3.x

            [CONFSERVER-16527] Allow PDF Exports to be customised via Velocity

            Atlassian Update - 27 March 2025

            Hello,

            Thank you for submitting this suggestion. We appreciate you taking the time to share your ideas for improving our products, as many features and functions come from valued customers such as yourself.

            Atlassian is committed to enhancing the security and compliance of our Data Center products, with an emphasis on sustainable scalability and improving the product experience for both administrators and end-users. We periodically review older suggestions to ensure we're focusing on the most relevant feedback. This suggestion is being closed due to a lack of engagement in the last four years, including no new watchers, votes, or comments. This inactivity suggests a low impact. Therefore, this suggestion is not in consideration for our future roadmap.

            Please note the comments on this thread are not being monitored.

            You can read more about our approach to highly voted suggestions here and how we prioritize what to implement here.

            To learn more about our recent investments in Confluence Data Center, please check our public roadmap and our dashboards, which contain recently resolved issues, current work, and future plans.

            Kind regards,
            Confluence Data Center

            George Varghese added a comment - Atlassian Update - 27 March 2025 Hello, Thank you for submitting this suggestion. We appreciate you taking the time to share your ideas for improving our products, as many features and functions come from valued customers such as yourself. Atlassian is committed to enhancing the security and compliance of our Data Center products, with an emphasis on sustainable scalability and improving the product experience for both administrators and end-users. We periodically review older suggestions to ensure we're focusing on the most relevant feedback. This suggestion is being closed due to a lack of engagement in the last four years , including no new watchers, votes, or comments. This inactivity suggests a low impact. Therefore, this suggestion is not in consideration for our future roadmap. Please note the comments on this thread are not being monitored. You can read more about our approach to highly voted suggestions here and how we prioritize what to implement here. To learn more about our recent investments in Confluence Data Center, please check our public roadmap and our dashboards, which contain recently resolved issues , current work, and future plans. Kind regards, Confluence Data Center

            thank you for you solution , i tried to put this in the pdf stylesheet , the @bottom-center is working very well
            but the content for the top right is not working :

            content: "$!content.getTitle() v.$!content.getVersion() ($!content.getIdAsString())";

            can any one help me with this ?

            amna alsaidan added a comment - thank you for you solution , i tried to put this in the pdf stylesheet , the @bottom-center is working very well but the content for the top right is not working : content: "$!content.getTitle() v.$!content.getVersion() ($!content.getIdAsString())"; can any one help me with this ?

            Adding my vote so that exported PDFs are able to include a TinyURL reference to the original document.

            Adam Jacobson added a comment - Adding my vote so that exported PDFs are able to include a TinyURL reference to the original document.

            Nils - have you developed this any further to add any workflow data to the header/footer of your PDF exports?

            Chris

            Chris Gregg added a comment - Nils - have you developed this any further to add any workflow data to the header/footer of your PDF exports? Chris

            I don't think that works since those Layouts do not get applied when exporting PDF; which is what the "PDF Layout" is for which does not work for single page PDF exports and doesn't support Velocity (which is why this bug exists) :/

            Nils Gladitz added a comment - I don't think that works since those Layouts do not get applied when exporting PDF; which is what the "PDF Layout" is for which does not work for single page PDF exports and doesn't support Velocity (which is why this bug exists) :/

            Hi Nils,

            you seem to have found a very elegant solution!
            About the @media, I'd say its because @media and @page are different things altogether.
            From what I understood by reading this:

            • @media tells the sofware what type of document you want the css rules apply to: sheet of paper, screens, etc...
            • @page is, relative to this paper, a modelled set of rules: margins, pagebreak, police size, etc... It's something totally different from the Confluence "Page" concept.

            So if you miss the @media, Confluence won't know that you want these rules to apply when you export to PDF, hence the disparition.

            Since you went this far, maybe you could try scaling it by rendering it in the templates?
            If you want to try:

            1. copy one of your spaces
            2. in copied space, go to Browse > Space Admin > Theme and apply "Global Look and Feel".
            3. then a bit under, click on "Layouts"
            4. click on "Create Custom" next to the Page.vmd
            5. find the $body, and, around it, put this: $helper.renderConfluenceMacro("yourmacro")
            6. it may work or not, I don't know, since I don't know where you retrieve the informations from, but don't have time to try for now, sorry.

            Good job anyways, your work should help many users.

            Best regards,

            Laurent

            Laurent Lacôte added a comment - Hi Nils, you seem to have found a very elegant solution! About the @media, I'd say its because @media and @page are different things altogether. From what I understood by reading this : @media tells the sofware what type of document you want the css rules apply to: sheet of paper, screens, etc... @page is, relative to this paper, a modelled set of rules: margins, pagebreak, police size, etc... It's something totally different from the Confluence "Page" concept. So if you miss the @media, Confluence won't know that you want these rules to apply when you export to PDF, hence the disparition. Since you went this far, maybe you could try scaling it by rendering it in the templates? If you want to try: copy one of your spaces in copied space, go to Browse > Space Admin > Theme and apply "Global Look and Feel". then a bit under, click on "Layouts" click on "Create Custom" next to the Page.vmd find the $body, and, around it, put this: $helper.renderConfluenceMacro("yourmacro") it may work or not, I don't know, since I don't know where you retrieve the informations from, but don't have time to try for now, sorry. Good job anyways, your work should help many users. Best regards, Laurent

            Thanks for the hints!

            I've managed to build a partial solution which seems to work (even though I'm not sure why).
            I build the following user macro (with HTML output):

            <style type="text/css">
            @media print {}
            
            @page {
               @top-right
                {
                    content: "$!content.getTitle() v.$!content.getVersion() ($!content.getIdAsString())";
                    font-size: 8pt;
                }
            
                @bottom-center
                {
                    content: "Page " counter(page) " of " counter(pages);
                    font-size: 8pt;
                }
            }
            </style>
            

            Which I then invoke on confluence pages that require it.

            It adds title, version, ID, current page number and total page count to each page (when exporing to PDF).
            I haven't figured out how to access any of the Ad hoc workflow plugin state via Velocity though.

            As far as I undestand it <style> elements are only legal in the <head> section though I saw it being used in one of the user macro examples and it seems to work (for the moment).
            Also I have no idea why the empty "@media print" block is required; without it the extra content vanishes.

            Nils Gladitz added a comment - Thanks for the hints! I've managed to build a partial solution which seems to work (even though I'm not sure why). I build the following user macro (with HTML output): <style type= "text/css" > @media print {} @page { @top-right { content: "$!content.getTitle() v.$!content.getVersion() ($!content.getIdAsString())" ; font-size: 8pt; } @bottom-center { content: "Page " counter(page) " of " counter(pages); font-size: 8pt; } } </style> Which I then invoke on confluence pages that require it. It adds title, version, ID, current page number and total page count to each page (when exporing to PDF). I haven't figured out how to access any of the Ad hoc workflow plugin state via Velocity though. As far as I undestand it <style> elements are only legal in the <head> section though I saw it being used in one of the user macro examples and it seems to work (for the moment). Also I have no idea why the empty "@media print" block is required; without it the extra content vanishes.

            Laurent Lacôte added a comment - - edited

            Hi Nils,
            you can take a first step to your goal by combining:

            • Visibility plugin (macro {show-if:display=printable}) to enclose informations
            • Reporting plugin ( {report-info:page:title}

              ,

              {report-info:page:id}

              and

              {report-info:page:version}

              macros)

            • Customizations of PDF Stylesheet and PDF Layout as explained here
            • Documentation Theme (not mandatory but much easier).

            To display the content you want, you'd like to add:

            • this code in top of your page's content: {show-if:display=printable} {report-info:page:title} - idn°{report-info:page:id}
              Version: {report-info:page:version}{show-if}
            • this code in bottom of your page's content: {span:id=pageNum}
            • this code in your space's PDF Stylesheet:
              #pageNum:before { content: counter(page); }

            Problem is, you'd have to replicate this onto all pages. I tried to scale by using Documentation theme's header/footer, but it seems they aren't included during PDF buildout.

            Hope a more knowledgeable people can help you automate this customizations on all pages.

            Cheers,

            Laurent

            Laurent Lacôte added a comment - - edited Hi Nils, you can take a first step to your goal by combining: Visibility plugin (macro {show-if:display=printable}) to enclose informations Reporting plugin ( {report-info:page:title} , {report-info:page:id} and {report-info:page:version} macros) Customizations of PDF Stylesheet and PDF Layout as explained here Documentation Theme (not mandatory but much easier). To display the content you want, you'd like to add: this code in top of your page's content: {show-if:display=printable} {report-info:page:title} - idn°{report-info:page:id} Version: {report-info:page:version}{show-if} this code in bottom of your page's content: {span:id=pageNum} this code in your space's PDF Stylesheet: #pageNum:before { content: counter(page); } Problem is, you'd have to replicate this onto all pages. I tried to scale by using Documentation theme's header/footer, but it seems they aren't included during PDF buildout. Hope a more knowledgeable people can help you automate this customizations on all pages. Cheers, Laurent

            I'm currently evaluating Confluence to manage documents for quality management.
            As far as I understand for us all printed documents are at least required to show on each page:

            • document title
            • reference number (I'm hoping there is an internal numeric unique ID that can be used for this?)
            • document version
            • workflow state (from the Ad hoc Workflows plugin)
            • page number

            Are there any other known ways to achieve this (e.g. without the PDF export perhaps)?

            Nils Gladitz added a comment - I'm currently evaluating Confluence to manage documents for quality management. As far as I understand for us all printed documents are at least required to show on each page: document title reference number (I'm hoping there is an internal numeric unique ID that can be used for this?) document version workflow state (from the Ad hoc Workflows plugin) page number Are there any other known ways to achieve this (e.g. without the PDF export perhaps)?

            One suggestion that might work for you is to install the plugin Scroll Office ( https://plugins.atlassian.com/plugin/details/24982 ).

            Although this is a commercial plugin (i.e. will cost you money), from my perspective addresses a lot of the short comings that Confluence has with both the PDF export and Word export.

            Using this plugin, you can define templates (and most likely satisfy your requirements above), and then export to a word document.
            From a word document, you can then generate a pdf file (using any available free tool such as PDF995).

            Although it would have been nice to see these features in Confluence it self, I find it worth the money, given that it is not available. Check it out.

            Daryl Halliday added a comment - One suggestion that might work for you is to install the plugin Scroll Office ( https://plugins.atlassian.com/plugin/details/24982 ). Although this is a commercial plugin (i.e. will cost you money), from my perspective addresses a lot of the short comings that Confluence has with both the PDF export and Word export. Using this plugin, you can define templates (and most likely satisfy your requirements above), and then export to a word document. From a word document, you can then generate a pdf file (using any available free tool such as PDF995). Although it would have been nice to see these features in Confluence it self, I find it worth the money, given that it is not available. Check it out.

              Unassigned Unassigned
              amohdaris Azwandi Mohd Aris (Inactive)
              Votes:
              93 Vote for this issue
              Watchers:
              66 Start watching this issue

                Created:
                Updated:
                Resolved: