> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spojit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PDF Tools

> Extract text, get metadata, merge, split, and rotate PDF documents.

The PDF Tools connector provides operations for working with PDF documents: extracting text, merging, splitting, and manipulating pages.

<Note>No connection required; this utility connector works out of the box.</Note>

All PDF inputs and outputs are **base64-encoded** strings.

## Tools

<AccordionGroup>
  <Accordion title="extract-text: Extract text from PDF">
    <ParamField body="pdf" type="string" required>
      Base64-encoded PDF.
    </ParamField>

    <ParamField body="maxPages" type="number">
      Maximum number of pages to extract.
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "pdf": "JVBERi0xLjQKMSAwIG9iago8PAovVH...",
      "maxPages": 2
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "text": "Invoice #1042\nDate: 2025-03-15\n\nBill To:\nAcme Corp\n123 Main St\n\nItem          Qty   Price\nWidget A        3   $29.99\nGadget B        1   $59.99\n\nTotal: $149.96",
      "numPages": 2,
      "info": {
        "Title": "Invoice 1042",
        "Author": "Billing System",
        "Creator": "ReportGen 3.0"
      }
    }
    ```
  </Accordion>

  <Accordion title="get-info: Get PDF metadata">
    Returns page count, title, author, and other metadata.

    <ParamField body="pdf" type="string" required>
      Base64-encoded PDF.
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "pdf": "JVBERi0xLjQKMSAwIG9iago8PAovVH..."
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "pageCount": 3,
      "title": "Quarterly Report Q1 2025",
      "author": "Finance Team",
      "subject": "Q1 Financial Summary",
      "creator": "Google Docs",
      "producer": "Skia/PDF m133",
      "creationDate": "2025-03-20T14:30:00.000Z",
      "modificationDate": "2025-03-21T09:15:00.000Z",
      "keywords": null,
      "pages": [
        { "pageNumber": 1, "width": 612, "height": 792, "rotation": 0 },
        { "pageNumber": 2, "width": 612, "height": 792, "rotation": 0 },
        { "pageNumber": 3, "width": 612, "height": 792, "rotation": 0 }
      ]
    }
    ```
  </Accordion>

  <Accordion title="merge: Merge multiple PDFs">
    Combine multiple PDFs into a single document.

    <ParamField body="pdfs" type="string[]" required>
      Array of base64-encoded PDFs.
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "pdfs": [
        "JVBERi0xLjQKMSAwIG9iago8PAovVH...",
        "JVBERi0xLjUKJeLjz9MKMSAwIG9iago..."
      ]
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "success": true,
      "pageCount": 5,
      "pdf": "JVBERi0xLjcKMSAwIG9iaiA8PAovVH..."
    }
    ```
  </Accordion>

  <Accordion title="extract-pages: Extract specific pages">
    Create a new PDF with only the specified pages.

    <ParamField body="pdf" type="string" required>
      Base64-encoded PDF.
    </ParamField>

    <ParamField body="pages" type="number[]" required>
      Page numbers to extract (1-indexed).
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "pdf": "JVBERi0xLjQKMSAwIG9iago8PAovVH...",
      "pages": [1, 3, 5]
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "success": true,
      "pageCount": 3,
      "extractedPages": [1, 3, 5],
      "pdf": "JVBERi0xLjcKMSAwIG9iaiA8PAovVH..."
    }
    ```
  </Accordion>

  <Accordion title="split: Split into single-page PDFs">
    Split a PDF into individual single-page PDFs.

    <ParamField body="pdf" type="string" required>
      Base64-encoded PDF.
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "pdf": "JVBERi0xLjQKMSAwIG9iago8PAovVH..."
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "success": true,
      "totalPages": 3,
      "pages": [
        { "pageNumber": 1, "pdf": "JVBERi0xLjcKMSAwIG9iaiA8PA..." },
        { "pageNumber": 2, "pdf": "JVBERi0xLjcKMiAwIG9iaiA8PA..." },
        { "pageNumber": 3, "pdf": "JVBERi0xLjcKMyAwIG9iaiA8PA..." }
      ]
    }
    ```
  </Accordion>

  <Accordion title="rotate: Rotate pages">
    <ParamField body="pdf" type="string" required>
      Base64-encoded PDF.
    </ParamField>

    <ParamField body="degrees" type="string" required>
      Rotation angle (clockwise): `"90"`, `"180"`, or `"270"`.
    </ParamField>

    <ParamField body="pages" type="number[]">
      Pages to rotate (all pages if omitted).
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "pdf": "JVBERi0xLjQKMSAwIG9iago8PAovVH...",
      "degrees": "90",
      "pages": [2, 4]
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "success": true,
      "rotatedPages": [2, 4],
      "pdf": "JVBERi0xLjcKMSAwIG9iaiA8PAovVH..."
    }
    ```
  </Accordion>

  <Accordion title="remove-pages: Remove specific pages">
    Create a new PDF with the specified pages removed.

    <ParamField body="pdf" type="string" required>
      Base64-encoded PDF.
    </ParamField>

    <ParamField body="pages" type="number[]" required>
      Page numbers to remove (1-indexed).
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "pdf": "JVBERi0xLjQKMSAwIG9iago8PAovVH...",
      "pages": [2, 4]
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "success": true,
      "originalPageCount": 5,
      "newPageCount": 3,
      "removedPages": [2, 4],
      "pdf": "JVBERi0xLjcKMSAwIG9iaiA8PAovVH..."
    }
    ```
  </Accordion>
</AccordionGroup>
