I'm currently working on integrating the convertapi into my Angular 11 application by referencing the following documentation
https://www.npmjs.com/package/convertapi
My goal is to convert PDFs into images,
However, I encountered an issue when trying to upload a file, which resulted in:
_path2.default.basename is not a function
Below is how I have implemented this in my component:
Import
import ConvertAPI from 'convertapi';
Initialization
const convertapi = new ConvertAPI('my actual api-secret ');
Conversion Process
convertapi.convert('jpg', { File: file }) //'file' represents the actual file object or URL of the PDF
.then(function(result: any) {
console.log(result)
})
.catch(function(e: any) {
console.log(e.toString()); // this will display the error message
});
Could there be any crucial component that I might be overlooking?