FileVerbs API Documentation - PDF Manipulation

PDF Manipulation

PDF Manipulation

The FileVerbs PDF API provides a variety of tools to manipulate and transform your PDF documents. These tools include merging, splitting, adding watermarks, headers, footers, and more. Below are the available manipulation options and their respective API request formats, along with optional settings where applicable.

Available PDF Manipulation Actions

Merge PDF Documents

Merge multiple PDF documents into a single file.

Request Example (JSON):

{
    "customId": "123467890",
    "action": "PdfMerge",
    "parameters": {
        "fileIds": ["66b357061b7f9c2032d6d70f", "66b357061b7f9c2032d6d70f"]
    }
}

Split PDF

Split a PDF into multiple smaller files based on page ranges.

Request Example (JSON):

{
    "customId": "123467890",
    "action": "PdfSplit",
    "parameters": {
        "fileIds": ["66b357061b7f9c2032d6d70f"]
    }
}

Add Watermark to PDF

Add a text or image watermark to a PDF document. The following optional settings can be applied:

  • text (optional): The text to display as a watermark.
  • fontSize (optional, default: `12`): Font size for the watermark text.
  • foregroundColor (optional): Set the color of the watermark text in hex format (e.g., `#FF0000` for red).
  • fontName (optional): The font used for the watermark text. Supported values:
    • Times New Roman
    • Arial
    • Courier New
    • Helvetica
    • Verdana
    • Calibri
    • Georgia
    • Tahoma
    • Trebuchet MS
    • Comic Sans MS
  • horizontalAlignment (optional, default: `None`): Align the watermark text horizontally. Supported values:
    • None
    • Left
    • Center
    • Right
    • Justify
    • FullJustify
  • verticalAlignment (optional, default: `None`): Align the watermark text vertically. Supported values:
    • None
    • Top
    • Center
    • Bottom
  • rotation (optional, default: `0`): Set the rotation angle of the watermark in degrees. Supported values: `0`, `90`, `180`, `270`.
  • opacity (optional, default: `1.0`): Set the opacity of the watermark. Range is from `0.0` (fully transparent) to `1.0` (fully opaque).
  • isBackground (optional): If true, the watermark will be added in the background; otherwise, it will appear in the foreground.

Request Example (JSON):

{
    "action": "PdfWatermark",
    "parameters": {
        "fileIds": ["66b357061b7f9c2032d6d70f"],
        "options": {
            "watermarkSettings": {
                "text": "Confidential",
                "fontSize": 24,
                "foregroundColor": "#FF0000",
                "fontName": "Arial",
                "horizontalAlignment": "Center",
                "verticalAlignment": "Top",
                "rotation": 90,
                "opacity": 0.5,
                "isBackground": true
            }
        }
    }
}

Add Page Numbers to PDF

Add page numbers to your PDF document. The following optional settings can be applied:

  • format (optional, default: `"Page {0} of {1}"`): Define the format for the page numbers.
  • startingNumber (optional, default: `1`): Set the starting page number.

Request Example (JSON):

{
    "action": "PdfPageNumber",
    "parameters": {
        "fileIds": ["66b357061b7f9c2032d6d70f"],
        "options": {
            "pageNumberSettings": {
                "format": "Page {0} of {1}"
            }
        }
    }
}

Delete Pages from PDF

Delete specified pages from a PDF document.

Request Example (JSON):

{
    "action": "PdfDeletePage",
    "parameters": {
        "fileIds": ["66b357061b7f9c2032d6d70f"],
        "options": {
            "pagesToDelete": [2, 4]
        }
    }
}

Add Background to PDF

Add a background image or color to your PDF document. The following optional settings can be applied:

  • backgroundImageFileId (optional): File ID of the image to use as the background.

Request Example (JSON):

{
    "action": "PdfBackground",
    "parameters": {
        "fileIds": ["66b357061b7f9c2032d6d70f"],
        "options": {
            "backgroundImageFileId": "66ba2232056a00eb4db166bc"
        }
    }
}

Rotate PDF Pages

Rotate specific pages of a PDF document by 90, 180, or 270 degrees. The following options are available:

  • None: No rotation (default).
  • on90: Rotate the page 90 degrees clockwise.
  • on180: Rotate the page 180 degrees.
  • on270: Rotate the page 270 degrees clockwise.

Request Example (JSON):

{
    "action": "PdfRotation",
    "parameters": {
        "fileIds": ["66b357061b7f9c2032d6d70f"],
        "options": {
            "rotation": "on90"
        }
    }
}

Compress PDF

Compress a PDF document to reduce its file size. The following optional settings can be applied:

  • resolution (optional, default: `150`): The resolution of the compressed PDF in DPI (Dots Per Inch). Lower resolution results in smaller file sizes but lower quality.
  • imageQuality (optional, default: `75`): The quality of images in the PDF after compression. The range is from `0` (lowest quality, smallest size) to `100` (highest quality, largest size).

Request Example (JSON):

{
    "action": "PdfCompress",
    "parameters": {
        "fileIds": ["66b357061b7f9c2032d6d70f"],
        "options": {
            "pageCompressionSettings": {
                "resolution": 100,
                "imageQuality": 50
            }
        }
    }
}

Split PDF by Bookmark

Split a PDF into separate documents based on its bookmark structure (typically top-level bookmarks).

Request Example (JSON):

{
  "action": "PdfSplitByBookmark",
  "parameters": {
    "fileIds": ["66b357061b7f9c2032d6d70f"]
  }
}

Reorder PDF Pages

Reorder the pages of a PDF document based on a custom page order.

  • order: A list of integers specifying the new page order (e.g., [3, 1, 2]).

Request Example (JSON):

{
  "action": "PdfPageReorder",
  "parameters": {
    "fileIds": ["66b357061b7f9c2032d6d70f"],
    "options": {
      "reorderSettings": {
        "order": [3, 1, 2]
      }
    }
  }
}

Flatten PDF

Flatten PDF annotations and form fields, making them non-editable. This is useful for preventing further modifications.

Request Example (JSON):

{
  "action": "PdfFlatten",
  "parameters": {
    "fileIds": ["66b357061b7f9c2032d6d70f"]
  }
}

Add Comments to PDF

Add annotations or sticky notes to specific pages and positions in your PDF.

  • page: Page number to add the comment to.
  • x: X-coordinate position for the comment.
  • y: Y-coordinate position for the comment.
  • text: The content of the comment.

Request Example (JSON):

{
  "action": "PdfAddComment",
  "parameters": {
    "fileIds": ["66b357061b7f9c2032d6d70f"],
    "options": {
      "commentSettings": [
        { "page": 1, "x": 50, "y": 100, "text": "Please review this section." }
      ]
    }
  }
}

Delete Comments from PDF

Remove existing annotations or comments from a PDF document. You can delete all comments, or target specific ones based on text or page.

  • deleteAll (optional, default: false): Set to true to delete all comments from the document.
  • textContains (optional): If provided, only comments that contain this text will be deleted.
  • page (optional): If provided, comments will be deleted only from this page. Must be a positive integer.

Note: At least one of deleteAll, textContains, or page must be specified. You can combine filters to narrow the deletion scope (e.g., delete comments containing specific text on a particular page).

Request Example (Delete All Comments)

{
  "action": "PdfDeleteComment",
  "parameters": {
    "fileIds": ["66b357061b7f9c2032d6d70f"],
    "options": {
      "deleteAll": true
    }
  }
}

Request Example (Delete Comments Containing Specific Text)

{
  "action": "PdfDeleteComment",
  "parameters": {
    "fileIds": ["66b357061b7f9c2032d6d70f"],
    "options": {
      "textContains": "review"
    }
  }
}

Request Example (Delete Comments on Page 2 Containing Specific Text)

{
  "action": "PdfDeleteComment",
  "parameters": {
    "fileIds": ["66b357061b7f9c2032d6d70f"],
    "options": {
      "textContains": "confidential",
      "page": 2
    }
  }
}

Request Example (Delete All Comments on Page 3)

{
  "action": "PdfDeleteComment",
  "parameters": {
    "fileIds": ["66b357061b7f9c2032d6d70f"],
    "options": {
      "deleteAll": true,
      "page": 3
    }
  }
}