![]() |
VOOZH | about |
dotnet add package ConvertApi --version 3.1.18
NuGet\Install-Package ConvertApi -Version 3.1.18
<PackageReference Include="ConvertApi" Version="3.1.18" />
<PackageVersion Include="ConvertApi" Version="3.1.18" />Directory.Packages.props
<PackageReference Include="ConvertApi" />Project file
paket add ConvertApi --version 3.1.18
#r "nuget: ConvertApi, 3.1.18"
#:package ConvertApi@3.1.18
#addin nuget:?package=ConvertApi&version=3.1.18Install as a Cake Addin
#tool nuget:?package=ConvertApi&version=3.1.18Install as a Cake Tool
The ConvertAPI library provides a simple and efficient way to integrate the ConvertAPI service into your .NET Framework, .NET Core, and .NET projects. ConvertAPI enables you to easily convert various file formats by leveraging its robust API. Whether you need to convert documents, images, spreadsheets, or other file types, the ConvertAPI library streamlines the process with minimal code and maximum efficiency.
Below is an overview of the key functionalities:
For a complete list of supported conversions and tools, visit the ConvertAPI API Reference.
The ConvertAPI .NET library is compatible with a wide range of platforms that support .NET Standard 2.0+ or .NET Framework 4.0+. Supported environments include:
Install the ConvertAPI package via NuGet Package Manager:
Install-Package ConvertApi
Or use the .NET CLI:
dotnet add package ConvertApi
You can get your credentials at https://www.convertapi.com/a/authentication
ConvertApi convertApi = new ConvertApi("api_token");
You can choose from multiple conversion locations, including the EU API location for GDPR compliance. However, this selection is optional as ConvertAPI automatically detects the nearest server using GEO DNS. For more details, visit ConvertAPI Servers Location.
ConvertApi.ApiBaseUri = "https://v2.convertapi.com";
Example to convert file to PDF. All supported formats and options can be found here.
Convert Word, Excel, and PowerPoint documents to PDF:
var result = await convertApi.ConvertAsync("docx", "pdf",
new ConvertApiFileParam(@"C:\files\document.docx"));
await result.SaveFilesAsync(@"C:\output\");
Convert PDF to editable Word, Excel, or PowerPoint formats:
var result = await convertApi.ConvertAsync("pdf", "docx",
new ConvertApiFileParam(@"C:\files\document.pdf"));
await result.SaveFilesAsync(@"C:\output\");
Convert HTML files or web pages to PDF:
var result = await convertApi.ConvertAsync("web", "pdf",
new ConvertApiParam("Url", "https://example.com"));
await result.SaveFilesAsync(@"C:\output\");
Convert images (e.g., JPG, PNG) to PDF:
var result = await convertApi.ConvertAsync("jpg", "pdf",
new ConvertApiFileParam(@"C:\files\image.jpg"));
await result.SaveFilesAsync(@"C:\output\");
Convert PDF to image formats (e.g., JPG, PNG):
var result = await convertApi.ConvertAsync("pdf", "jpg",
new ConvertApiFileParam(@"C:\files\document.pdf"));
await result.SaveFilesAsync(@"C:\output\");
Convert eBook formats (e.g., EPUB) to PDF:
var result = await convertApi.ConvertAsync("epub", "pdf",
new ConvertApiFileParam(@"C:\files\book.epub"));
await result.SaveFilesAsync(@"C:\output\");
Convert EML or MSG email files to PDF:
var result = await convertApi.ConvertAsync("eml", "pdf",
new ConvertApiFileParam(@"C:\files\email.eml"));
await result.SaveFilesAsync(@"C:\output\");
Merge multiple PDF files into one:
var result = await convertApi.ConvertAsync("pdf", "merge",
new ConvertApiFileParam(@"C:\files\file1.pdf"),
new ConvertApiFileParam(@"C:\files\file2.pdf"));
await result.SaveFilesAsync(@"C:\output\");
Split a PDF into individual pages:
var result = await convertApi.ConvertAsync("pdf", "split",
new ConvertApiFileParam(@"C:\files\document.pdf"));
await result.SaveFilesAsync(@"C:\output\");
Rotate pages in a PDF document:
var result = await convertApi.ConvertAsync("pdf", "rotate",
new ConvertApiFileParam(@"C:\files\document.pdf"),
new ConvertApiParam("RotatePage", "90"));
await result.SaveFilesAsync(@"C:\output\");
Delete specific pages from a PDF:
var result = await convertApi.ConvertAsync("pdf", "delete-pages",
new ConvertApiFileParam(@"C:\files\document.pdf"),
new ConvertApiParam("PageRange", "2,4"));
await result.SaveFilesAsync(@"C:\output\");
Add a text watermark to a PDF:
var result = await convertApi.ConvertAsync("pdf", "watermark",
new ConvertApiFileParam(@"C:\files\document.pdf"),
new ConvertApiParam("Text", "Confidential"));
await result.SaveFilesAsync(@"C:\output\");
Flatten a PDF to prevent further editing:
var result = await convertApi.ConvertAsync("pdf", "flatten",
new ConvertApiFileParam(@"C:\files\document.pdf"));
await result.SaveFilesAsync(@"C:\output\");
Repair a corrupted PDF file:
var result = await convertApi.ConvertAsync("pdf", "repair",
new ConvertApiFileParam(@"C:\files\corrupted.pdf"));
await result.SaveFilesAsync(@"C:\output\");
Convert a PDF to a rasterized image:
var result = await convertApi.ConvertAsync("pdf", "rasterize",
new ConvertApiFileParam(@"C:\files\document.pdf"));
await result.SaveFilesAsync(@"C:\output\");
Add password protection to a PDF:
var result = await convertApi.ConvertAsync("pdf", "protect",
new ConvertApiFileParam(@"C:\files\document.pdf"),
new ConvertApiParam("UserPassword", "secure123"));
await result.SaveFilesAsync(@"C:\output\");
Remove password protection from a PDF:
var result = await convertApi.ConvertAsync("pdf", "unprotect",
new ConvertApiFileParam(@"C:\files\protected.pdf"),
new ConvertApiParam("Password", "secure123"));
await result.SaveFilesAsync(@"C:\output\");
Redact sensitive information in a PDF:
var result = await convertApi.ConvertAsync("pdf", "redact",
new ConvertApiFileParam(@"C:\files\document.pdf"),
new ConvertApiParam("Preset", "gdpr"));
await result.SaveFilesAsync(@"C:\output\");
Compress a PDF file to reduce its size:
var result = await convertApi.ConvertAsync("pdf", "compress",
new ConvertApiFileParam(@"C:\files\document.pdf"),
new ConvertApiParam("Preset", "web"));
await result.SaveFilesAsync(@"C:\output\");
Convert a PDF to PDF/A format for archiving:
var result = await convertApi.ConvertAsync("pdf", "pdfa",
new ConvertApiFileParam(@"C:\files\document.pdf"),
new ConvertApiParam("PdfaVersion", "pdfa2"));
await result.SaveFilesAsync(@"C:\output\");
Remove metadata from a PDF:
var result = await convertApi.ConvertAsync("pdf", "pdf",
new ConvertApiFileParam(@"C:\files\document.pdf"),
new ConvertApiParam("PdfTitle", "' '"),
new ConvertApiParam("PdfSubject", "' '"),
new ConvertApiParam("PdfAuthor", "' '"),
new ConvertApiParam("PdfCreator", "' '"),
new ConvertApiParam("PdfKeywords", "' '"));
await result.SaveFilesAsync(@"C:\output\");
Extract text content from a PDF:
var result = await convertApi.ConvertAsync("pdf", "txt",
new ConvertApiFileParam(@"C:\files\document.pdf"));
await result.SaveFilesAsync(@"C:\output\");
Extract tables from a PDF into Excel:
var result = await convertApi.ConvertAsync("pdf", "xlsx",
new ConvertApiFileParam(@"C:\files\document.pdf"));
await result.SaveFilesAsync(@"C:\output\");
Extract images from a PDF:
var result = await convertApi.ConvertAsync("pdf", "extract-images",
new ConvertApiFileParam(@"C:\files\document.pdf"),
new ConvertApiParam("ImageOutputFormat", "png"));
await result.SaveFilesAsync(@"C:\output\");
Extract form data from a PDF:
var result = await convertApi.ConvertAsync("pdf", "fdf-extract",
new ConvertApiFileParam(@"C:\files\form.pdf"));
await result.SaveFilesAsync(@"C:\output\");
Extract attachments from an email file:
var result = await convertApi.ConvertAsync("email", "extract",
new ConvertApiFileParam(@"C:\files\email.eml"));
await result.SaveFilesAsync(@"C:\output\");
Generate a document from a template using JSON data:
var result = await convertApi.ConvertAsync("template", "pdf",
new ConvertApiFileParam(@"C:\templates\template.docx"),
new ConvertApiParam("BindingMethod", "placeholders"),
new ConvertApiParam("JsonPayload", "[{\"Name\": \"name\", \"Value\": \"John\", \"Type\": \"string\"}]"));
await result.SaveFilesAsync(@"C:\output\");
Compare two DOCX documents:
var result = await convertApi.ConvertAsync("docx", "compare",
new ConvertApiFileParam(@"C:\files\doc1.docx"),
new ConvertApiFileParam("CompareFile", @"C:\files\doc2.docx"));
await result.SaveFilesAsync(@"C:\output\");
Create a ZIP archive from multiple files:
var result = await convertApi.ConvertAsync("any", "zip",
new ConvertApiFileParam(@"C:\files\file1.pdf"),
new ConvertApiFileParam(@"C:\files\file2.docx"));
await result.SaveFilesAsync(@"C:\output\");
// save all result files to folder
result.SaveFilesAsync(@"\result\");
// get result files
ProcessedFile[] files = result.Files;
// get conversion cost
int cost = result.ConversionCost;
ConvertApiResponse result = await convertApi.ConvertAsync("pptx", "pdf",
new ConvertApiFileParam(new Uri("https://cdn.convertapi.com/cara/testfiles/presentation.pptx"))
);
ConvertAPI accepts extra conversion parameters depending on converted formats. All conversion parameters and explanations can be found here.
ConvertApiResponse result = await convertApi.ConvertAsync("pdf", "jpg",
new ConvertApiFileParam(@"c:\source\test.pdf"),
new ConvertApiParam("ScaleImage","true"),
new ConvertApiParam("ScaleProportions","true"),
new ConvertApiParam("ImageHeight","300"),
new ConvertApiParam("ImageWidth","300")
);
You can always check the remaining conversions amount and other account information by fetching user information.
ConvertApiUser user = await convert.GetUserAsync();
int conversionsTotal = user.ConversionsTotal;
int conversionsConsumed = user.ConversionsConsumed;
You can find more advanced examples in the examples folder.
ConvertAPI is designed to make converting files super easy. The following snippet shows how easy it is to get started. Let's convert the WORD DOCX file to PDF:
try
{
var convertApi = new ConvertApi("api_token");
var conversionTask = await convertApi.ConvertAsync("docx", "pdf",
new ConvertApiFileParam(@"c:\source\test.docx")
);
var fileSaved = await conversionTask.Files.SaveFilesAsync(@"c:\");
}
//Catch exceptions from asynchronous methods
catch (ConvertApiException e)
{
Console.WriteLine("Status Code: " + e.StatusCode);
Console.WriteLine("Response: " + e.Response);
if (e.StatusCode == HttpStatusCode.Unauthorized)
Console.WriteLine("Secret is not provided or no additional seconds left in the account to proceed conversion. More information https://www.convertapi.com/a");
}
Please leave all comments, bugs, requests, and issues on the Issues page. We'll respond to your request ASAP!
The ConvertAPI .NET Library is licensed under the MIT license. Refere to the LICENSE file for more information.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 is compatible. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.1.18 | 1,128 | 5/15/2026 |
| 3.1.16-dev | 102 | 5/14/2026 |
| 3.1.15-dev | 226 | 3/18/2026 |
| 3.1.14-dev | 196 | 1/6/2026 |
| 3.1.13-dev | 130 | 1/6/2026 |
| 3.1.12-dev | 886 | 12/3/2025 |
| 3.1.11-dev | 722 | 12/2/2025 |
| 3.1.10-dev | 240 | 11/27/2025 |
| 3.1.9-dev | 229 | 11/26/2025 |
| 3.1.7-dev | 216 | 11/25/2025 |
| 3.1.6 | 47,625 | 11/12/2025 |
| 3.1.5 | 19,703 | 7/10/2025 |
| 3.1.4 | 336 | 7/8/2025 |
| 3.1.3 | 296 | 7/8/2025 |
| 3.1.2 | 117,758 | 10/15/2024 |
| 3.1.1 | 25,741 | 8/14/2024 |
| 3.1.0 | 315 | 8/14/2024 |
| 3.0.14-dev3 | 219 | 8/14/2024 |
| 3.0.14-dev2 | 217 | 8/14/2024 |
| 3.0.14-dev | 227 | 8/14/2024 |
Development snapshot (-dev prerelease). Changelog will evolve during the development cycle.