Body parameters
Attributes |
Description |
Type |
Required |
fileURL |
Direct download link of the PDF file |
text |
true |
searchString |
Search string |
text |
true |
excludeKeyPages |
Exclude Key Pages |
boolean |
false |
regexSearch |
If regexSearch is set to true then searchString will behave as regular expression. |
boolean |
false |
caseSensitive |
|
boolean |
false |
pdf_password |
Enter the password if pdf is password protected. |
text |
false |
PDF File Input:
Available Method
Method | POST |
URL /split-pdf-by-text |
Headers | Content-Type: application/octet-stream |
Query Parameters
Attributes |
Description |
Type |
Required |
searchString |
Search string |
text |
true |
excludeKeyPages |
Exclude Key Pages |
boolean |
false |
regexSearch |
If regexSearch is set to true then searchString will behave as regular expression. |
boolean |
false |
caseSensitive |
|
boolean |
false |
pdf_password |
Enter the password if pdf is password protected. |
text |
false |
Body - Request body will contain PDF File binary
Example Request
curl -X POST 'https://pdf.msquare.pro/split-pdf-by-text?appName=DocCrafter' \
-H 'content-type: application/json' \
-H 'authorization: ***' \
-d '{
"fileURL": "https://file-examples.com/storage/fe165662b6657a0549b59ee/2017/10/file-sample_150kB.pdf",
"searchString": "test"
}'
3.ENCRYPT PDF
PDF File URL Input:
Available Method
Method | POST |
URL | /secure-pdf |
Headers | Content-Type: application/json |
Body parameters
Attributes |
Description |
Type |
Required |
fileURL |
Direct download link of the PDF file |
text |
true |
pdf_password |
Enter the password if pdf is password protected. |
text |
false |
Example Request
curl -X POST 'https://pdf.msquare.pro/secure-pdf?appName=DocCrafter' \
-H 'Content-Type: application/json' \
-H 'Authorization: YOUR_AUTHORIZATION_TOKEN' \
-d '{
"fileURL": "https://royalegroupnyc.com/wp-content/uploads/seating_areas/sample_pdf.pdf",
"pdf_password": "1234"
}'
PDF File Input:
Available Method
Method | POST |
URL | /secure-pdf |
Headers | Content-Type: multipart/form-data |
Body Parameters
Attributes |
Description |
Type |
Required |
file |
PDF File |
file |
True |
pdf_password |
Enter password to encrypt pdf. |
text |
True |
4.Add Text and Images to a PDF
Overview
Request
PDF File URL Input:
Input Parameters
Method | POST |
URL | /add-content-to-pdf |
Headers | Content-Type: application/json |
Body Parameter
Attributes |
Description |
Type |
Required |
fileURL |
File name, including the extension, e.g.invoice.pdf |
text |
true |
pdf_password |
Enter the password if pdf is password protected. |
text |
false |
parameters_data |
Refer to parameters data specification. |
text |
false |
PDF File Input:
Method | POST |
URL | /add-content-to-pdf |
Headers | Content-Type: application/json |
Body Parameter
Attributes |
Description |
Type |
Required |
file |
PDF File data in base64 format |
base64 |
true |
pdf_password |
Enter the password if pdf is password protected. |
text |
false |
parameters_data |
Refer to parameters data specification. |
text |
false |
Parameters Data Specification:
The parameters_data object consists of two main sections: text_parameters and image_parameters.
Text Parameters:
The text_parameters array contains details for inserting text elements.
-
link (string): Link associated with the text (optional).
-
text (string): The text content to be displayed.
-
font_bold (boolean): Set to true if the text should be bold.
-
font_name (string): Font family or name for the text.
-
font_size (number): Font size of the text.
-
text_type (string): Type of text element (e.g., text, heading, etc.).
-
font_color (string): Color code for the text (hexadecimal format).
-
font_italic (boolean): Set to true if the text should be italicized.
-
x_coordinate (number): X-coordinate position of the text.
-
y_coordinate (number): Y-coordinate position of the text.
-
font_strikeout (boolean): Set to true if the text should have a strikeout effect.
-
font_underline (boolean): Set to true if the text should be underlined.
-
target_page_range (string): The target page range for the text element.
Image Parameters:
The image_parameters array contains details for inserting image elements.
-
link (string): Link associated with the image (optional).
-
image_url (string): URL of the image to be displayed.
-
image_width (number): Width of the image.
-
image_height (number): Height of the image.
-
x_coordinate (number): X-coordinate position of the image.
-
y_coordinate (number): Y-coordinate position of the image.
-
target_page_range (string): The target page range for the image element.
parameters_data structure
"parameters_data": {
"text_parameters": [
{
"link": "https://example.com",
"text": "This is a test",
"font_bold": true,
"font_name": "Calibri",
"font_size": 12,
"text_type": "text",
"font_color": "#000000",
"font_italic": true,
"x_coordinate": 100,
"y_coordinate": 200,
"font_strikeout": true,
"font_underline": true,
"target_page_range": "1"
}
],
"image_parameters": [
{
"link": "https://example.com",
"image_url": "https://example.com/image.png",
"image_width": 200,
"image_height": 100,
"x_coordinate": 10,
"y_coordinate": 20,
"target_page_range": "1"
}
]
}
Example Request
curl -X POST 'https://pdf.msquare.pro/add-content-to-pdf?appName=DocCrafter'
-H 'content-type: application/json'
-H 'authorization: ***'
-d '{
"fileURL":"https://example.com/doc/file.pdf",
"parameters_data":{"text_parameters":[{"link":"https://example.com","text":"This is a test","font_bold":true,"font_name":"Calibri","font_size":12,"text_type":"text","font_color":"#000000","font_italic":true,"x_coordinate":100,"y_coordinate":200,"font_strikeout":true,"font_underline":true,"target_page_range":"1"}],"image_parameters":[{"link":"https://example.com","image_url":"https://example.com/image.png","image_width":200,"image_height":100,"x_coordinate":10,"y_coordinate":20,"target_page_range":"1"}]}
}'