English
  1. Home
  2. Page
  3. Number

Number

Add page numbers to PDF document

copy
Something went wrong, try again
copy
            
                    
        
Body parameter
Parameter VALUE DESCRIPTION

pageNumberRequest

Required

copy
PageNumberRequest NumberPageRequest Instance
PageNumberRequest
Parameter VALUE DESCRIPTION

PdfBase64File

Required

close-icon
string Base64 encoded PDF document to process

Alignment

Optional

Alignment Number alignment. Can be Left, Center or Right. Center by default. (Optional)

FirstNumber

Optional

int32 The first number of the first page to be numbered. Default is 1. (Optional)

FontSize

Optional

float Font size. Default is 14. (Optional)

Margin

Optional

double Margin. Default is 20. (Optional)

PageFrom

Optional

int32 The first page number to be numbered. Default is 1. (Optional)

PageTo

Optional

int32 The last page number to be numbered. Last page of the document if not specified. (Optional)

Position

Optional

Position Position of number. Can be Top or Bottom. Bottom by default. (Optional)

Template

Optional

string ext template. "[n]" - current page number. "[p]" - Document page count. Example: "Page [n] of [p]". Default is "[n]" (Optional)
copy Copy to clipboard
        
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.conholdate.cloud/v5.0/pdf/page/number"
  method := "POST"

  payload := strings.NewReader(`{
      "PageFrom": 1,
      "PageTo": 1,
      "Position": "Top",
      "Alignment": "Left",
      "FirstNumber": 1,
      "Template": "some value",
      "FontSize": 12.3,
      "Margin": 12.3,
      "PdfBase64File": "Base64 encoded file...",
    }`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
                   
         
            
File file = new File("path/to/file/fileName.pdf");
byte[] encoded = Base64.encodeBase64(FileUtils.readFileToByteArray(file));
String base64EncodedFile = new String(encoded, StandardCharsets.US_ASCII);

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, 
    "{" +
      "\"PageFrom\": 1," +
      "\"PageTo\": 1," +
      "\"Position\": \"Top\"," +
      "\"Alignment\": \"Left\"," +
      "\"FirstNumber\": 1," +
      "\"Template\": \"\some value\"," +
      "\"FontSize\": 12.3," +
      "\"Margin\": 12.3," +
      "\"PdfBase64File\": \"" + base64EncodedFile + "\"," +
    "}");

Request request = new Request.Builder()
  .url("https://api.conholdate.cloud/v5.0/pdf/page/number")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .build();

Response response = client.newCall(request).execute();
                   
        
            
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.conholdate.cloud/v5.0/pdf/page/number',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS =>'{
      "PageFrom": 1,
      "PageTo": 1,
      "Position": "Top",
      "Alignment": "Left",
      "FirstNumber": 1,
      "Template": "some value",
      "FontSize": 12.3,
      "Margin": 12.3,
      "PdfBase64File": "Base64 encoded file...",
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
                   
        
            
import requests
import json

url = "https://api.conholdate.cloud/v5.0/pdf/page/number"

json_data = json.dumps({
      "PageFrom": 1,
      "PageTo": 1,
      "Position": "Top",
      "Alignment": "Left",
      "FirstNumber": 1,
      "Template": "some value",
      "FontSize": 12.3,
      "Margin": 12.3,
      "PdfBase64File": "Base64 encoded file...",
})
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=json_data)

print(response.text)
                   
        
            
curl --location --request POST 'https://api.conholdate.cloud/v5.0/pdf/page/number' \
--header 'Content-Type: application/json' \
--data-raw '{
      "PageFrom": 1,
      "PageTo": 1,
      "Position": "Top",
      "Alignment": "Left",
      "FirstNumber": 1,
      "Template": "some value",
      "FontSize": 12.3,
      "Margin": 12.3,
      "PdfBase64File": "Base64 encoded file...",
}'
                   
        
            
require "uri"
require "json"
require "net/http"

url = URI("https://api.conholdate.cloud/v5.0/pdf/page/number")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request.body = JSON.dump({
      "PageFrom": 1,
      "PageTo": 1,
      "Position": "Top",
      "Alignment": "Left",
      "FirstNumber": 1,
      "Template": "some value",
      "FontSize": 12.3,
      "Margin": 12.3,
      "PdfBase64File": "Base64 encoded file...",
})

response = https.request(request)
puts response.read_body

                   
        
            
var client = new RestClient("https://api.conholdate.cloud/v5.0/pdf/page/number");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
var body = "{" + 
      "\"PageFrom\": 1," +
      "\"PageTo\": 1," +
      "\"Position\": \"Top\"," +
      "\"Alignment\": \"Left\"," +
      "\"FirstNumber\": 1," +
      "\"Template\": \"\some value\"," +
      "\"FontSize\": 12.3," +
      "\"Margin\": 12.3," +
      "\"PdfBase64File\": \"" + base64EncodedFile + "\"," +
"}";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
                       
            
Overview

About Number Method

This page provides detailed instructions on how to utilize our powerful cloud-based API for adding numerations to PDF files in a variety of programming languages, such as Go, Java, PHP, Python, Curl, Ruby, and C#. Our versatile Document API offers a seamless "Number" method, enabling you to effortlessly incorporate page numeration into your PDF documents.


Programming languages the API is compatible with

The API uses the REST protocol, making it compatible with a wide range of programming languages, including but not limited to: Go, Java, PHP, Python, Curl, Ruby, C#.

Easy to use

Our API Reference and Guide is designed to be straightforward and easy to use, providing all the information you need to get started quickly. Additionally, our API Libraries come with their own set of documentation, making integration into your application a breeze. With our comprehensive resources, you can efficiently leverage our API to meet your needs.

Secure

At our company, we place a high priority on your security and privacy. To protect your private data, we never store it in our environment and offer isolated options. We understand the importance of keeping your information safe and take all necessary measures to ensure that it remains secure.
Add Page Number
clock
Add a File
To ensure smooth file processing and accurate page numbering using the "Number" method (Page API), it is crucial to verify that the file you are working with matches the one specified in the method. This guarantees that the page numbering is applied correctly to the intended PDF file, ensuring a successful outcome.
arrow
clock
Run the Code
To run the code, copy and paste it into a file and execute it from the same directory where you added the necessary files. For further details, refer to our language-specific guides on how to get started.
arrow
clock
View the Result
To access the results, just open the output file which should be located in your project folder. If you opt for using the "Number" method online, after the page numbering process is completed, the file will be automatically downloaded for your convenience.
clock
How long does it takes to add page numbers into PDF file using Number method (Page API)?
Page API (Number method) is designed for efficient and speedy file process. With our service, you can expect fast results, often in just a matter of seconds.
clock
It is safe to add page numbers into a PDF file using Page API?
We understand the importance of ensuring the safety and privacy of your data. Rest assured that our company takes extensive measures to protect your information. We do not store any files you submit for getting metadata and process them only to provide you with the results. Your security and confidentiality are our utmost priorities.
clock
What output can I expect from the "Number" method (Page API)?
The "Number" method (Page API) is designed to enable you to add page numbering to your PDF files. This functionality allows you to conveniently label and organize your document's pages. Once the page numbering process is complete, you will receive your PDF file with numbered pages, making it easier for users to locate specific content within the document. The "Number" method empowers you to efficiently enhance the usability and navigation of your PDF files.
clock
How does method “Number” (Page API) works?
Experience the convenience of our user-friendly process for adding page numbering to your PDF file. Simply upload your file, click the "POST" button, and wait for the results. Within seconds, you'll receive a file with page numbering applied. To integrate this method into your project, utilize the provided code examples, easily copy and use them in the programming language of your choice. Our seamless process streamlines the incorporation of page numbering into your PDF files, making it a breeze to enhance the usability and organization of your documents.
FAQ

Frequently Asked Questions

We encourage you to review our Frequently Asked Questions (FAQ) section for answers to common inquiries. If you do not find the information you need, our dedicated support service is readily available to assist you with any additional questions or concerns. Don't hesitate to reach out for further assistance.