Configure Custom Headers and Footers for PDF Report Exports

This article describes how you can customize the headers and footers used in PDF report and dashboard exports in your workspace. For example, you can insert your company’s copyright statement or include information on the source of the report.

You can specify a different header for the first page. The footer for the first page is applied to all the other pages.

In a header or footer value, you can use text strings or predefined macros.

For information about exporting, see Export Reports.

Standard Headers and Footers

The following picture shows a report exported to the PDF format.

The report contains the following standard (default) headers and footers:

  • Header 
    • Left: report name
    • Right: date of export
  • Footer 
    • Right: page number/pages in total

 Default Headers

You may specify custom headers and footers for:

  • First page of report or dashboard
  • All other pages of report or dashboard

Default header for first page

Left

Center

Right

%REPORT_NAME (for report exports), %DASHBOARD_NAME (for dashboard exports)

 

%%MM/%DD/%YYYY

Default header for other pages

Empty

Default Footers

Default footer for first page and all other pages

Left

Center

Right

 

 

Page %PAGE/%TOTAL_PAGES

Other defaults

By default, the same header and footer is applied to all pages. Optionally, you can specify a different header for the first page. The footer for the first page remains the same as the other pages.

The following defaults cannot be modified:

  • Font: Sans Serif (Arial or similar), 9 pt
  • Font color: #999999
  • Text length: the report/dashboard name are cut down to 50 characters maximum
  • Text alignment:
    • Left values are left-justified.
    • Center values are centered.
    • Right values are right-justified.
  • Left, right, and top margins: 0.39 in.
  • Padding: 0.13 in.

Macros

In a header or footer value, you can use text strings or predefined macros. You can insert macros inline with text references.

Names

Macro

Description

%PROJECT_NAME

The name of the workspace from which the report or dashboard is exported

%PROJECT_ID

The ID of the workspace from which the report or dashboard is exported

%REPORT_NAME

(Report export only) The name of the exported report

%REPORT_DESCRIPTION

(Report export only) The description of the exported report

%DASHBOARD_NAME

(Dashboard export only) The name of the exported dashboard

%TAB_NAME

(Dashboard export only) The name of the exported dashboard tab

Pages

Macro

Description

%PAGE

The number of the current page in the report or dashboard

%TOTAL_PAGES

The total number of pages in the report or dashboard

Date and Time

All date and time values indicate the moment when the report was generated. In the following table, values in parentheses are examples for March 07, 2014 at 2:04:05 p.m.

Macro

Description

%YYYY

Year (2014)

%YY

Year (14)

%MM

Month with a leading zero (03)

%M

Month (3)

%DD

Day of month with leading zero (07)

%D

Day of month (7)

%HH

Hour with leading zero in 24-hour format (14)

%H

Hour in 24-hour format (14)

%hh

Hour with leading zero in 12-hour format (02)

%h

Hour in 12-hour format (2)

%am

a.m. or p.m. (p.m.)

%mm

Minutes (04)

%ss

Seconds (05)

Execute the API Call

Call Type

PUT

End Point

/gdc/app/projects/[projectId]/export/pdfSettings

where [projectId] is the internal workspace identifier. This value can be retrieved via the GoodData Portal or API. For details, see Acquiring Object Identifiers for Workspace Metadata.

Body

The following sample is an example of the request body for the API call:

{
  "pdfexportsettings": {
    "dashboard": {
      "allpages": {
        "footer": {
          "left": "%PAGE of %TOTAL_PAGES",
          "right": "%YYYY-%DD-%MM"
        },
        "header": {
          "center": "Copyright 2017-2018",
          "left": "%DASHBOARD_NAME",
          "right": "%PROJECT_NAME"
        }
      },
      "firstpageoverride": {
        "header": {
          "left": "%DASHBOARD_NAME - %TAB_NAME",
          "right": "This is the first page."
        }
      }
    },
    "report": {
      "allpages": {
        "footer": {
          "left": "%PAGE of %TOTAL_PAGES",
          "right": "%MM/%DD/%YYYY",
          "center": "%REPORT_NAME"
        },
        "header": {
          "center": "Copyright 2017-2018",
          "left": "%REPORT_NAME",
          "right": "%PROJECT_NAME"
         }
        } 
      }
    }
  } 
}

 

This example contains parameters that describes the following properties of PDF report exports:

  • dashboards
    • all pages
      • header
      • footer
    • first page override
      • header
  • reports
    • all pages
      • header
      • footer
    • first page override
      • header

You specify headers and footers for all pages with optional overrides for the first page only.

Set a header or footer back to its default

If a header or footer is not specified explicitly in the API request body, the defaults are applied.

To clear a header or footer and set it back to its default, specify a blank value for the appropriate parameter in the request body.

Response

HTTP Status Code: 204

This status code indicates that there is no response returned from the server. 

To verify setting of these values, execute the same API call using the GET method.