Insert Date on PDF Export

Karen Ferland November 14, 2017

I would like to be able to insert the current date when exporting to PDF. From what I have read, it appears that I have to write a user macro to do this. Is this correct? If so, does anyone have a user macro that I could copy? My goal is to just have the current date printed on the title page. 

2 answers

0 votes
Julia B -Doc Queen March 23, 2021

Please vote for this issue to be resolved. It should have already been fixed. 

https://jira.atlassian.com/browse/CONFCLOUD-55765.

0 votes
Dave Theodore [Coyote Creek Consulting]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 15, 2017

It's easy to do.  Here's what I did on our Confluence:

My macro is called "currentdate:

## Macro title: Current Date
## Macro has a body: N
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: Dave Theodore
## Date created: 06/10/2015
## Installed by: Dave Theodore

## @noparams
$action.dateFormatter.format($content.currentDate)

Keep in mind that this literally displays the current date. It will show today's date when you render the page today, but it will show tomorrow's date tomorrow. Obviously, the PDF will display the date that it was exported.

Karen Ferland November 16, 2017

Thank you. 

Karen Ferland December 14, 2017

One more question, how do I call the macro? Is there a particular format I have to use within the PDF Stylesheet? In your example of Current Date above, how do you call it? 

Dave Theodore [Coyote Creek Consulting]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 14, 2017

In my case, the macro is called "currentdate." If I want to use it on a page, I simply type:

{currentdate}

Alternatively, you can find it in the macro browser.

Like Susan Kraft-Yorke likes this
Karen Ferland December 15, 2017

I am not being clear. I want to know how to use a macro within the PDF Layout section. Here's what I have.

<div class="fsTitlePage">
<img src="/download/attachments/14812547/image2017-11-13_14-35-54.png" />
<div class="fsTitle">Edit Information: Addendum (Draft)<br><h1>
Date:</h1></br></div>
</div>

My question is how to call the macro so that it populates the Date field that I have.

Like # people like this
Tobbe Wilson December 1, 2021

Did anyone find out how to use this macro??

Marko Isola May 4, 2023

Hi,

Macro works on page and gets exported yes, good.

But it can't be used inside PDF export header/footer/titlePage HTML as far as I know. Which is what I'm looking for, and understand that op is looking for too. At least haven't found a workaround. It gets displayed {currentdate} as text.

I also tried to embed javascript inside HTML with no success eiter. PDF export skips that part and displays nothing.

Like Karen Thomas likes this
Karen Thomas February 1, 2024

Same issue... looking for solution to add "system date" to the PDF exports.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events