PDF Format Converter via Cloud .NET SDK
Export PDF to Microsoft Office® Word, Excel, PowerPoint Presentations, Images, HTML and fixed-layout formats with Aspose.PDF Cloud .NET SDK
Get StartedHow to Convert PDF to DOCX Using SDK for .NET
In order to convert PDF to DOCX, we’ll use Aspose.PDF Cloud .NET SDK This Cloud SDK allows you to easily build cloud-based PDF creator, editor & converter apps in C#, ASP.NET, or other .NET languages for various cloud platforms. Open NuGet package manager, search for Aspose.PDF Cloud and install. You may also use the following command from the Package Manager Console.
Package Manager Console Command
PM> Install-Package Aspose.Pdf-Cloud
Convert PDF to DOCX via .NET SDK
The ConvertPDFtoDOCX() method uploads a local PDF file to Aspose Cloud Storage and converts it into a DOCX document. It uses the Aspose.PDF Cloud API, authenticates with AppSecret and AppKey, uploads the input PDF, requests the conversion in “Flow” mode for better text reflow, and saves the resulting DOCX file locally as sample.docx. Finally, it outputs the size of the converted file in bytes.
This sample code shows PDF to DOCX Cloud .NET SDK Conversion
public static void ConvertPDFtoDOCX()
{
var localImageFileName = @"C:\Samples\sample.pdf";
var storageImageFileName = "sample.pdf";
// Get your ClientId and ClientSecret from https://dashboard.aspose.cloud (free registration required).
var config = new Configuration(AppSecret, AppKey);
var pdfApi = new PdfApi(config);
using (var file = File.OpenRead(localImageFileName))
{
var uploadResult = pdfApi.UploadFile(storageImageFileName, file);
}
var response = pdfApi.GetPdfInStorageToDoc(storageImageFileName, format: "DocX", mode: "Flow");
response.CopyTo(System.IO.File.OpenWrite("sample.docx"));
Console.WriteLine($"PDF to DOCX result: {response.Length} bytes");
}
Save PDF as XLSX Files via .NET SDK
The ConvertPdfToXlsx() method uploads a local PDF file to Aspose Cloud Storage and converts it into an Excel (XLSX) spreadsheet. Using the Aspose.PDF Cloud API with AppSid and AppSecret, it uploads the PDF, performs the conversion, saves the result locally as sample.xlsx, and then prints the file size of the converted spreadsheet in bytes.
This sample code shows PDF to XLSX Cloud .NET SDK Conversion
public static void ConvertPdfToXlsx()
{
const string localImageFileName = @"C:\Samples\sample.pdf";
const string storageImageFileName = "sample.pdf";
const string resultFileName = "sample.xlsx";
// Get your AppSid and AppSecret https://dashboard.aspose.cloud (free registration required).
var pdfApi = new PdfApi(AppSecret, AppSid);
using var file = File.OpenRead(localImageFileName);
pdfApi.UploadFile(storageImageFileName, file);
var response = pdfApi.GetPdfInStorageToXlsx(storageImageFileName);
response.CopyTo(File.OpenWrite(resultFileName));
Console.WriteLine($"PDF to Excel result: {response.Length} bytes");
}
Convert PDF to PowerPoint Presentations via .NET SDK
The ConvertPdfToPptx() method uploads a local PDF file to Aspose Cloud Storage and converts it into a PowerPoint (PPTX) presentation. Using the Aspose.PDF Cloud API with AppSid and AppSecret, it uploads the PDF, processes the conversion, saves the output locally as sample.pptx, and prints the size of the generated presentation in bytes.
This sample code shows PDF to PowerPoint Cloud .NET SDK Conversion
public static void ConvertPdfToPptx()
{
const string localImageFileName = @"C:\Samples\sample.pdf";
const string storageImageFileName = "sample.pdf";
const string resultFileName = "sample.pptx";
// Get your AppSid and AppSecret https://dashboard.aspose.cloud (free registration required).
var pdfApi = new PdfApi(AppSecret, AppSid);
using var file = File.OpenRead(localImageFileName);
pdfApi.UploadFile(storageImageFileName, file);
var response = pdfApi.GetPdfInStorageToPptx(storageImageFileName);
response.CopyTo(File.OpenWrite(resultFileName));
Console.WriteLine($"PDF to PPTX result: {response.Length} bytes");
}
Portable Document Format PDF to HTML Conversion via .NET SDK
The ConvertPdfToHtml() method uploads a local PDF file to Aspose Cloud Storage and converts it into an HTML format. Using the Aspose.PDF Cloud API with AppSid and AppSecret, it uploads the PDF, performs the conversion, saves the output as a ZIP archive (sample-html.zip) containing the HTML and related resources, and prints the size of the generated file in bytes.
This sample code shows PDF to HTML Cloud .NET SDK Conversion
public static void ConvertPdfToHtml()
{
const string localImageFileName = @"C:\Samples\sample.pdf";
const string storageImageFileName = "sample.pdf";
const string resultFileName = "sample-html.zip";
// Get your AppSid and AppSecret https://dashboard.aspose.cloud (free registration required).
var pdfApi = new PdfApi(AppSecret, AppSid);
using var file = File.OpenRead(localImageFileName);
pdfApi.UploadFile(storageImageFileName, file);
var response = pdfApi.GetPdfInStorageToHtml(storageImageFileName);
response.CopyTo(File.OpenWrite(resultFileName));
Console.WriteLine($"PDF to HTML result: {response.Length} bytes");
}
Other Supported Conversions
You can also convert many other file formats