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
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.
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):
<%@ 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()); %>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.