iLovePDF Developers
Log in Sign up

Common functions

Functions and attributes for Upload

You can upload files from the following storage types:

  • Local
  • Web

Upload from local

For local files, you must assign them to the created Task tool and it is necessary always set a local path filename in order to upload it.

Upload from local

Upload from web

Uploading from the Web works in the same way as uploading from local but using a public URL.

Upload from web

File attributes

We can control two file attributes:

File attributes

Set a password for protected files

password is used to open password-protected files (PDF and Office) and needs to receive the file's password as a parameter. If a file needs a password and one is not provided or is incorrect the API will inform you with a Bad request Error 400 indicating which file/s need a password. The task won’t close, so you can send a password again at any time.


However, it is possible to run the task by ignoring those files which require a password and process only those which don’t require one by using the property ignore_password.

Rotate a file

It's possible to rotate the orientation of any uploaded file by using the rotate property with one of four direction parameters (Up = 0, Right = 90, Down = 180, Left = 270);

Delete files

You may need to delete previously uploaded files from a task. In this case, you can use the following delete function:

Delete files

Advanced processing

We have now seen how to process PDF files in a very basic way. Now we will go through more processing instructions which have more advanced and common options to consider. You will see that each tool has its own advanced processing customization options, but here we will focus on those common to all the tools.


Example code:

Advanced processing

Ignore password-protected files

As explained above in File attributes you can ignore password-protected files with ignore_password when processing your task.

Ignore file errors

Some of the uploaded files may be damaged and therefore cannot be processed. ignore_errors allows you to ignore those damaged files and force the task to process only the good ones.


Tasks have ignore_errors set to true by default so you won’t need this function unless you want to force an error message for any damaged file.

Try to repair a damaged PDF

One of the newest iLovePDF features is the possibility to repair damaged PDF files. By default the API tries to repair any damaged file but this feature can be disabled with:

Try to repair a damaged PDF

Set output filename

As a rule, the output filename of files will be the same as the input filename in most cases. However, it depends on the tool used. You can also customize the output filename with output_filename.


This function works with simple strings made up of the following predefined vars:

  • {filename} = original filename
  • {n} = file number
  • {date} = current date
  • {tool} = current processing action

So the final output name could be:

Set output filename

Set a package filename

iLovePDF API will always pack multiple output files in a single compressed file. You can set this package filename with packaged_filename and the following predefined vars:

  • {filename} = original filename
  • {date} = current date
  • {tool} = current processing action

So the final output name could be:

Set package filename

Functions for download

Download functions are exactly the same as the basic upload functions and allow you to download your output files.

Functions for download

Now that you know all the common advanced features for Upload, Process and Download instructions, you are ready to dive into the functioning of the iLovePDF API Tools.