This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/dotnet/conversion/any-image-to-pdf.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Convert any image to PDF in .NET | Nutrient .NET SDK
Any Image to PDF

Nutrient .NET SDK converts image files to PDF without optical character recognition. The resulting PDF preserves the image content, but text in the image isn’t searchable. To create a searchable PDF, refer to the image-to-searchable-PDF guide.

Download sample

For mixed raster content compression, which can reduce file size, refer to the hypercompression guide.

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("");

Convert an image to PDF

The following example converts a BMP image to PDF:

using GdPictureDocumentConverter converter = new GdPictureDocumentConverter();
GdPictureStatus status = converter.LoadFromFile(@"input.bmp", GdPicture14.DocumentFormat.DocumentFormatBMP);
if (status != GdPictureStatus.OK)
{
throw new Exception(status.ToString());
}
status = converter.SaveAsPDF("output.pdf");
if (status != GdPictureStatus.OK)
{
throw new Exception(status.ToString());
}

Specify the source format with a member of the DocumentFormat enumeration when possible. The same workflow applies to other supported image formats.

Configure PDF output

You can configure the output with properties on GdPictureDocumentConverter, including PdfColorImageCompression, PdfBitonalImageCompression, PdfEnableColorDetection, PdfEnableLinearization, and PdfImageQuality.

This example sets the color image compression and image quality before saving the PDF:

status = converter.LoadFromFile(@"input.bmp", GdPicture14.DocumentFormat.DocumentFormatBMP);
if (status != GdPictureStatus.OK)
{
throw new Exception(status.ToString());
}
converter.PdfColorImageCompression = PdfCompression.PdfCompressionJPEG;
converter.PdfImageQuality = 50;
status = converter.SaveAsPDF("output.pdf");
if (status != GdPictureStatus.OK)
{
throw new Exception(status.ToString());
}