Skip to content

Instantly share code, notes, and snippets.

@aspose-cloud
Last active July 23, 2021 11:44
Show Gist options
  • Save aspose-cloud/8b6515bf7fdc88213b3245c24636cced to your computer and use it in GitHub Desktop.
Save aspose-cloud/8b6515bf7fdc88213b3245c24636cced to your computer and use it in GitHub Desktop.
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 https://dashboard.aspose.cloud/
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