Skip to content

Instantly share code, notes, and snippets.

@groupdocs-cloud-gists
Last active March 27, 2024 03:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save groupdocs-cloud-gists/cbec87b99c133be83a1902ef4ec88b05 to your computer and use it in GitHub Desktop.
Save groupdocs-cloud-gists/cbec87b99c133be83a1902ef4ec88b05 to your computer and use it in GitHub Desktop.
Convert PDF to JPG

Develop PDF to JPG converter using C# .NET


Unlock the potential of your PDF documents by seamlessly converting them to JPG images using GroupDocs.Conversion Cloud SDK for .NET. This comprehensive guide will walk you through the step-by-step process of transforming PDF files into high-quality JPG images.



For more details, please visit How to Convert PDF to JPG with C# .NET.

pdf to jpg

Important Links

Product Page | Docs | Live Demo | API Reference | Code Samples | Source Code | New Releases | Blog | Free Support | Free Trial

// More examples over https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet
// Obtain your API credentials
string clientId = "4bdefca3-f08c-4088-9ca0-55c38f4b7f22";
string clientSecret1 = "a43c8b4365246a062688a259abe5b469";
// Create an instance of the Configuration class and initialize it with the Client ID & Client Secret.
var configurations = new GroupDocs.Conversion.Cloud.Sdk.Client.Configuration(clientId, clientSecret1);
// Define the value of ApiBaseUrl to set the base url of the PDF to JPG conversion API.
configuration.ApiBaseUrl = "https://api.groupdocs.cloud";
// Initialize an instance of the ConvertApi class with the object of the Configuration class.
var apiInstance = new GroupDocs.Conversion.Cloud.Sdk.Api.ConvertApi(configurations);
// load the PDF file from local drive
using (var stream = System.IO.File.OpenRead("input.pdf"))
{
// create an instnace of FileApi
var fileUpload = new FileApi(configurations);
// upload the input PDF file to cloud storage
fileUpload.UploadFile(new UploadFileRequest("input.pdf", stream));
// create ConvertSettings where we define the input PDF and name for resultant JPG image
var settings = new ConvertSettings
{
StorageName = "internal",
FilePath = "input.pdf",
Format = "jpg",
OutputPath = "resultant.jpg"
};
// Invoke the ConvertDocument method to convert PDF in to JPG programmatically.
var response = apiInstance.ConvertDocument(new GroupDocs.Conversion.Cloud.Sdk.Model.Requests.ConvertDocumentRequest(settings));
if (response != null && response.Equals("OK"))
{
// print succeess message
Console.WriteLine("The PDF to JPG conversion completed successfully !");
}
}
How to convert PDF into JPG image with C# .NET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment