function convertToPDF() {
// Replace 'path/to/your-word-file.docx' with the actual path to your Word file
var url = 'path/to/your-word-file.docx';
fetch(url)
.then(response => response.blob())
.then(blob => {
var fileReader = new FileReader();
fileReader.onload = function() {
var arrayBuffer = this.result;
var uint8Array = new Uint8Array(arrayBuffer);
var docDefinition = { content: [{ image: uint8Array }] };
pdfMake.createPdf(docDefinition).download('converted-file.pdf');
};
fileReader.readAsArrayBuffer(blob);
})
.catch(error => {
console.error('Error:', error);
});
}