Operations
Add Watermarks
Add a watermark to a PDF file, to an image (PNG, JPG...) or to a video (MP4, MOV...).
To add a watermark to a file, create a job with a watermark task.
The watermark can be either a simple text or an image file. If using an image file as watermark, make sure it has transparent background.
When using an image file as watermark, you need to add a second import task as shown below.
Task Parameters
operation
string required
Value is
watermark.input
string or array of task names
Files to add the watermark to
input_format
string
The current format of the file, e.g. pdf. If not set, the extension of the input file is used as input format.
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.
Example Job
Using the parameters from above, you can create a job:
POSThttps://api.cloudconvert.com/v2/jobs{ "tasks": { "import-my-file": { "operation": "import/url", "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/zombies.pdf" }, "import-my-logo": { "operation": "import/url", "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/logo.png" }, "convert-my-file": { "operation": "watermark", "input": "import-my-file", "input_format": "pdf", "image": "import-my-logo" }, "export-my-file": { "operation": "export/url", "input": "convert-my-file" } } }
# Install the CloudConvert CLI: npm install -g cloudconvert-cli $ cloudconvert watermark \ --image=logo.png \ zombies.pdf
$ 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" }, "import-my-logo": { "operation": "import/url", "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/logo.png" }, "convert-my-file": { "operation": "watermark", "input": "import-my-file", "input_format": "pdf", "image": "import-my-logo" }, "export-my-file": { "operation": "export/url", "input": "convert-my-file" } } }'
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('import/url', 'import-my-logo')) ->set('url', 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/logo.png') ) ->addTask( (new Task('watermark', 'convert-my-file')) ->set('input', 'import-my-file') ->set('input_format', 'pdf') ->set('image', 'import-my-logo') ) ->addTask( (new Task('export/url', 'export-my-file')) ->set('input', 'convert-my-file') ); $cloudconvert->jobs()->create($job);
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" }, "import-my-logo": { "operation": "import/url", "url": "https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/logo.png" }, "convert-my-file": { "operation": "watermark", "input": "import-my-file", "input_format": "pdf", "image": "import-my-logo" }, "export-my-file": { "operation": "export/url", "input": "convert-my-file" } } });
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' }, 'import-my-logo': { 'operation': 'import/url', 'url': 'https://cloudconvert-blog.s3.eu-central-1.amazonaws.com/public/test-files/logo.png' }, 'convert-my-file': { 'operation': 'watermark', 'input': 'import-my-file', 'input_format': 'pdf', 'image': 'import-my-logo' }, 'export-my-file': { 'operation': 'export/url', 'input': 'convert-my-file' } } })