Converting word documents to PDF

I’m currently working on a code action with the following objectives:

  1. Populate predefined fields in a Word document using variables from various sources
  2. Convert the resulting Word document to a PDF

The main challenge arises during the conversion process: I’m having difficulty preserving the original formatting and layout when converting the Word document to PDF.

So far, I haven’t found any client-side libraries that provide a straightforward way to dynamically convert a Word file to PDF while maintaining the formatting. Additionally, I haven’t identified a solution within Appfarm that supports performing this conversion at scale, as the goal is to extend the functionality to handle bulk conversion of Word files to PDF.

Is there a recommended approach or solution for achieving this within the Appfarm platform?