You can upload files from the following storage types:
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.
Uploading from the Web works in the same way as uploading from local but using a public URL.
We can control two file attributes:
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.
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);
You may need to delete previously uploaded files from a task. In this case, you can use the following delete function:
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:
As explained above in File attributes you can ignore password-protected files with ignore_password when processing your task.
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.
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:
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:
So the final output name could be:
iLoveAPI 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:
Download functions are exactly the same as the basic upload functions and allow you to download your output files.
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 iLoveAPI Tools.