### Install ConvertAPI JavaScript Client Source: https://github.com/convertapi/convertapi-library-js/blob/master/README.md Install the ConvertAPI JavaScript client library using npm. Ensure you are using version 1.1 or compatible. ```sh npm i convertapi-js@~1.1 ``` -------------------------------- ### Configure ConvertAPI Authentication Source: https://github.com/convertapi/convertapi-library-js/blob/master/README.md Initialize the ConvertApi client with your authentication token. Obtain your token from the ConvertAPI website. ```js import ConvertApi from 'convertapi-js' let convertApi = ConvertApi.auth('api-token') ``` -------------------------------- ### Convert Local DOCX to PDF Source: https://github.com/convertapi/convertapi-library-js/blob/master/README.md Convert a local DOCX file to PDF using the ConvertAPI client. The file is uploaded via an input element. ```js let params = convertApi.createParams() params.add('file', elFileInput.files[0]) let result = await convertApi.convert('docx', 'pdf', params) // Get result file URL let url = result.files[0].Url ``` -------------------------------- ### Convert Remote PPTX to PDF Source: https://github.com/convertapi/convertapi-library-js/blob/master/README.md Convert a remote PPTX file to PDF by providing its URL. The library handles fetching the remote file for conversion. ```js let params = convertApi.createParams() params.add('file', new URL('https://cdn.convertapi.com/test-files/presentation.pptx')) let result = await convertApi.convert('pptx', 'pdf', params) // Get result file URL let url = result.files[0].Url ``` -------------------------------- ### Convert PDF to JPG with Additional Parameters Source: https://github.com/convertapi/convertapi-library-js/blob/master/README.md Convert a PDF file to JPG, applying specific conversion parameters like image scaling and dimensions. Refer to the ConvertAPI documentation for available parameters. ```js // Converting PDF to JPG file let params = convertApi.createParams() params.add('file', e.currentTarget.files[0]) params.add('ScaleImage', 'true') params.add('ScaleProportions', 'true') params.add('ImageHeight', '300') params.add('ImageWidth', '300') let result = await convertApi.convert('pdf', 'jpg', params) // Get result file URL let url = result.files[0].Url ``` -------------------------------- ### Configure ConvertAPI with Alternative Domain Source: https://github.com/convertapi/convertapi-library-js/blob/master/README.md Use an alternative domain for ConvertAPI, such as a regional endpoint, by specifying the domain URL in the authentication method. This is useful for optimizing latency. ```js let convertApi = ConvertApi.auth('api-token', 'https://eu-v2.convertapi.com/') ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.