logo

Overview

The DocuGenius Split PDF by Page Index module allows users to split a PDF document based on specified page ranges.

This module supports two input types: PDF File URL and PDF File.

1.SPLIT PDF BY PAGE INDEX

Available Methods

Method POST
Endpoint:/split-pdf-by-page
HeadersContent-Type: application/x-www-form-urlencoded

PDF File URL Input:

Query parameters

Attributes Description Type Required
fileURL Direct download link of the PDF file text true
page_ranges e.g. 1, 2-3, 4-, 1,2-3,4- text true
pdf_password Enter the password if PDF is password protected text false

Body - Request body will be empty.

Example Request

curl -X POST 'https://pdf.msquare.pro/split-pdf-by-page?appName=DocCrafter&fileURL=https://file-examples.com/storage/fe165662b6657a0549b59ee/2017/10/file-sample_150kB.pdf&page_ranges=1-3' \
                        -H 'authorization: ***' \
                        -H 'content-type: application/x-www-form-urlencoded' \
                        -d '{}'
                      

PDF File Input:

Available Methods

Method POST
Endpoint:/split-pdf-by-page
HeadersContent-Type: application/octet-stream

Query Parameters

Attributes Description Type Required
page_ranges e.g. 1, 2-3, 4-, 1,2-3,4- text true
pdf_password Enter the password if PDF is password protected text false

Body - Request body will contain PDF File binary


2.SPLIT PDF BY TEXT

Overview

This document provides guidance on using the API, specifically for the "split-pdf-by-text" endpoint. The API supports two input types: PDF File URL and PDF File Data.

PDF File URL Input:

Available Method

URL
Method POST
/split-pdf-by-text
HeadersContent-Type: application/json

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

URL
Method POST
/split-pdf-by-text
HeadersContent-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.

Image Parameters:

The image_parameters array contains details for inserting image elements.

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"}]}
                    }'