The https://docs.microsoft.com/en-us/javascript/api/office/office.document?view=word-js-1.3#getFileAsync_fileType__callback_-API already supports PDF export. Unfortunately, the file format is PDF 1.8...
M-Junaid
Nov 02, 2023Brass Contributor
I think you want to convert opened office document to PDF! this is already done in https://docs.microsoft.com/en-us/javascript/api/office/office.document?view=word-js-1.3#getFileAsync_fileType__callback_
see this
https://learn.microsoft.com/en-us/javascript/api/office/office.document?view=word-js-1.3#office-office-document-getfileasync-member(1)
get document base64 Office.context.document.getFileAsync(Office.FileType.Pdf and convert base64 to pdf.