---
title: "pdf-export macro"
canonical: "https://support.appfire.com/space/CDML/649955790/pdf-export%20macro"
format: markdown
---
> Macro (aura-html)


## Overview

> Macro (excerpt)
> 
> export content as a pdf

> 📝 This macro is only functional when [K15t Scroll PDF Exporter](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649923655) is installed.

The `pdf-export` macro is used to export a page or blog post in PDF format and add the PDF to the page as an attachment.

![image](media://e29544bd-e580-4eca-bca3-daea7c8a05a4)

The macro adds a pdf export file to the page with the following name format

- <*confluence_filename*>_<*document_version*>_<*date_pdf_file_created*>_<*time_pdf_created*>.pdf

When using with [K15t Scroll PDF Exporter](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649923655), a parameter can be added to specify a PDF template to be used for the export. *This parameter value will be a K15t Template Name or K15t Template ID value sourced from the K15t Scroll PDF Exporter app template information.*

For more information

- [Integration Guides](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649396230) > [Content Integrations](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649725106) >[ K15t Scroll PDF Exporter App](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649923655)

## Requirements

You must install the [K15t Scroll PDF Exporter](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649923655) app to use this macro.

<span style="color: #172b4d">If you want to export only content that is in a Comala workflow final state, then you must install the </span><span style="color: #172b4d">[Comala Document Management for Scroll Exporter app](https://marketplace.atlassian.com/apps/1218322/comala-document-mgmt-for-scroll-exporter?hosting=server&tab=overview)</span><span style="color: #172b4d"> (it is free, but it can only</span><span style="color: #000c34"> be installed after K15t Scroll PDF Exporter and Comala Document Management have been installed).</span>

> ℹ️ The `pdf-export` macro<span style="color: #172b4d"> is only supported if used with Scroll PDF Exporter</span><span style="color: #172b4d">** 4.10.11**</span><span style="color: #172b4d"> or higher</span>

## Where to use it?

Optional

The `pdf-export` macro can be put in a [trigger macro](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649859133).

> 📝 The `pdf-export` macro will first check for an active installation of K15t Scroll Exporter.

## Parameters

| Parameter | Required | Default | Notes |
| --- | --- | --- | --- |
| **template** | *No** | *Blank* | Parameter to specify a PDF template to be used for the export<br>> ℹ️ The **template** parameter is only valid if the K15t Scroll Exporter app is installed.<br>- if the template parameter is not specified, the bundled 'Documentation' template is used<br>Value can be one of:<br>- Template Name
- Template ID<br>*K15t recommend this parameter value to be added as the ****template id****. The ****template ID**** is found in the K15t Scroll PDF Exporter dashboard.*<br>If the specified template is not recognized, the exported PDF uses the bundled 'Documentation' template (the default template). |

> ℹ️ Use of the **template** parameter for the K15t Scroll Exporter app in the `pdf-export` macro<span style="color: #172b4d"> is only available with Comala Document Management </span><span style="color: #172b4d">**6.13**</span><span style="color: #172b4d"> or higher.</span>

## Setting a template when the macro is used with K15t Scroll Exporter

To specify a template to use for export, use the template name in the `pdf-export` macro as shown.

```
{pdf-export:template=Article}
```

> 📝 K15t recommends the use of the template ID.

You can find the value of the template ID by accessing the K15t Scroll PDF Exporter dashboard

- **Space Tools > Apps > Scroll PDF Exporter**

![image](media://d69f21a1-efdf-4b05-a75e-822400c91e8d)

- **Global Admin > Scroll PDF Exporter > Templates**

![image](media://0579b5ca-e64b-4e56-aaa8-d160ded04ad9)

- find the template you want to use (or create a new template)
- choose **Template Information** from the template ellipsis dropdown menu

![image](media://1c1014dd-0ac3-4642-b19d-8a4a4840aa10)

- copy template ID from the K15t app popup template information

![image](media://131bcd30-23fd-4d06-84fa-934f536c90b3)

- add to the `pdf-export` macro in the workflow trigger macro

If you have created or downloaded a new PDF template in the K15t PDF Exporter app, the template id will be in a slightly different format than the K15t app-supplied templates.

![image](media://bcc37b5b-0b51-4ca2-8dee-5353626fcd92)

Copy the hexadecimal template id from the **Template Information**.

![image](media://e1e6ebeb-cfe0-4c83-811e-100f83cf4587)

Paste the template id into the `pdf-export` macro in the trigger.

```
{pdf-export:template=4e0e8c19-67ac-4f3e-864e-1090d5ae0556}
```

## Basic example

```plaintext
{workflow:name=Export PDF on Approval}
   {state:Editing|submit=Review}
   {state}
   {state:Review|approved=Approved|rejected=Editing}
      {approval:Review}
   {state}
   {state:Approved|updated=Editing|final=true}
   {state}
   {trigger:statechanged|state=Approved}
      {pdf-export}
   {trigger}
{workflow}
```

The `state changed` event for the transition to the **Approved** state will add a PDF export of the current content as a file attachment to the current page. If no template name of id is specified, the K15t PDF Exporter app uses the default template.

- each occurrence adds a further PDF export attachment

![image](media://5b4c9a22-3575-49ba-8aae-b613b0fb48fd)

The exported PDF filename, by default, is generated as

- the content filename
- the *Confluence content version at the time of the export*
- and the date and time of the export.

The <span style="color: #1d1c1d">K15t admin can change the export filename structure.</span>

If the K15t app is unable to recognize a template id or name

- PDF export still occurs, but the default template will be used
- an on-screen message confirms the use of the default PDF export template

![image](media://71e832cc-e5e2-48e3-b8af-c78a28396b85)

## Events

The following [events](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649759655) are associated with `pdf-export`

- `pdf-export-success`
- `pdf-export-error`

## Example

```plaintext
{trigger:pdf-export-success}
	{set-message:style=success|duration=PT1M}
	pdf export successfully completed
	{set-message}
{trigger}
{trigger:pdf-export-error}
	{set-message:style=warning}
	pdf export failed. @errormessage@
	{set-message}
{trigger}
```

## See Also

**K15t Scroll PDF Exporter Atlassian Marketplace links**

- [https://marketplace.atlassian.com/apps/7019/scroll-pdf-exporter-for-confluence](https://marketplace.atlassian.com/apps/7019/scroll-pdf-exporter-for-confluence)
- [https://marketplace.atlassian.com/apps/1218322/comala-document-mgmt-for-scroll-exporter](https://marketplace.atlassian.com/apps/1218322/comala-document-mgmt-for-scroll-exporter)

**Related Comala Document Management documentation links**

- [Export space as a pdf](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649662664)
- [K15t Scroll PDF Exporter app](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649923655)
- [C](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649728423)[onfluence PDF and Word export](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649530727)
- [Export to Word and PDF - page tools](https://appfire.atlassian.net/wiki/spaces/CDML/pages/650315435)