Convert JPG to PDF in C#
JPG to PDF
JPG to PDF is one of the 100+ conversions supported by the .NET PDF conversion SDK.
Nutrient .NET SDK converts JPEG images to PDF without optical character recognition. The resulting PDF preserves the image content, but text in the image isn’t searchable.
Download samplePrepare 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 a JPG image to PDF
using GdPictureDocumentConverter converter = new GdPictureDocumentConverter();
GdPictureStatus status = converter.LoadFromFile(@"input.jpg", GdPicture14.DocumentFormat.DocumentFormatJPEG);if (status != GdPictureStatus.OK){ throw new Exception(status.ToString());}
status = converter.SaveAsPDF("output.pdf");if (status != GdPictureStatus.OK){ throw new Exception(status.ToString());}You can configure PDF output with properties such as PdfColorImageCompression, PdfEnableLinearization, and PdfImageQuality before calling SaveAsPDF.