Convert a PDF to a PNG (.NET Core/Framework)
Use DynamicPDF Rasterizer for .NET to efficiently and easily convert any PDF to a PNG image.
Watch the Video
Converting a PDF to PNG
Follow these steps and sample code example to convert a PDF file to PNGimages.
Steps
- Create a
PdfRasterizer
object using the source PDF document. - Call the
Draw
method by specifying the file path to save the image, the image type as PNG, and the dots per inch as 300 (DPI300).
Sample code - C#
PdfRasterizer rasterizer = new PdfRasterizer("doc-a.pdf");
rasterizer.Draw("output.png", ImageFormat.Png, ImageSize.Dpi300);
Getting Started
The NuGet package and an example project are provided to get started.
NuGet Package
DynamicPDF Rasterizer for .NET on NuGet with package ID ceTe.DynamicPDF.Rasterizer.NET
.
Install directly in Visual Studio using the NuGet Package Manager.
Example Project
Clone or view the sample project on GitHub for an example illustrating how to convert a PDF to a PNG.
DynamicPDF Rasterizer Information
For more information, refer to the online help documentation.