This quick how-to tutorial explains the step-by-step procedure to convert PDF to JPG in C#. This post provides thorough information on configuring the document conversion library, stepwise instructions to do document transformation, and sample code that shows the implementation of the PDF to JPG converter C# functionality. Here are the detailed instructions and a working example.
Steps to Convert PDF to JPG in C#
- Install GroupDocs.Conversion for .NET package from the NuGet in the .NET application for implementing PDF to JPG C# functionality
- Add a reference to the GroupDocs.Conversion namespace to transform PDF to JPG
- Create an object of the Converter class and pass PDF to its constructor
- Create an instance of the ImageConvertOptions class and set convert options for customizing the output JPG document
- Finally, save the converted JPG image to the disk by calling the Convert method of the Converter class and supplying the required arguments
We have listed the above points that allow users to easily convert PDF to JPG using C#. You can start working on implementing this feature by installing the required package from NuGet and importing the essential namespaces. Then, load the input PDF document by creating an instance of the Converter class and customize the JPG image by defining the parameters using ImageConvertOptions class. The converted JPG image can be saved to disk by calling the Convert method.
Code to Convert PDF to JPG in C#
We have developed the above sample code to show the implementation of the C# convert PDF to JPG capability. We have created three-fours lines of code and consumed a few API calls of the document conversion library for performing the document transformation. Further, this example can be run on any operating system like MS Windows, Linux, and Mac OS without installing any third-party software. Moreover, you can quickly convert PDF documents to a variety of other image formats including PNG, TIFF, GIF, BMP, SVG, and many more.
We have focused on the document conversion process for developing the C# PDF to JPG feature. We recently published an article to transform PDF to TIFF in C#, have a look at how to convert PDF to TIFF using C# post for more information.