Most file types to PDF converter service.
Converter service can be easily deployed with the following command:
docker compose up -dStop service command:
docker compose downNOTE: Assure port 5000 is not being used.
cURL
curl -X POST http://localhost:5000/ -F "files=@/path/to/file.docx" -o output.pdfaxios
import fs from 'fs/promises';
import axios from 'axios';
const API_URL = 'http://localhost:5000/';
let inputFile = await fs.readFile("/path/to/input/file");
let res = axios.request({
url: API_URL,
responseType: 'arraybuffer', // important
method: 'POST',
headers: {
'Content-Type': 'multipart/form-data'
},
data: {
'files': inputFile
}
});
let outputFile = res.data; // PDF buffer
// Save to file?
await fs.writeFile('/path/to/output/file.pdf', outputFile);Currently not implemented