Microsoft Word API – how to I from Word.RequestContext.document to Office.Document

I am starting the “Build your first Word task pane add-in” tutorial.

Basically I want to make a Button on the Panel that will send this document as a PDF to my web service.

There is a function in the API called Office.Document.getFileAsync which seem to be an excellent way to save data to a PDF, which I can then send to my web service.

How do I access that part of the API. In the tutorial it seem that we should use the context object, but context.document.getFileAsync does not appear to exist. I think I need to get to the Office.Document object and I think context.document is Word.RequestContext.document.

export async function run() {
  return Word.run(async (context) => {
    /**
     * Insert your Word code here
     */

    {{Office.Document then use getFileAsync  }}

    await context.sync();
  });
}