PDF Manipulation API
"Empower Your Documents: Secure, Customize, and Control PDFs with the PDF Manipulation API."
Welcome to the PDF Manipulation API documentation. This API allows users to seamlessly create, modify, and enhance PDF documents. Whether you need to add watermarks, set password protection, or define permissions for your existing PDFs, our API provides a powerful and easy-to-use solution.
PDF Manipulation API Features
- Add Watermark: This API allow you to dynamically add customizable watermarks to existing PDF documents. You can Specify text, font, size, color, and position for personalized watermarks.
- Set Password Protection: Enhance document security by setting password protection for PDF files. Control access to sensitive information with customizable password requirements.
- Set Permissions: Define granular permissions for PDF documents, including read, write, and print capabilities. Tailor access rights to meet specific user or application requirements.
- Easy Integration: Seamlessly integrate the API into your application or workflow with clear and concise documentation.
- Standard Compliance: Adhere to industry standards for PDF documents while manipulating and customizing content. Generate PDFs that comply with PDF/A, PDF/X, and other relevant standards.
- Scalability: Scale your document manipulation needs effortlessly, whether handling a single document or a large batch. Optimize performance with a scalable and reliable API infrastructure.
- Regular Updates: Benefit from regular updates and improvements to the API. Stay current with the latest features, security enhancements, and performance optimizations.
These features collectively make the PDF Manipulation API a versatile and robust solution for developers looking to enhance, secure, and customize their PDF documents programmatically. By automating the PDF creation and manipulation process, businesses can free up valuable time and resources that can be directed towards other important tasks.
API Authentication Key
We use API keys to authenticate all the requests. You can view and manage your API keys in the My Account -> My APIs Center page. Your API keys can be used to access our all the APIs, So be sure to keep them secure. Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.
XXXX-XXXX-XXXX-XXXX (login to see your free API Key)
API Base URL and Endpoints
The API Base URL serves as the foundation or root of the API's endpoints. It represents the common prefix shared by all API endpoints. An Endpoint URL represents a specific operation or resource provided by the API. It is appended to the API Base URL to form a complete URL for a particular API call.
Base URL:
https://zerosack.org/marketplace/apis/v1
Endpoint to add watermark to PDFs:
POST /pdf_watermark
Endpoint to set security (password and permissions) to PDFs:
POST /pdf_security
API Request Method POST
This API use POST HTTP method to get data from our server. All API requests must be made over HTTPS ("S" stands for secure). Calls made over plain HTTP or without authentication key will not allowed.
Request Parameters
In APIs, request parameters are values that are sent along with an API request to provide additional information or data necessary for the server to process the request correctly. These parameters are part of the URL, the request headers, or the request body, depending on the API design and the HTTP method used.
For PDF Watermarking
Parameter | Description |
---|---|
key required |
This is your authentication api key to get requested data from our servers. This is mandatory parameter otherwise data request will be failed. Go to API Key. |
pdf_path required |
Specify the absolute file path or URL of the PDF document, ensuring that the PDF is not protected by a password.
Eg: https://www.africau.edu/images/default/sample.pdf
|
watermark_text required |
Watermark Data (in text format). Additionally you can utilize the newline character \n in between the lines to break the line and start from new line.
Eg: john deo \n from MIT
|
watermark_text_size optional |
Set the watermark text size (in pixels). Eg: 60
|
watermark_text_color optional |
Specify the RGB color values (in rgb(0,0,0) format). Value between 0 and 255. Default Eg: 192, 192, 192
|
watermark_text_location optional |
Specify the precise location of the watermark on each page of a PDF file by providing the X and Y coordinates (in (X, Y) position). Default Eg: 0, 160
|
watermark_text_rotation optional |
Rotation of watermark text. Range from 0 to 360 degree. Default Eg: 0
|
For PDF Security
Parameter | Description |
---|---|
key required |
This is your authentication api key to get requested data from our servers. This is mandatory parameter otherwise data request will be failed. Go to API Key. |
pdf_path required |
Specify the absolute file path or URL of the PDF document, ensuring that the PDF is not protected by a password.
Eg: https://www.africau.edu/images/default/sample.pdf
|
permissions required |
Permissions that can be set to control various actions that users can perform with the PDF file (in comma separated values format).
Eg: copy, print . See complete list.
Here is a list of common permissions along with their meanings:
|
user_password optional |
Make PDF file encrypted by adding user password to it. If a user password is set, user will be prompted before document is opened. Eg: john123
|
owner_password optional |
Make PDF file encrypted and restriction free by adding owner password to it. If an owner password is set, document can be opened in privilege mode with no restriction if that password is entered. Eg: owner123
|
Example Post Data Request for pdf_watermark API (in Json format)
{
"key": "XXXX-XXXX-XXXX-XXXX (login to see your free API Key)",
"pdf_path": "https:\/\/www.africau.edu\/images\/default\/sample.pdf",
"watermark_text": "Confidential Document"
}
Example Post Data Request for pdf_security API (in Json format)
{
"key": "XXXX-XXXX-XXXX-XXXX (login to see your free API Key)",
"pdf_path": "https:\/\/www.africau.edu\/images\/default\/sample.pdf",
"permissions": "copy, print",
"user_password": "john123",
"owner_password": "owner123"
}
Response Format
API response format refers to the format in which data is returned from an API endpoint after a request is made. We use JSON format for API response data. JSON (JavaScript Object Notation): JSON is a lightweight data interchange format that is easy to read and write. It is widely used for API response data because it is easy to parse and manipulate in many programming languages.
Example Response
Below response data in JSON format with base64 string data for manipulated PDF file. You can convert this base64 string into PDF file using any language (like: JavaScript, PHP, Etc.), and save it to your server or download it directly into your project.
{
"status": 1,
"status_message": "success",
"body": {
"pdf_base64_string": "JVBERi0xLjQKJeLjz9MKMyAwIG9iago8PC9UeXBlIC9QYWdlCi9QYXJlbnQgMS ....."
}
}
In this effective response, the variable "base64_string" represents an PDF file encoded in base64 string format. In a successful scenario "status" : 1
, a single API credit call/request is deducted from your account.
However, in the event of failure or any other condition, you will receive a "status" : 0
, and in such cases, no API credit calls/requests will be counted against your account.
Sample Code
You can use our api with any programming language as well which can handle http GET requests. Here are some sample code snippets for making a GET request to an API endpoint in multiple programming languages:
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var postData = JSON.stringify({
"key": "XXXX-XXXX-XXXX-XXXX (login to see your free API Key)",
...,
...
});
var requestOptions = {
method: "POST",
headers: myHeaders,
body: postData
};
fetch("https://zerosack.org/marketplace/apis/v1/pdf_watermark", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log("error", error));
$curl = curl_init();
$postData = json_encode(
[
"key" => "XXXX-XXXX-XXXX-XXXX (login to see your free API Key)",
...,
...
]
);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://zerosack.org/marketplace/apis/v1/pdf_watermark",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $postData,
CURLOPT_HTTPHEADER => array("Content-Type: application/json"),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
import json
url = "https://zerosack.org/marketplace/apis/v1/pdf_watermark"
payload = json.dumps({
"key": "XXXX-XXXX-XXXX-XXXX (login to see your free API Key)",
...,
...
})
headers = {"Content-Type": "application/json"}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://zerosack.org/marketplace/apis/v1/pdf_watermark");
request.Headers.Add("Cookie", "PHPSESSID=st6pbm0imcng6n3k8ju6pvg3j3");
var content = new StringContent("{\r\n \"key\": \"XXXX-XXXX-XXXX-XXXX (login to see your free API Key)\",\r\n ..., ...}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Also you can use Postman platform which enables you to create mock servers to assist with API development and testing. A mock server simulates the behavior of a real API server by accepting requests and returning responses. By adding a mock server to your collection and adding examples to your requests, you can simulate the behavior of a real API.
Do you Need Help? Contact us.
Disclaimers: This APIs is provided "as is" without warranty of any kind. If you have issue / feedback / bug report regarding the same, You can reach out to us.