|
1 | | -# convertapi-cli |
2 | | -The ConvertAPI CLI Tool is a command-line utility for interacting with the ConvertAPI |
| 1 | +# ConvertAPI CLI Client |
| 2 | + |
| 3 | +## Convert your files with our command-line file conversion utility |
| 4 | + |
| 5 | +ConvertAPI helps in converting various file formats. Creating PDF and Images from various sources like Word, Excel, Powerpoint, images, web pages or raw HTML codes. Merge, Encrypt, Split, Repair and Decrypt PDF files and many other file manipulations. You can integrate it into your application in just a few minutes and use it easily. |
| 6 | + |
| 7 | +The ConvertAPI CLI makes it easier to use the Convert API from your shell without having to build your own HTTP calls. |
| 8 | +You can get your free secret at https://www.convertapi.com/a |
| 9 | + |
| 10 | +## Installation |
| 11 | + |
| 12 | +Download compressed CLI executable |
| 13 | + |
| 14 | +* Linux: [convertapi_lin.tar.gz](https://github.com/ConvertAPI/convertapi-cli/releases/download/v3/convertapi_lin.tar.gz) |
| 15 | +* Linux ARM64: [convertapi_lin_arm.tar.gz](https://github.com/ConvertAPI/convertapi-cli/releases/download/v3/convertapi_lin_arm.tar.gz) |
| 16 | +* Darwin (MacOS): [convertapi_mac.tar.gz](https://github.com/ConvertAPI/convertapi-cli/releases/download/v3/convertapi_mac.tar.gz) |
| 17 | +* Darwin (MacOS) M1: [convertapi_mac_arm.tar.gz](https://github.com/ConvertAPI/convertapi-cli/releases/download/v3/convertapi_mac_arm.tar.gz) |
| 18 | +* Windows: [convertapi_win.zip](https://github.com/ConvertAPI/convertapi-cli/releases/download/v3/convertapi_win.zip) |
| 19 | + |
| 20 | +(this utility can also be built from source code for many other CPU and OS) |
| 21 | + |
| 22 | +Unzip executable |
| 23 | + |
| 24 | +```shell |
| 25 | +unzip convertapi_*.zip |
| 26 | +``` |
| 27 | + |
| 28 | +And you are done. |
| 29 | +Optionally you can move the executable file to a more appropriate place and make utility accessible for all local users. On Linux it would be: |
| 30 | + |
| 31 | +```shell |
| 32 | +sudo mv convertapi /usr/local/bin |
| 33 | +``` |
| 34 | + |
| 35 | +## Usage |
| 36 | + |
| 37 | +### Before you start |
| 38 | + |
| 39 | +In order to use this CLI utility, you must create your free trial account on https://www.convertapi.com site. |
| 40 | +After the sign-up process, you will get your secret at https://www.convertapi.com/a . |
| 41 | +The secret will be used in every CLI utility run. |
| 42 | + |
| 43 | +### Basic file conversion |
| 44 | + |
| 45 | +#### Example for windows `.exe`: |
| 46 | +```shell |
| 47 | +convertapi-cli.exe <api-token> <output-directory> <input-files...> [from-format] [to-format] [key1=value1 key2=value2 ...] |
| 48 | +``` |
| 49 | + |
| 50 | +### Arguments documentation |
| 51 | + |
| 52 | +#### executable |
| 53 | +_Example:_ |
| 54 | + |
| 55 | +```shell |
| 56 | +convertapi-cli.exe |
| 57 | +``` |
| 58 | + |
| 59 | +#### api-token (Authentication) |
| 60 | +Any of these authentication mechanisms can be used as `api-token`: |
| 61 | +- ConvertAPI user**secret**: https://www.convertapi.com/a |
| 62 | +- **Access token**: [ConvertAPI dashboard](https://www.convertapi.com/a/access-tokens). |
| 63 | +- **JWT token**: [ConvertAPI dashboard](https://www.convertapi.com/a/jwt-tokens). |
| 64 | + |
| 65 | +_Example:_ |
| 66 | + |
| 67 | +```shell |
| 68 | +secret_asdaSERTervcxsFWtt |
| 69 | +``` |
| 70 | + |
| 71 | +#### output-directory |
| 72 | +Directory where converted file / files needs to be saved in your system. |
| 73 | +_Example:_ |
| 74 | + |
| 75 | +```shell |
| 76 | +<directory-in-your-file-system> |
| 77 | +``` |
| 78 | + |
| 79 | +##### input-files parameter |
| 80 | +The full file path in your file system. If the conversion supports multiple input files, separate their full paths with spaces (' '). |
| 81 | +```shell |
| 82 | +<full-path1> <full-path2> <full-path3> |
| 83 | +``` |
| 84 | + |
| 85 | + |
| 86 | +##### from-format |
| 87 | +Find specific formats from all conversions here: https://www.convertapi.com/api. When you open a conversion, the **From** (Source) and **To** (Destination) formats are visible in the browser's URL and in the API Request panel, which displays the HTTP POST request URL. |
| 88 | +_Example:_ |
| 89 | +- Docx to Html conversion: https://www.convertapi.com/a/api/docx-to-html. **From-format** is: `docx`. |
| 90 | +- Watermark PDF conversion: https://www.convertapi.com/a/api/pdf-to-watermark. **From-format** is: `pdf`. |
| 91 | +- Images to Join conversion: https://www.convertapi.com/a/api/images-to-join. **From-format** is: `images`. |
| 92 | + |
| 93 | +##### to-format |
| 94 | +Find specific formats from all conversions here: https://www.convertapi.com/api. When you open a conversion, the **From** (Source) and **To** (Destination) formats are visible in the browser's URL and in the API Request panel, which displays the HTTP POST request URL. |
| 95 | + |
| 96 | +_Example:_ |
| 97 | +- Docx to Html conversion: https://www.convertapi.com/a/api/docx-to-html. **To-format** is: `html`. |
| 98 | +- Watermark PDF conversion: https://www.convertapi.com/a/api/pdf-to-watermark. **To-format** is: `watermark`. |
| 99 | +- Images to Join conversion: https://www.convertapi.com/a/api/images-to-join. **To-format** is: `join`. |
| 100 | + |
| 101 | +##### Parameters |
| 102 | +All parameters can be found on a specific conversion. Parameters are separated with spaces (' '). |
| 103 | + |
| 104 | +_Example:_ |
| 105 | +For example, we are doing PDF to JPG conversion: https://www.convertapi.com/a/api/pdf-to-jpg and want to set Pdf password, result file name and result image resolution. |
| 106 | +```shell |
| 107 | +password=1234 filename=new-wonderful-name ImageResolution=300 |
| 108 | +``` |
| 109 | + |
| 110 | +## Examples |
| 111 | + |
| 112 | +Convert a single PDF to DOCX: |
| 113 | +```shell |
| 114 | +convertapi-cli.exe YOUR_API_TOKEN output.docx input.pdf |
| 115 | +``` |
| 116 | + |
| 117 | +Merge multiple PDF files into one: |
| 118 | +```shell |
| 119 | +convertapi-cli.exe YOUR_API_TOKEN merged_output.pdf file1.pdf file2.pdf file3.pdf pdf merge |
| 120 | +``` |
| 121 | + |
| 122 | +Protect a PDF with a password: |
| 123 | +```shell |
| 124 | +convertapi-cli.exe YOUR_API_TOKEN protected_output.pdf input.pdf pdf protect UserPassword=1234 OwnerPassword=abcd FileName=protected |
| 125 | +``` |
| 126 | + |
| 127 | +Add a watermark to a PDF: |
| 128 | +```shell |
| 129 | +convertapi-cli.exe YOUR_API_TOKEN watermarked_output.pdf input.pdf pdf watermark Text=Confidential FileName=watermark |
| 130 | +``` |
| 131 | + |
| 132 | + |
| 133 | +### Issues & Comments |
| 134 | +Please leave all comments, bugs, requests, and issues on the Issues page. We'll respond to your request ASAP! |
| 135 | + |
| 136 | +### License |
| 137 | +The ConvertAPI CLI is licensed under the [MIT](https://opensource.org/license/mit "Read more about the MIT license form") license. |
| 138 | +Refer to the [LICENSE](https://raw.githubusercontent.com/ConvertAPI/convertapi-cli/master/LICENSE.txt) file for more information. |
0 commit comments