Add Header and Footer to PDF

Open in ChatGPT Open in ChatGPT to ask questions about this page
Open in Claude Open in Claude to ask questions about this page
Copy as MarkdownCopy this page as markdown to use with AI assistants
View as Markdown Open this page as markdown in a new tab

Adds a header, a footer, or both to a page range of a PDF, replacing any existing headers and footers, and makes the modified PDF available for download.


Font Precedence: A zone's font_name and font_size override font_settings for that zone.

Endpoint

OAuth Scope

ZohoWriter.pdfEditor.ALLCopied!

Request Example

cURL
cURL
Java
Python
Deluge
Copied!
curl --request POST \
  --url https://www.zohoapis.com/pdfeditor/api/v1/pdf/content/headerfooter \
  --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' \
  --header 'content-type: multipart/form-data' \
  -F 'file=@file_path' \
  -F 'input_options={
  "header_options": [
    {
      "position": "center",
      "text": "<<Page 1 of n>>",
      "font_name": "roboto_bold",
      "font_size": 10
    }
  ],
  "footer_options": [
    {
      "position": "left",
      "text": "<<yyyy-mm-dd>>",
      "font_name": "roboto",
      "font_size": 9
    }
  ],
  "font_settings": {
    "font_name": "roboto",
    "font_size": 10
  },
  "margins": {
    "margin_top": 15,
    "margin_bottom": 10,
    "margin_left": 10,
    "margin_right": 15
  },
  "page_range": {
    "start_page": 1
  }
}' \
  -F 'password=OpenSesame123'

Request Body

multipart/form-data
filebinary(Required)

The source PDF to add headers/footers to, uploaded directly or imported from a publicly accessible URL. The file must be no larger than 50 MB, contain no more than 400 pages, and have no page larger than 2,400 square inches. Its filename must not exceed 255 characters. Supported formats: pdf.

Example
quarterly-review.pdf
input_optionsJSON Object(Required)

Configures the header and footer text, styling, and page range. At least one setting must be provided.

Example
{
  "header_options": [
    {
      "position": "center",
      "text": "<<Page 1 of n>>",
      "font_name": "roboto_bold",
      "font_size": 10
    }
  ],
  "footer_options": [
    {
      "position": "left",
      "text": "<<yyyy-mm-dd>>",
      "font_name": "roboto",
      "font_size": 9
    }
  ],
  "font_settings": {
    "font_name": "roboto",
    "font_size": 10
  },
  "margins": {
    "margin_top": 15,
    "margin_bottom": 10,
    "margin_left": 10,
    "margin_right": 15
  },
  "page_range": {
    "start_page": 1
  }
}
Show Sub-Attributes
header_optionsJSON Array[object](Optional)

Up to 3 header entries, one per zone (left, center, right).

Example
[
  {
    "position": "center",
    "text": "<<Page 1 of n>>",
    "font_name": "roboto_bold",
    "font_size": 10
  }
]
Range :[0 .. 3][0 .. 3]
Show Sub-Attributes
positionstring(Required)

Which zone of the header this entry occupies. If more than one entry targets the same zone, the last one in the array wins.

Example
center
Allowed Values :
Show Values ▾
leftCopied!
centerCopied!
rightCopied!
Copied!Copy all as JSON Array
textstring(Optional)

The header text for this zone. Static text can be combined with page number or date macros in the same value.
Page number macros: <<1>>, <<1 of n>>, <<1/n>>, <<Page 1>>, <<Page 1 of n>>.
Date macros, which insert the current date: slash-separated (e.g. <<m/d>>, <<mm/dd/yyyy>>, <<d/m/yy>>, <<dd/mm/yyyy>>, <<mm/yyyy>>), dot-separated (e.g. <<m.d.yy>>, <<mm.dd.yyyy>>, <<d.m.yyyy>>, <<dd.mm.yy>>, <<mm.yyyy>>), and dash-separated (<<yy-mm-dd>>, <<yyyy-mm-dd>>).
The text cannot contain #.

Example
<<Page 1 of n>>
Maximum Length :500500Copied!
font_namestring(Optional)

The font for this zone.

Example
roboto_bold
Allowed Values :
Show Values ▾
robotoCopied!
roboto_boldCopied!
roboto_italicCopied!
roboto_bold_italicCopied!
open_sansCopied!
open_sans_boldCopied!
open_sans_italicCopied!
open_sans_bold_italicCopied!
latoCopied!
lato_boldCopied!
lato_italicCopied!
lato_bold_italicCopied!
montserratCopied!
montserrat_boldCopied!
montserrat_italicCopied!
montserrat_bold_italicCopied!
ralewayCopied!
raleway_boldCopied!
raleway_italicCopied!
raleway_bold_italicCopied!
nunitoCopied!
nunito_boldCopied!
nunito_italicCopied!
nunito_bold_italicCopied!
poppinsCopied!
poppins_boldCopied!
poppins_italicCopied!
poppins_bold_italicCopied!
Copied!Copy all as JSON Array
font_sizenumber(Optional)

The font size for this zone.

Example
10
font_settingsJSON Object(Optional)

Document-wide font defaults for all header and footer zones.

Example
{
  "font_name": "roboto",
  "font_size": 10
}
Show Sub-Attributes
font_namestring(Optional)

The default font for all header and footer zones.

Example
roboto
Allowed Values :
Show Values ▾
robotoCopied!
roboto_boldCopied!
roboto_italicCopied!
roboto_bold_italicCopied!
open_sansCopied!
open_sans_boldCopied!
open_sans_italicCopied!
open_sans_bold_italicCopied!
latoCopied!
lato_boldCopied!
lato_italicCopied!
lato_bold_italicCopied!
montserratCopied!
montserrat_boldCopied!
montserrat_italicCopied!
montserrat_bold_italicCopied!
ralewayCopied!
raleway_boldCopied!
raleway_italicCopied!
raleway_bold_italicCopied!
nunitoCopied!
nunito_boldCopied!
nunito_italicCopied!
nunito_bold_italicCopied!
poppinsCopied!
poppins_boldCopied!
poppins_italicCopied!
poppins_bold_italicCopied!
Copied!Copy all as JSON Array
Default Value :robotorobotoCopied!
font_sizenumber(Optional)

The default font size for all header and footer zones.

Example
10
Default Value :1010Copied!
marginsJSON Object(Optional)

Document-wide margins, in millimeters, applied to the header and footer.

Example
{
  "margin_top": 15,
  "margin_bottom": 10,
  "margin_left": 10,
  "margin_right": 15
}
Show Sub-Attributes
margin_topnumber(Optional)

The top margin, in millimeters, reserved for the header.

Example
15
Default Value :1515Copied!
margin_bottomnumber(Optional)

The bottom margin, in millimeters, reserved for the footer.

Example
10
Default Value :1010Copied!
margin_leftnumber(Optional)

The left margin, in millimeters, for header/footer text.

Example
10
Default Value :1010Copied!
margin_rightnumber(Optional)

The right margin, in millimeters, for header/footer text.

Example
15
Default Value :1515Copied!
page_rangeJSON Object(Optional)

Configures the starting page for the header/footer.

Example
{
  "start_page": 1
}
Show Sub-Attributes
start_pageinteger(Optional)

The first page the header and footer are applied to. They apply from this page through the last page.

Example
1
Default Value :11Copied!
passwordstring(Optional)

The password to unlock the source PDF, if it is password-protected.

Example
OpenSesame123
Maximum Length :255255Copied!

Body Parameters

Copied!
// Note: payload contains multiple type attributes

// type: file
file = quarterly-review.pdf

// type: object
input_options = {
  "header_options": [
    {
      "position": "center",
      "text": "<<Page 1 of n>>",
      "font_name": "roboto_bold",
      "font_size": 10
    }
  ],
  "footer_options": [
    {
      "position": "left",
      "text": "<<yyyy-mm-dd>>",
      "font_name": "roboto",
      "font_size": 9
    }
  ],
  "font_settings": {
    "font_name": "roboto",
    "font_size": 10
  },
  "margins": {
    "margin_top": 15,
    "margin_bottom": 10,
    "margin_left": 10,
    "margin_right": 15
  },
  "page_range": {
    "start_page": 1
  }
}

// type: string
password = OpenSesame123
▼ Show full

Response Example

200
Copied!
  {
    "status": "inprogress",
    "status_check_url": "https://www.zohoapis.com/pdfeditor/api/v1/pdf/content/headerfooter/job/3f65c7592a741d98e46bf310cbe678f574a1d51fce306a8d9b6430217e538acd"
  }
                
▼ Show full

Rate Limits

Duration1 minute
Threshold50
Lock Period5 minutes 30 seconds
Duration1 hour
Threshold200
Lock Period15 minutes
Duration1 day
Threshold2000
Lock Period2 hours

Duration - Time window for the threshold.
Threshold - Number of API calls allowed within the specified duration.
Lock Period - Wait time before consecutive API requests.