Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Convert DOC file to PDF using C# REST API
This Gist contains code snippets related to conversion DOC file to PDF using Aspose.Words Cloud SDK for .NET
// get client credentials from
string clientSecret = "388e864b819d8b067a8b1cb625a2ea8e";
string clientID = "718e4235-8866-4ebe-bff4-f5a14a4b6466";
// create an instance of WordsApi
WordsApi wordsApi = new WordsApi(clientSecret, clientID);
// input DOC file name
string inputFile = "TableDocument.doc";
// output file name
string resultantFile = "Converted.pdf";
// output document format
string format = "pdf";
try {
// Create GetDocumentWithDormatRequest and provide input and output file names
GetDocumentWithFormatRequest request = new GetDocumentWithFormatRequest(inputFile, format, null, null, null, null, resultantFile);
// perform document conversion
Stream result = wordsApi.GetDocumentWithFormat(request);
catch (Exception ex)
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment