
How to Convert PDF to PNG in C#
There are many programmatic solutions available for converting PDF documents to popular image formats such as JPG, PNG, SVG, and more. This blog post installs a feature‑rich PDF conversion library in a .NET project and shows how to convert PDF to PNG in C# with just a few lines of code. Let’s start the tutorial and reach the goal quickly.
We will cover:
PDF to PNG Conversion C# library installation
This library offers many features to manipulate and process PDF documents programmatically. You can configure it by downloading the DLL files or install it via the NuGet package manager.
Install-Package Aspose.Words
How to Convert PDF to PNG in C#
In this section we write code that automates PDF to PNG conversion in a .NET application.
Follow these steps:
- Instantiate a Document object and load the source PDF file.
- Create an ImageSaveOptions object and set the format to PNG.
- Set the “PageSet” property to “0” to convert only the first page.
- Adjust image brightness with the ImageBrightness property.
- Adjust contrast with the ImageContrast property.
- Change horizontal resolution using the HorizontalResolution property.
- Call the save method to write the file in PNG format.
Copy & paste the following code into your main file:
The output appears as shown below:

Get a Free License
You can obtain a free temporary license to try the API without evaluation limits.
Summing up
You have learned how to convert PDF to PNG in C# by following the steps and code snippet. This guide helps you build a PDF to PNG C# converter programmatically. For more methods, visit the documentation.
We also recommend the Getting Started guide.
Stay tuned to conholdate.com for new blog posts and updates.
Ask a question
Post your questions or queries on our forum.
FAQs
How do you change a PDF to a picture file?
Instantiate a Document object, load the PDF, and invoke the save method to export it as a PNG file.