Convert PDF to other images in C#
PDF to Other Image
Nutrient .NET SDK can render a PDF page to additional image formats supported by GdPictureImaging, such as WEBP, GIF, JP2, and TGA.
Prepare the project
Register the SDK license before running conversion operations. For setup details, refer to the getting started with .NET SDK guide.
using GdPicture14;
LicenseManager license = new LicenseManager();license.RegisterKEY("");using GdPicturePDF pdf = new GdPicturePDF();using GdPictureImaging imaging = new GdPictureImaging();
pdf.LoadFromFile(@"input.pdf");pdf.SelectPage(1);int imageId = pdf.RenderPageToGdPictureImageEx(200, true);GdPictureStatus status = pdf.GetStat();if (status != GdPictureStatus.OK){ throw new Exception(status.ToString());}
status = imaging.SaveAsWEBP(imageId, "output.webp", 90f, 4);if (status != GdPictureStatus.OK){ throw new Exception(status.ToString());}imaging.ReleaseGdPictureImage(imageId);pdf.CloseDocument();Replace SaveAsWEBP with the corresponding format-specific method, such as SaveAsGIF, SaveAsJP2, or SaveAsTGA, for the output format you need.