Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

PDF export: add date modified

Joachim Plener
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 25, 2014

I need the last modified date of a page to be put into the footer of every page when exporting to PDF. How can I achieve this?

Thanks in advance!

Joachim

2 answers

0 votes
calo August 2, 2015

I only know RasterEdge PDF control can modify PDF pages, but I don't know whether it's what you wanted.

If you still need it, you can google it.

0 votes
Guilherme Nedel [Atlassian]
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 25, 2014

Hi Joachim, currently that is not a feature within the application export, nevertheless some customers did report being able to add so using a bit of CSS styling - posted below, please review the comment from Gerhardt Müller for more info.

We have solved this by creating a simple jsp 'dateimage.jsp' in the confluence root dir, which creates the current date as image, and included a reference in the footer like this:

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

This is the jsp (for german dates, adapt as necessary):

&lt;%@

page import="java.awt.geom.Rectangle2D"%&gt;&lt;%@

page import="java.awt.AlphaComposite"%&gt;&lt;%@

page session="false"%&gt;&lt;%@

page import="java.util.Date"%&gt;&lt;%@

page import="javax.imageio.ImageIO"%&gt;&lt;%@

page import="java.awt.Font"%&gt;&lt;%@

page import="java.awt.Color"%&gt;&lt;%@

page import="java.awt.Graphics2D"%&gt;&lt;%@

page import="java.awt.image.BufferedImage"%&gt;&lt;%@

page import="java.util.Locale"%&gt;&lt;%@

page import="java.text.DateFormat"%&gt;&lt;%@

page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%&gt;&lt;%

 

    // 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());

 

%&gt;

Joachim Plener
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 1, 2014

Thanks for your reply! But it seems it is not exactly what we need... We do NOT need the current date in our PDF-exports, but the date, the Confluence page was LAST MODIFIED - ideally together with the author of that most recent edit. It is there - on top of every page, but in does not apear in any export-type (PDF / Word).

Another idea: Perhaps does anyone know some kind of makro, that puts this kind of information into the "printable" / exportable region of a page?

best regards, Joachim

Richie Hazlewood
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 29, 2014

Surely the last modified date can be piped through to the pdf exporter. Its already on the page being exported. Is this really not possible?

Like Julia B -Doc Queen likes this
Shell D May 31, 2016

Joachim Plener - did you end up figuring out how to add the 'last modified' date to the footer?

mistadave
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 2, 2017

Is there no easier way to include the current date into the footer for each PDF export ? 
Creating an image for a date just to put it on the footer seems to me making this problem extreme complicated.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events