If you're not comfortable with an external API for this, I think the conventional answer to your question is to use unoconv [1] which is simply a Python script that uses LibreOffice [2] or OpenOffice (formerly StarOffice) [3] to do the conversion.
You can also use Libre/OpenOffice directly for the conversion, but unoconv is geared toward having an always-on version of office running in the background that you use for the conversion, which is a significant performance boost relative to launching the app for every conversion.
unoconv is a little flaky, but works well in general (it's certainly a part of the DocumentAlchemy backend).
If you're comfortable with an external API for this, converting MS Office documents to PDF is as simple as:
You can test it directly online here - https://documentalchemy.com/demoIf you're not comfortable with an external API for this, I think the conventional answer to your question is to use unoconv [1] which is simply a Python script that uses LibreOffice [2] or OpenOffice (formerly StarOffice) [3] to do the conversion.
[1] https://github.com/dagwieers/unoconv
[2] https://www.libreoffice.org/
[3] http://www.openoffice.org/
You can also use Libre/OpenOffice directly for the conversion, but unoconv is geared toward having an always-on version of office running in the background that you use for the conversion, which is a significant performance boost relative to launching the app for every conversion.
unoconv is a little flaky, but works well in general (it's certainly a part of the DocumentAlchemy backend).