How to get page information to appear in the header of the PDF Export

Jane Brusilovsky
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!
April 26, 2023

I'm trying to figure out a way to pull the page title, just the first 5 characters of the page title, date (included as a macro on the page), and the status of the page and include it in the header during PDF Export. 

I have written the following HTML in the header section to get this:

<table>
<tr>
<td style="color: #663399;"><b>Company Name</b></td>
<td><b>First 5 characters of Page Title</b></td>
<td><b>Date Macro from Page</b></td>
<td><b>Page Status</b></td>
</tr>
<tr>
<td colspan="4">Page Title</td>
</tr>
</table>

Capture.PNG

I've just hard-coded the information, but I would like to have the pdf export inherit this information from the page, so that I do not need to modify the HTML every time I export a pdf.

 

Has anyone been able to do something similar?

1 answer

0 votes
Riley Venable
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 26, 2023

One approach to dynamically generate a PDF header that includes the page title, date, and page status without hard-coding the information is to use a third-party add-on such as Scroll PDF Exporter or k15t's PDF Exporter.

These add-ons allow customization of the PDF export template and include dynamic content such as page titles, dates, and macros. Alternatively, you can use Confluence's built-in PDF export template feature, which allows you to create a custom PDF export template using HTML and CSS, which can include dynamic content using Confluence's template variables.

You can then upload this template to Confluence's template library and select it when exporting a page to PDF.

Jane Brusilovsky
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!
April 27, 2023

Thank you! I'm using Confluence's built-in PDF export, but I didn't realize you could make a template with variables. I just did that for the variables I need, but how do you go about calling them in the Header HTML (or CSS stylesheet)? Is there a specific naming convention to pull those variables?

Like if my template variable was a text variable called page_stat, how would I incorporate it?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events