# PDF Operations

> Convert, optimize and manipulate PDF files

## Convert to PDF/A

Convert a PDF file to PDF/A-1B, PDF/A-2B or PDF/A-3B. Optionally add a ZUGFeRD invoice XML file.

#### Task Parameters

### pdf/a task parameters

- `operation` _string_ required: Value is `pdf/a`.
- `input` _string or array of task names_ required: Files to perform the operation on
- `engine` _string_: Use a specific engine for the conversion.
- `engine_version` _string_: Use a specific engine version for the conversion.
- `filename` _string_: Choose a filename (including extension) for the output file.
- `timeout` _integer_: Timeout in seconds after the task will be cancelled. By default, tasks time out after 5 hours.

Additional operation-specific parameters can be available depending on the input format and output format. Use the [operations API](/api-reference/operations#list-operations) to identify these dynamic parameters, for example by filtering for `pdf/a` and including `options`: `GET https://api.cloudconvert.com/v2/operations?filter[operation]=pdf/a&include=options`.

### Example job

Raw request:

```json
{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/a",
            "conformance_level": "2b",
            "input": "import-my-file"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
}
```

CLI:

```bash
# Install the CloudConvert CLI: npm install -g cloudconvert-cli
$ cloudconvert pdf/a \
    --conformance_level=2b \
    zombies.pdf
```

cURL:

```bash
$ curl -X POST "https://api.cloudconvert.com/v2/jobs" \
    -H "Authorization: Bearer API_KEY" \
    -H "Content-type: application/json" \
    -d '{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/a",
            "conformance_level": "2b",
            "input": "import-my-file"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
}' 
```

PHP:

```php
use \CloudConvert\CloudConvert;
use \CloudConvert\Models\Job;
use \CloudConvert\Models\Task;

$cloudconvert = new CloudConvert(['api_key' => 'API_KEY']);

$job = (new Job())
   ->addTask(
       (new Task('import/url', 'import-my-file'))
         ->set('url', 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf')
     )
   ->addTask(
       (new Task('pdf/a', 'convert-my-file'))
         ->set('conformance_level', '2b')
         ->set('input', 'import-my-file')
     )
   ->addTask(
       (new Task('export/url', 'export-my-file'))
         ->set('input', 'convert-my-file')
     ); 

$cloudconvert->jobs()->create($job);
```

Node.js:

```js
import CloudConvert from 'cloudconvert';

const cloudConvert = new CloudConvert('api_key');

let job = await cloudConvert.jobs.create({
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/a",
            "conformance_level": "2b",
            "input": "import-my-file"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
});
```

Python:

```python
import cloudconvert

cloudconvert.configure(api_key='API_KEY')

cloudconvert.Job.create(payload={
    'tasks': {
        'import-my-file': {
            'operation': 'import/url',
            'url': 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf'
        },
        'convert-my-file': {
            'operation': 'pdf/a',
            'conformance_level': '2b',
            'input': 'import-my-file'
        },
        'export-my-file': {
            'operation': 'export/url',
            'input': 'convert-my-file'
        }
    }
})
```

<tip to="https://cloudconvert.com/job-builder?operation=pdf/a">

Use the **Job Builder** to generate and try out pdf/a jobs.

</tip>

## Convert to PDF/X

Convert a PDF file to PDF/X-1A, PDF/X-3 or PDF/X-4.

#### Task Parameters

### pdf/x task parameters

- `operation` _string_ required: Value is `pdf/x`.
- `input` _string or array of task names_ required: Files to perform the operation on
- `engine` _string_: Use a specific engine for the conversion.
- `engine_version` _string_: Use a specific engine version for the conversion.
- `filename` _string_: Choose a filename (including extension) for the output file.
- `timeout` _integer_: Timeout in seconds after the task will be cancelled. By default, tasks time out after 5 hours.

Additional operation-specific parameters can be available depending on the input format and output format. Use the [operations API](/api-reference/operations#list-operations) to identify these dynamic parameters, for example by filtering for `pdf/x` and including `options`: `GET https://api.cloudconvert.com/v2/operations?filter[operation]=pdf/x&include=options`.

### Example job

Raw request:

```json
{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/x",
            "input": "import-my-file",
            "variant": "4"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
}
```

CLI:

```bash
# Install the CloudConvert CLI: npm install -g cloudconvert-cli
$ cloudconvert pdf/x \
    --variant=4 \
    zombies.pdf
```

cURL:

```bash
$ curl -X POST "https://api.cloudconvert.com/v2/jobs" \
    -H "Authorization: Bearer API_KEY" \
    -H "Content-type: application/json" \
    -d '{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/x",
            "input": "import-my-file",
            "variant": "4"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
}' 
```

PHP:

```php
use \CloudConvert\CloudConvert;
use \CloudConvert\Models\Job;
use \CloudConvert\Models\Task;

$cloudconvert = new CloudConvert(['api_key' => 'API_KEY']);

$job = (new Job())
   ->addTask(
       (new Task('import/url', 'import-my-file'))
         ->set('url', 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf')
     )
   ->addTask(
       (new Task('pdf/x', 'convert-my-file'))
         ->set('input', 'import-my-file')
         ->set('variant', '4')
     )
   ->addTask(
       (new Task('export/url', 'export-my-file'))
         ->set('input', 'convert-my-file')
     ); 

$cloudconvert->jobs()->create($job);
```

Node.js:

```js
import CloudConvert from 'cloudconvert';

const cloudConvert = new CloudConvert('api_key');

let job = await cloudConvert.jobs.create({
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/x",
            "input": "import-my-file",
            "variant": "4"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
});
```

Python:

```python
import cloudconvert

cloudconvert.configure(api_key='API_KEY')

cloudconvert.Job.create(payload={
    'tasks': {
        'import-my-file': {
            'operation': 'import/url',
            'url': 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf'
        },
        'convert-my-file': {
            'operation': 'pdf/x',
            'input': 'import-my-file',
            'variant': '4'
        },
        'export-my-file': {
            'operation': 'export/url',
            'input': 'convert-my-file'
        }
    }
})
```

<tip to="https://cloudconvert.com/job-builder?operation=pdf/x">

Use the **Job Builder** to generate and try out pdf/x jobs.

</tip>

## PDF OCR

Adds an OCR text layer to scanned PDF files, allowing them to be searched or copy-pasted.

#### Task Parameters

### pdf/ocr task parameters

- `operation` _string_ required: Value is `pdf/ocr`.
- `input` _string or array of task names_ required: Files to perform the operation on
- `engine` _string_: Use a specific engine for the conversion.
- `engine_version` _string_: Use a specific engine version for the conversion.
- `filename` _string_: Choose a filename (including extension) for the output file.
- `timeout` _integer_: Timeout in seconds after the task will be cancelled. By default, tasks time out after 5 hours.

Additional operation-specific parameters can be available depending on the input format and output format. Use the [operations API](/api-reference/operations#list-operations) to identify these dynamic parameters, for example by filtering for `pdf/ocr` and including `options`: `GET https://api.cloudconvert.com/v2/operations?filter[operation]=pdf/ocr&include=options`.

### Example job

Raw request:

```json
{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/ocr",
            "input": "import-my-file",
            "language": [
                "eng"
            ]
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
}
```

CLI:

```bash
# Install the CloudConvert CLI: npm install -g cloudconvert-cli
$ cloudconvert pdf/ocr \
    --language.0=eng \
    zombies.pdf
```

cURL:

```bash
$ curl -X POST "https://api.cloudconvert.com/v2/jobs" \
    -H "Authorization: Bearer API_KEY" \
    -H "Content-type: application/json" \
    -d '{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/ocr",
            "input": "import-my-file",
            "language": [
                "eng"
            ]
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
}' 
```

PHP:

```php
use \CloudConvert\CloudConvert;
use \CloudConvert\Models\Job;
use \CloudConvert\Models\Task;

$cloudconvert = new CloudConvert(['api_key' => 'API_KEY']);

$job = (new Job())
   ->addTask(
       (new Task('import/url', 'import-my-file'))
         ->set('url', 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf')
     )
   ->addTask(
       (new Task('pdf/ocr', 'convert-my-file'))
         ->set('input', 'import-my-file')
         ->set('language', ["eng"])
     )
   ->addTask(
       (new Task('export/url', 'export-my-file'))
         ->set('input', 'convert-my-file')
     ); 

$cloudconvert->jobs()->create($job);
```

Node.js:

```js
import CloudConvert from 'cloudconvert';

const cloudConvert = new CloudConvert('api_key');

let job = await cloudConvert.jobs.create({
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/ocr",
            "input": "import-my-file",
            "language": [
                "eng"
            ]
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
});
```

Python:

```python
import cloudconvert

cloudconvert.configure(api_key='API_KEY')

cloudconvert.Job.create(payload={
    'tasks': {
        'import-my-file': {
            'operation': 'import/url',
            'url': 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf'
        },
        'convert-my-file': {
            'operation': 'pdf/ocr',
            'input': 'import-my-file',
            'language': [
                'eng'
            ]
        },
        'export-my-file': {
            'operation': 'export/url',
            'input': 'convert-my-file'
        }
    }
})
```

<tip to="https://cloudconvert.com/job-builder?operation=pdf/ocr">

Use the **Job Builder** to generate and try out pdf/ocr jobs.

</tip>

## Encrypt PDF

Encrypt a PDF file and optionally set a password. This operation also supports PDF security restrictions.

#### Task Parameters

### pdf/encrypt task parameters

- `operation` _string_ required: Value is `pdf/encrypt`.
- `input` _string or array of task names_ required: Files to perform the operation on
- `engine` _string_: Use a specific engine for the conversion.
- `engine_version` _string_: Use a specific engine version for the conversion.
- `filename` _string_: Choose a filename (including extension) for the output file.
- `timeout` _integer_: Timeout in seconds after the task will be cancelled. By default, tasks time out after 5 hours.

Additional operation-specific parameters can be available depending on the input format and output format. Use the [operations API](/api-reference/operations#list-operations) to identify these dynamic parameters, for example by filtering for `pdf/encrypt` and including `options`: `GET https://api.cloudconvert.com/v2/operations?filter[operation]=pdf/encrypt&include=options`.

### Example job

Raw request:

```json
{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/encrypt",
            "input": "import-my-file",
            "set_password": "123",
            "set_owner_password": "456",
            "allow_extract": false,
            "allow_accessibility": true,
            "allow_modify": "form",
            "allow_print": "full"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
}
```

CLI:

```bash
# Install the CloudConvert CLI: npm install -g cloudconvert-cli
$ cloudconvert pdf/encrypt \
    --set_password=123 \
    --set_owner_password=456 \
    --allow_extract=false \
    --allow_accessibility=true \
    --allow_modify=form \
    --allow_print=full \
    zombies.pdf
```

cURL:

```bash
$ curl -X POST "https://api.cloudconvert.com/v2/jobs" \
    -H "Authorization: Bearer API_KEY" \
    -H "Content-type: application/json" \
    -d '{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/encrypt",
            "input": "import-my-file",
            "set_password": "123",
            "set_owner_password": "456",
            "allow_extract": false,
            "allow_accessibility": true,
            "allow_modify": "form",
            "allow_print": "full"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
}' 
```

PHP:

```php
use \CloudConvert\CloudConvert;
use \CloudConvert\Models\Job;
use \CloudConvert\Models\Task;

$cloudconvert = new CloudConvert(['api_key' => 'API_KEY']);

$job = (new Job())
   ->addTask(
       (new Task('import/url', 'import-my-file'))
         ->set('url', 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf')
     )
   ->addTask(
       (new Task('pdf/encrypt', 'convert-my-file'))
         ->set('input', 'import-my-file')
         ->set('set_password', '123')
         ->set('set_owner_password', '456')
         ->set('allow_extract', false)
         ->set('allow_accessibility', true)
         ->set('allow_modify', 'form')
         ->set('allow_print', 'full')
     )
   ->addTask(
       (new Task('export/url', 'export-my-file'))
         ->set('input', 'convert-my-file')
     ); 

$cloudconvert->jobs()->create($job);
```

Node.js:

```js
import CloudConvert from 'cloudconvert';

const cloudConvert = new CloudConvert('api_key');

let job = await cloudConvert.jobs.create({
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/encrypt",
            "input": "import-my-file",
            "set_password": "123",
            "set_owner_password": "456",
            "allow_extract": false,
            "allow_accessibility": true,
            "allow_modify": "form",
            "allow_print": "full"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
});
```

Python:

```python
import cloudconvert

cloudconvert.configure(api_key='API_KEY')

cloudconvert.Job.create(payload={
    'tasks': {
        'import-my-file': {
            'operation': 'import/url',
            'url': 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf'
        },
        'convert-my-file': {
            'operation': 'pdf/encrypt',
            'input': 'import-my-file',
            'set_password': '123',
            'set_owner_password': '456',
            'allow_extract': False,
            'allow_accessibility': True,
            'allow_modify': 'form',
            'allow_print': 'full'
        },
        'export-my-file': {
            'operation': 'export/url',
            'input': 'convert-my-file'
        }
    }
})
```

<tip to="https://cloudconvert.com/job-builder?operation=pdf/encrypt">

Use the **Job Builder** to generate and try out pdf/encrypt jobs.

</tip>

## Decrypt PDF

Decrypt a PDF file and remove a password. The password of he PDF file is required to decrypt it.

#### Task Parameters

### pdf/decrypt task parameters

- `operation` _string_ required: Value is `pdf/decrypt`.
- `input` _string or array of task names_ required: Files to perform the operation on
- `engine` _string_: Use a specific engine for the conversion.
- `engine_version` _string_: Use a specific engine version for the conversion.
- `filename` _string_: Choose a filename (including extension) for the output file.
- `timeout` _integer_: Timeout in seconds after the task will be cancelled. By default, tasks time out after 5 hours.

Additional operation-specific parameters can be available depending on the input format and output format. Use the [operations API](/api-reference/operations#list-operations) to identify these dynamic parameters, for example by filtering for `pdf/decrypt` and including `options`: `GET https://api.cloudconvert.com/v2/operations?filter[operation]=pdf/decrypt&include=options`.

### Example job

Raw request:

```json
{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/decrypt",
            "input": "import-my-file",
            "password": "123"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
}
```

CLI:

```bash
# Install the CloudConvert CLI: npm install -g cloudconvert-cli
$ cloudconvert pdf/decrypt \
    --password=123 \
    zombies.pdf
```

cURL:

```bash
$ curl -X POST "https://api.cloudconvert.com/v2/jobs" \
    -H "Authorization: Bearer API_KEY" \
    -H "Content-type: application/json" \
    -d '{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/decrypt",
            "input": "import-my-file",
            "password": "123"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
}' 
```

PHP:

```php
use \CloudConvert\CloudConvert;
use \CloudConvert\Models\Job;
use \CloudConvert\Models\Task;

$cloudconvert = new CloudConvert(['api_key' => 'API_KEY']);

$job = (new Job())
   ->addTask(
       (new Task('import/url', 'import-my-file'))
         ->set('url', 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf')
     )
   ->addTask(
       (new Task('pdf/decrypt', 'convert-my-file'))
         ->set('input', 'import-my-file')
         ->set('password', '123')
     )
   ->addTask(
       (new Task('export/url', 'export-my-file'))
         ->set('input', 'convert-my-file')
     ); 

$cloudconvert->jobs()->create($job);
```

Node.js:

```js
import CloudConvert from 'cloudconvert';

const cloudConvert = new CloudConvert('api_key');

let job = await cloudConvert.jobs.create({
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/decrypt",
            "input": "import-my-file",
            "password": "123"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
});
```

Python:

```python
import cloudconvert

cloudconvert.configure(api_key='API_KEY')

cloudconvert.Job.create(payload={
    'tasks': {
        'import-my-file': {
            'operation': 'import/url',
            'url': 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf'
        },
        'convert-my-file': {
            'operation': 'pdf/decrypt',
            'input': 'import-my-file',
            'password': '123'
        },
        'export-my-file': {
            'operation': 'export/url',
            'input': 'convert-my-file'
        }
    }
})
```

<tip to="https://cloudconvert.com/job-builder?operation=pdf/decrypt">

Use the **Job Builder** to generate and try out pdf/decrypt jobs.

</tip>

## Split PDF Pages

Split a PDF into one PDF file per page.

#### Task Parameters

### pdf/split-pages task parameters

- `operation` _string_ required: Value is `pdf/split-pages`.
- `input` _string or array of task names_ required: Files to perform the operation on
- `engine` _string_: Use a specific engine for the conversion.
- `engine_version` _string_: Use a specific engine version for the conversion.
- `filename` _string_: Choose a filename (including extension) for the output file.
- `timeout` _integer_: Timeout in seconds after the task will be cancelled. By default, tasks time out after 5 hours.

Additional operation-specific parameters can be available depending on the input format and output format. Use the [operations API](/api-reference/operations#list-operations) to identify these dynamic parameters, for example by filtering for `pdf/split-pages` and including `options`: `GET https://api.cloudconvert.com/v2/operations?filter[operation]=pdf/split-pages&include=options`.

### Example job

Raw request:

```json
{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/split-pages",
            "input": "import-my-file"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
}
```

CLI:

```bash
# Install the CloudConvert CLI: npm install -g cloudconvert-cli
$ cloudconvert pdf/split-pages \
    zombies.pdf
```

cURL:

```bash
$ curl -X POST "https://api.cloudconvert.com/v2/jobs" \
    -H "Authorization: Bearer API_KEY" \
    -H "Content-type: application/json" \
    -d '{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/split-pages",
            "input": "import-my-file"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
}' 
```

PHP:

```php
use \CloudConvert\CloudConvert;
use \CloudConvert\Models\Job;
use \CloudConvert\Models\Task;

$cloudconvert = new CloudConvert(['api_key' => 'API_KEY']);

$job = (new Job())
   ->addTask(
       (new Task('import/url', 'import-my-file'))
         ->set('url', 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf')
     )
   ->addTask(
       (new Task('pdf/split-pages', 'convert-my-file'))
         ->set('input', 'import-my-file')
     )
   ->addTask(
       (new Task('export/url', 'export-my-file'))
         ->set('input', 'convert-my-file')
     ); 

$cloudconvert->jobs()->create($job);
```

Node.js:

```js
import CloudConvert from 'cloudconvert';

const cloudConvert = new CloudConvert('api_key');

let job = await cloudConvert.jobs.create({
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/split-pages",
            "input": "import-my-file"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
});
```

Python:

```python
import cloudconvert

cloudconvert.configure(api_key='API_KEY')

cloudconvert.Job.create(payload={
    'tasks': {
        'import-my-file': {
            'operation': 'import/url',
            'url': 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf'
        },
        'convert-my-file': {
            'operation': 'pdf/split-pages',
            'input': 'import-my-file'
        },
        'export-my-file': {
            'operation': 'export/url',
            'input': 'convert-my-file'
        }
    }
})
```

<tip to="https://cloudconvert.com/job-builder?operation=pdf/split-pages">

Use the **Job Builder** to generate and try out pdf/split-pages jobs.

</tip>

## Exctract PDF Pages

Extract single pages or page ranges from a PDF file into a new PDF file.

#### Task Parameters

### pdf/extract-pages task parameters

- `operation` _string_ required: Value is `pdf/extract-pages`.
- `input` _string or array of task names_ required: Files to perform the operation on
- `engine` _string_: Use a specific engine for the conversion.
- `engine_version` _string_: Use a specific engine version for the conversion.
- `filename` _string_: Choose a filename (including extension) for the output file.
- `timeout` _integer_: Timeout in seconds after the task will be cancelled. By default, tasks time out after 5 hours.

Additional operation-specific parameters can be available depending on the input format and output format. Use the [operations API](/api-reference/operations#list-operations) to identify these dynamic parameters, for example by filtering for `pdf/extract-pages` and including `options`: `GET https://api.cloudconvert.com/v2/operations?filter[operation]=pdf/extract-pages&include=options`.

### Example job

Raw request:

```json
{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/extract-pages",
            "input": "import-my-file",
            "pages": "1,2"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
}
```

CLI:

```bash
# Install the CloudConvert CLI: npm install -g cloudconvert-cli
$ cloudconvert pdf/extract-pages \
    --pages=1,2 \
    zombies.pdf
```

cURL:

```bash
$ curl -X POST "https://api.cloudconvert.com/v2/jobs" \
    -H "Authorization: Bearer API_KEY" \
    -H "Content-type: application/json" \
    -d '{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/extract-pages",
            "input": "import-my-file",
            "pages": "1,2"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
}' 
```

PHP:

```php
use \CloudConvert\CloudConvert;
use \CloudConvert\Models\Job;
use \CloudConvert\Models\Task;

$cloudconvert = new CloudConvert(['api_key' => 'API_KEY']);

$job = (new Job())
   ->addTask(
       (new Task('import/url', 'import-my-file'))
         ->set('url', 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf')
     )
   ->addTask(
       (new Task('pdf/extract-pages', 'convert-my-file'))
         ->set('input', 'import-my-file')
         ->set('pages', '1,2')
     )
   ->addTask(
       (new Task('export/url', 'export-my-file'))
         ->set('input', 'convert-my-file')
     ); 

$cloudconvert->jobs()->create($job);
```

Node.js:

```js
import CloudConvert from 'cloudconvert';

const cloudConvert = new CloudConvert('api_key');

let job = await cloudConvert.jobs.create({
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/extract-pages",
            "input": "import-my-file",
            "pages": "1,2"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
});
```

Python:

```python
import cloudconvert

cloudconvert.configure(api_key='API_KEY')

cloudconvert.Job.create(payload={
    'tasks': {
        'import-my-file': {
            'operation': 'import/url',
            'url': 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf'
        },
        'convert-my-file': {
            'operation': 'pdf/extract-pages',
            'input': 'import-my-file',
            'pages': '1,2'
        },
        'export-my-file': {
            'operation': 'export/url',
            'input': 'convert-my-file'
        }
    }
})
```

<tip to="https://cloudconvert.com/job-builder?operation=pdf/extract-pages">

Use the **Job Builder** to generate and try out pdf/extract-pages jobs.

</tip>

## Rotate PDF Pages

Rotate single pages or all pages of a PDF file by a given angle.

#### Task Parameters

### pdf/rotate-pages task parameters

- `operation` _string_ required: Value is `pdf/rotate-pages`.
- `input` _string or array of task names_ required: Files to perform the operation on
- `engine` _string_: Use a specific engine for the conversion.
- `engine_version` _string_: Use a specific engine version for the conversion.
- `filename` _string_: Choose a filename (including extension) for the output file.
- `timeout` _integer_: Timeout in seconds after the task will be cancelled. By default, tasks time out after 5 hours.

Additional operation-specific parameters can be available depending on the input format and output format. Use the [operations API](/api-reference/operations#list-operations) to identify these dynamic parameters, for example by filtering for `pdf/rotate-pages` and including `options`: `GET https://api.cloudconvert.com/v2/operations?filter[operation]=pdf/rotate-pages&include=options`.

### Example job

Raw request:

```json
{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/rotate-pages",
            "input": "import-my-file",
            "pages": "1,2",
            "rotation": "+90"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
}
```

CLI:

```bash
# Install the CloudConvert CLI: npm install -g cloudconvert-cli
$ cloudconvert pdf/rotate-pages \
    --pages=1,2 \
    --rotation=+90 \
    zombies.pdf
```

cURL:

```bash
$ curl -X POST "https://api.cloudconvert.com/v2/jobs" \
    -H "Authorization: Bearer API_KEY" \
    -H "Content-type: application/json" \
    -d '{
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/rotate-pages",
            "input": "import-my-file",
            "pages": "1,2",
            "rotation": "+90"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
}' 
```

PHP:

```php
use \CloudConvert\CloudConvert;
use \CloudConvert\Models\Job;
use \CloudConvert\Models\Task;

$cloudconvert = new CloudConvert(['api_key' => 'API_KEY']);

$job = (new Job())
   ->addTask(
       (new Task('import/url', 'import-my-file'))
         ->set('url', 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf')
     )
   ->addTask(
       (new Task('pdf/rotate-pages', 'convert-my-file'))
         ->set('input', 'import-my-file')
         ->set('pages', '1,2')
         ->set('rotation', '+90')
     )
   ->addTask(
       (new Task('export/url', 'export-my-file'))
         ->set('input', 'convert-my-file')
     ); 

$cloudconvert->jobs()->create($job);
```

Node.js:

```js
import CloudConvert from 'cloudconvert';

const cloudConvert = new CloudConvert('api_key');

let job = await cloudConvert.jobs.create({
    "tasks": {
        "import-my-file": {
            "operation": "import/url",
            "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf"
        },
        "convert-my-file": {
            "operation": "pdf/rotate-pages",
            "input": "import-my-file",
            "pages": "1,2",
            "rotation": "+90"
        },
        "export-my-file": {
            "operation": "export/url",
            "input": "convert-my-file"
        }
    }
});
```

Python:

```python
import cloudconvert

cloudconvert.configure(api_key='API_KEY')

cloudconvert.Job.create(payload={
    'tasks': {
        'import-my-file': {
            'operation': 'import/url',
            'url': 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf'
        },
        'convert-my-file': {
            'operation': 'pdf/rotate-pages',
            'input': 'import-my-file',
            'pages': '1,2',
            'rotation': '+90'
        },
        'export-my-file': {
            'operation': 'export/url',
            'input': 'convert-my-file'
        }
    }
})
```

<tip to="https://cloudconvert.com/job-builder?operation=pdf/rotate-pages">

Use the **Job Builder** to generate and try out pdf/rotate-pages jobs.

</tip>
