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 whereas we need a PDF/A compatible export. It is possible to specify PDF/A when saving the PDF manually through the "Options" dialog in the Office application. Unfortunately, there is no (documented) way to specify the type of PDF in the getFileAsync-API. It would be great, if the API is expanded so that PDF/A compatibility can be requested as well (either with a new file format flag or as an option in the optional GetFileOptions-object).
4 Comments
- ErnstScheithauerBrass Contributor
M-Junaid There are different variants of the PDF-standard and PDF/A is one of them that is for long term archiving (https://en.wikipedia.org/wiki/PDF/A). In this standard many requirements must be met, e.g. embedding fonts and do not use certain features. The Office apps (on the client) and therefore the COM APIs support creating a pdf file conforming to this standard, and this issue is about supporting this in the js API as well.
- M-JunaidBrass 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. - ErnstScheithauerBrass Contributor
@lindalu-MSFT
This would be a great extension, not being able to create a pdf/a is a showstopper for many public sector applications since they require using pdf/a instead of plain pdf files. - Jaime_from_SynergyOSIron Contributor
We also support this idea and we would love to extend the options to cover all the PDF export attributes: pages to include, properties, image quality, etc. Basically, extending the API with similar options as the old Saveas2 method in VBA, but for the JS API. This should include the export differences of PDF options for Word, Excel, and PowerPoint.
Thank you!
Word:
PowerPoint:
Excel: