• 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.

      With PDF style sheets, one can add things like page numbers and fixed text. It would be desirable to have a mechanism to insert the date on which the PDF export operation occurred.

            [CONFSERVER-21330] Allow entry of current date in exported PDF header/footer

            Sen made changes -
            Workflow Original: JAC Suggestion Workflow 4 [ 3571855 ] New: JAC Suggestion Workflow 3 [ 4334662 ]
            Katherine Yabut made changes -
            Workflow Original: JAC Suggestion Workflow 2 [ 3174834 ] New: JAC Suggestion Workflow 4 [ 3571855 ]
            Status Original: RESOLVED [ 5 ] New: Closed [ 6 ]
            Katherine Yabut made changes -
            Workflow Original: JAC Suggestion Workflow [ 3031688 ] New: JAC Suggestion Workflow 2 [ 3174834 ]
            Owen made changes -
            Workflow Original: Confluence Workflow - Public Facing v4 [ 2537730 ] New: JAC Suggestion Workflow [ 3031688 ]

            Dalectric added a comment -

            I can't get this to work on Confluence 6.7.2. So frustrating.

            Dalectric added a comment - I can't get this to work on Confluence 6.7.2. So frustrating.
            Rachel Lin (Inactive) made changes -
            Workflow Original: Confluence Workflow - Public Facing v3 [ 2258142 ] New: Confluence Workflow - Public Facing v4 [ 2537730 ]

            Gojko,

             

            Thanks for your code, but doesnt work better. still no image shown.

             

            Michael Regelin added a comment - Gojko,   Thanks for your code, but doesnt work better. still no image shown.  
            Michael Regelin made changes -
            Attachment New: image-2017-11-21-11-45-48-080.png [ 299383 ]

            g added a comment -

            Formating eddy5 jsp a bit:

            <%@ page import="java.awt.geom.Rectangle2D" %>
            <%@ page import="java.awt.AlphaComposite" %>
            <%@ page session="false" %>
            <%@ page import="java.util.Date" %>
            <%@ page import="javax.imageio.ImageIO" %>
            <%@ page import="java.awt.Font" %>
            <%@ page import="java.awt.Color" %>
            <%@ page import="java.awt.Graphics2D" %>
            <%@ page import="java.awt.image.BufferedImage" %>
            <%@ page import="java.util.Locale" %>
            <%@ page import="java.text.DateFormat" %>
            <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
            <%
            
                // size of the image
                final int height = 100;
                final int width = 850;
            
                // create string in correct date format
                DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.GERMAN);
                String dateString = df.format(new Date());
            
                // create white default image
                BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
            
                // create graphic
                Graphics2D dateGraphics2D = null;
                try {
                    dateGraphics2D = bufferedImage.createGraphics();
            
                    // write string to in Black graphics
                    dateGraphics2D.setColor(Color.BLACK);
                    dateGraphics2D.setFont(new Font("Helvetica", Font.PLAIN, height));
                    dateGraphics2D.drawString(dateString, 0, height-2);
            
                } finally {
                    {
                        {// dispose graphics always }}
                            if (dateGraphics2D != null) {
                                dateGraphics2D.dispose();
                            }
                        }
            
                        // write output
                        response.setContentType("image/png");
                        ImageIO.write(bufferedImage, "png", response.getOutputStream());
                    }
                }
            %>
            

            g added a comment - Formating eddy5 jsp a bit: <%@ page import = "java.awt.geom.Rectangle2D" %> <%@ page import = "java.awt.AlphaComposite" %> <%@ page session= " false " %> <%@ page import = "java.util.Date" %> <%@ page import = "javax.imageio.ImageIO" %> <%@ page import = "java.awt.Font" %> <%@ page import = "java.awt.Color" %> <%@ page import = "java.awt.Graphics2D" %> <%@ page import = "java.awt.image.BufferedImage" %> <%@ page import = "java.util.Locale" %> <%@ page import = "java.text.DateFormat" %> <%@ page language= "java" contentType= "text/html; charset=UTF-8" pageEncoding= "UTF-8" %> <% // size of the image final int height = 100; final int width = 850; // create string in correct date format DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.GERMAN); String dateString = df.format( new Date()); // create white default image BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); // create graphic Graphics2D dateGraphics2D = null ; try { dateGraphics2D = bufferedImage.createGraphics(); // write string to in Black graphics dateGraphics2D.setColor(Color.BLACK); dateGraphics2D.setFont( new Font( "Helvetica" , Font.PLAIN, height)); dateGraphics2D.drawString(dateString, 0, height-2); } finally { { { // dispose graphics always }} if (dateGraphics2D != null ) { dateGraphics2D.dispose(); } } // write output response.setContentType( "image/png" ); ImageIO.write(bufferedImage, "png" , response.getOutputStream()); } } %>

            Hi all,

             

            I have tried the solution proposed by Gerard, but Confluence seems to not find the jsp file ??.

            My logs says

            2017-11-17 11:35:30,818 WARN [Long running task: PDF Space Export] [confluence.extra.flyingpdf.ConfluenceExportUserAgent] getImageResource Could not retrieve image resource /datescript.jsp during Confluence export
            
            

             

            The datescript.jsp is at root of confluence.

            Added in the footer of pdf export layout

            Print date: <img src="/datescript.jsp" width="85" height="10" />

             what's wrong ?

            Thanks for any help.

             

            Michael

            Michael Regelin added a comment - Hi all,   I have tried the solution proposed by Gerard, but Confluence seems to not find the jsp file ??. My logs says 2017-11-17 11:35:30,818 WARN [ Long running task: PDF Space Export] [confluence.extra.flyingpdf.ConfluenceExportUserAgent] getImageResource Could not retrieve image resource /datescript.jsp during Confluence export   The datescript.jsp is at root of confluence. Added in the footer of pdf export layout Print date: <img src= "/datescript.jsp"  width= "85"  height= "10"  />  what's wrong ? Thanks for any help.   Michael

              Unassigned Unassigned
              d6bf13d20826 Kevin Buchs
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: