Convert to PDF in Javascript calling REST API

I am trying to convert DOCX to PDF in Javascript (SharePoint page) calling REST API.
I couldnt fine enough code or information using REST method.
There is excellent help for achieving the same using MS Flow.
But i need a working Javascript to convert and save the PDF.
API versions also different in Swagger compared to the help page.

Any help would be appreciated.


Hello @Muthu,

I answered in the support ticket and will also post the sample here. I attached a sample on C#. It should work if you download RestSharp nuget package (

You need to create a new API key for Documents and replace value from _token variable to it.

For other Actions, check out

Also, we're working on new documentation for API v2 at the moment, there should be more information and examples.

data.json (37.5 KB) sample.txt (738 Bytes)

Best regards,
Petr Bushuev
Plumsail team