Convert PDF to JPG/JPEG (.NET Core/Framework)
DynamicPDF Rasterizer for .NET can rasterize any PDF document into an image. This supports creating BMP, JPEG, GIF, TIFF and PNG images from a PDF with different options to set image size, DPI etc.
Watch the Video
Converting a PDF to JPG
Below are the steps and sample code to convert a PDF file to JPG images.
Steps to convert PDF to JPG
- 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, and DPI.
Sample code - C#
PdfRasterizer rasterizer = new PdfRasterizer("doc-a.pdf");
rasterizer.Draw("output.jpg", ImageFormat.Jpeg, ImageSize.Dpi72);
GitHub Project
Clone or view the example project at GitHub. This example on this page is in the PdfToImageRasterizerExample.cs file.
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.
DynamicPDF Rasterizer Information
For more information, refer to the online help documentation.