Skip to footer content
USING IRONPDF

How to Convert JPG to PDF in C# .NET

Converting JPG to PDF in .NET applications is a common requirement for developers working on enterprise document management systems or compliance-driven workflows. Building document archival tools, photo repositories, or automated reporting systems for regulated industries all introduce this need regularly. Free JPG to PDF online services exist for quick conversions -- you can upload images and download the converted PDF in seconds. But for serious enterprise automation with audit trail requirements, those browser-based solutions lack the programmatic control, security, and compliance guarantees that software engineers need.

IronPDF provides a powerful JPG to PDF converter that transforms image files into professional PDF documents with just a few lines of C# code, complete with digital signature capabilities and encryption options. Unlike those online tools that may expose uploaded files to data risks, IronPDF runs entirely within your application infrastructure -- a secure, self-hosted solution that keeps sensitive data safely on your own Azure or on-premise servers.

// Convert JPG to PDF in one line!
IronPdf.ImageToPdfConverter.ImageToPdf("photo.jpg").SaveAs("output.pdf");
// Convert JPG to PDF in one line!
IronPdf.ImageToPdfConverter.ImageToPdf("photo.jpg").SaveAs("output.pdf");
$vbLabelText   $csharpLabel

NuGet Install with NuGet

PM >  Install-Package IronPdf

Check out IronPDF on NuGet for quick installation. With over 10 million downloads, it’s transforming PDF development with C#. You can also download the DLL or Windows installer.

How Do You Convert a JPG File to a PDF Document in C#?

Converting a single JPG file to a PDF document requires just one method call with IronPDF's ImageToPdfConverter class. This image to PDF converter handles the entire conversion process automatically, preserving image quality while generating a properly formatted PDF file that meets PDF/A compliance standards for long-term archival.

using IronPdf;

// Convert a single JPG image to PDF
PdfDocument pdf = ImageToPdfConverter.ImageToPdf("inputImage.jpg");

// Add metadata for compliance tracking
pdf.MetaData.Author = "Enterprise System";
pdf.MetaData.CreationDate = DateTime.Now;
pdf.MetaData.Keywords = "JPG-Conversion,Compliance-Ready";

// Apply security settings for sensitive documents
pdf.SecuritySettings.AllowUserPrinting = true;
pdf.SecuritySettings.AllowUserEditing = false;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;

// Save the converted PDF to disk
pdf.SaveAs("output.pdf");
using IronPdf;

// Convert a single JPG image to PDF
PdfDocument pdf = ImageToPdfConverter.ImageToPdf("inputImage.jpg");

// Add metadata for compliance tracking
pdf.MetaData.Author = "Enterprise System";
pdf.MetaData.CreationDate = DateTime.Now;
pdf.MetaData.Keywords = "JPG-Conversion,Compliance-Ready";

// Apply security settings for sensitive documents
pdf.SecuritySettings.AllowUserPrinting = true;
pdf.SecuritySettings.AllowUserEditing = false;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;

// Save the converted PDF to disk
pdf.SaveAs("output.pdf");
$vbLabelText   $csharpLabel

The converter integrates with your existing logging infrastructure, enabling detailed audit trails for compliance reporting. For enterprise deployments requiring high availability, consider implementing asynchronous conversion patterns to handle concurrent requests efficiently.

What Does the Converted PDF Output Look Like?

Screenshot of a PDF viewer displaying a converted image file showing 'The C# PDF Library' website page centered between white space

The ImageToPdf method accepts a file path to your JPG or JPEG image and returns a PdfDocument object that supports advanced manipulation features. This PDF converter supports images stored on disk, network locations, or Azure Blob Storage for cloud-native architectures. The resulting PDF file maintains the original resolution and color fidelity, ensuring photos, scanned documents, and compliance records look exactly as intended.

IronPDF's converter supports Windows, Mac, and Linux operating systems, including containerized deployments in Docker and AWS Lambda, so you can deploy your image to PDF solution across any enterprise environment without additional software dependencies.

How Do You Convert Multiple JPG Images Into One PDF File?

Combining multiple JPG files into a single PDF document is essential for creating consolidated reports, archiving batches of scanned documents, or assembling multi-page compliance packages. The JPG to PDF converter accepts an array of file paths, merging all images into a single PDF with each image on its own page while maintaining proper page numbering.

using IronPdf;

// Define multiple JPG images to convert
string[] jpgImages = { "page1.jpg", "page2.jpeg", "page3.jpg" };

// Validate all files exist before processing
foreach (var imagePath in jpgImages)
{
    if (!File.Exists(imagePath))
    {
        throw new FileNotFoundException($"Required image not found: {imagePath}");
    }
}

// Convert all images into a single PDF document
PdfDocument pdf = ImageToPdfConverter.ImageToPdf(jpgImages);

// Add headers for document identification
pdf.AddHtmlHeaders(new HtmlHeaderFooter()
{
    HtmlFragment = "<div style='text-align:center'>Confidential - {date}</div>",
    Height = 25
});

// Apply compression for optimal file size
pdf.CompressImages(70);

// Save the combined PDF
pdf.SaveAs("combined-document.pdf");
using IronPdf;

// Define multiple JPG images to convert
string[] jpgImages = { "page1.jpg", "page2.jpeg", "page3.jpg" };

// Validate all files exist before processing
foreach (var imagePath in jpgImages)
{
    if (!File.Exists(imagePath))
    {
        throw new FileNotFoundException($"Required image not found: {imagePath}");
    }
}

// Convert all images into a single PDF document
PdfDocument pdf = ImageToPdfConverter.ImageToPdf(jpgImages);

// Add headers for document identification
pdf.AddHtmlHeaders(new HtmlHeaderFooter()
{
    HtmlFragment = "<div style='text-align:center'>Confidential - {date}</div>",
    Height = 25
});

// Apply compression for optimal file size
pdf.CompressImages(70);

// Save the combined PDF
pdf.SaveAs("combined-document.pdf");
$vbLabelText   $csharpLabel

This approach lets you convert multiple JPG images in the desired order -- simply arrange the file paths in your array accordingly. The PDF converter works efficiently even with large batches of JPG pictures, processing hundreds of images in seconds on modern hardware.

For enterprise scenarios such as invoice processing, medical record digitization, or legal document archival, you can enumerate image files in a directory and pass them directly to the converter. This enables automated workflows that convert JPG to PDF without manual intervention, supporting HIPAA-compliant workflows with appropriate security controls such as encryption and permission restrictions.

What Image Formats Does the JPG to PDF Converter Support?

IronPDF's image to PDF tool supports multiple image formats beyond JPG and JPEG, providing flexibility for diverse enterprise requirements. You can convert PNG, BMP, GIF, and TIFF files using the same straightforward API, ensuring your application can handle whatever image formats your business processes require.

The following table summarizes the supported image formats and their typical use cases:

Image Formats Supported by IronPDF's ImageToPdfConverter
Format Extension(s) Typical Use Case Notes
JPEG .jpg, .jpeg Photos, scanned documents Lossy compression; ideal for photographs
PNG .png Screenshots, graphics with transparency Lossless; preserves transparent backgrounds
TIFF .tif, .tiff Medical imaging, archival scans Supports multi-page TIFF files
BMP .bmp Legacy scanning systems Uncompressed; large file sizes
GIF .gif Simple graphics, icons Limited color palette (256 colors)
using IronPdf;

// Convert any supported image format using the same API
string imagePath = "document.tiff";

PdfDocument pdf = ImageToPdfConverter.ImageToPdf(imagePath);

// Apply enterprise metadata standards
pdf.MetaData.Producer = "Enterprise Document System v2.0";

pdf.SaveAs("output.pdf");
using IronPdf;

// Convert any supported image format using the same API
string imagePath = "document.tiff";

PdfDocument pdf = ImageToPdfConverter.ImageToPdf(imagePath);

// Apply enterprise metadata standards
pdf.MetaData.Producer = "Enterprise Document System v2.0";

pdf.SaveAs("output.pdf");
$vbLabelText   $csharpLabel

How Does PNG to PDF Conversion Quality Compare?

IronPDF for .NET logo featuring a colorful hashtag symbol with 'PDF' in the center and the product name below

The converter automatically detects the image format and applies appropriate processing, maintaining color accuracy crucial for medical imaging or design documents. Whether working with compressed JPEG photos from mobile devices, high-fidelity PNG graphics with transparency, or legacy BMP files from scanning systems, the PDF conversion produces consistent, high-quality results.

This same converter architecture can also process DOCX files and other document types, making IronPDF a versatile document processing solution for your entire enterprise content management stack.

How Do You Preserve Image Quality in the Converted PDF?

Maintaining image quality during PDF conversion is critical for professional documents, especially in industries with strict visual fidelity requirements like healthcare imaging or engineering drawings. IronPDF preserves the original resolution of JPG images by default, ensuring no degradation occurs during the conversion process. You can also apply lossless compression options to manage file size without sacrificing visual fidelity.

using IronPdf;

// Convert image maintaining original quality
PdfDocument pdf = ImageToPdfConverter.ImageToPdf("high-res-scan.jpg");

// Apply linearization for fast web viewing (archival quality)
pdf.SaveAsLinearized("output-linearized.pdf");

// Alternatively, apply controlled compression when file size matters
pdf.CompressImages(90); // 90 = near-lossless
pdf.SaveAs("output-compressed.pdf");
using IronPdf;

// Convert image maintaining original quality
PdfDocument pdf = ImageToPdfConverter.ImageToPdf("high-res-scan.jpg");

// Apply linearization for fast web viewing (archival quality)
pdf.SaveAsLinearized("output-linearized.pdf");

// Alternatively, apply controlled compression when file size matters
pdf.CompressImages(90); // 90 = near-lossless
pdf.SaveAs("output-compressed.pdf");
$vbLabelText   $csharpLabel

For scenarios where you need to balance file size against image quality for cloud storage optimization, IronPDF provides granular compression controls that let you reduce the converted PDF size while controlling quality trade-offs. You can also rotate PDF pages when source images have incorrect orientation from scanning processes.

The PDF converter works with high-resolution photos and scanned documents without imposing arbitrary limits, unlike free service alternatives that may compress or add watermarks to the output. This ensures digitally signed documents maintain their legal validity and archival records remain court-admissible. For background on JPEG compression and image quality trade-offs, refer to the JPEG standard overview on Wikipedia.

How Do You Customize Page Size and Orientation?

Controlling the output PDF format gives you flexibility for different enterprise use cases, from standard letter-size reports to custom forms. IronPDF allows you to specify page dimensions and orientation when creating a new PDF document from images, supporting both standard paper sizes and custom dimensions.

using IronPdf;

// Create renderer with custom page settings
ChromePdfRenderer renderer = new ChromePdfRenderer();

// Configure for standard business documents
renderer.RenderingOptions.PaperSize = IronPdf.Rendering.PdfPaperSize.A4;
renderer.RenderingOptions.PaperOrientation = IronPdf.Rendering.PdfPaperOrientation.Portrait;
renderer.RenderingOptions.MarginTop = 25;
renderer.RenderingOptions.MarginBottom = 25;
renderer.RenderingOptions.MarginLeft = 20;
renderer.RenderingOptions.MarginRight = 20;

// Apply a corporate logo header
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter()
{
    HtmlFragment = "<img src='corporate-logo.png' style='height:30px'/>",
    Height = 40
};

// Wrap the image in HTML to control layout precisely
string imageHtml = @"
    <html>
    <body style='margin:0'>
        <img src='wide-photo.jpg' style='width:100%; max-width:100%'/>
    </body>
    </html>";

PdfDocument pdf = renderer.RenderHtmlAsPdf(imageHtml);

// Add page numbers for multi-page documents
pdf.AddTextFooters("{page} of {total-pages}", IronPdf.Font.FontFamily.Arial, 10);

pdf.SaveAs("formatted-document.pdf");
using IronPdf;

// Create renderer with custom page settings
ChromePdfRenderer renderer = new ChromePdfRenderer();

// Configure for standard business documents
renderer.RenderingOptions.PaperSize = IronPdf.Rendering.PdfPaperSize.A4;
renderer.RenderingOptions.PaperOrientation = IronPdf.Rendering.PdfPaperOrientation.Portrait;
renderer.RenderingOptions.MarginTop = 25;
renderer.RenderingOptions.MarginBottom = 25;
renderer.RenderingOptions.MarginLeft = 20;
renderer.RenderingOptions.MarginRight = 20;

// Apply a corporate logo header
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter()
{
    HtmlFragment = "<img src='corporate-logo.png' style='height:30px'/>",
    Height = 40
};

// Wrap the image in HTML to control layout precisely
string imageHtml = @"
    <html>
    <body style='margin:0'>
        <img src='wide-photo.jpg' style='width:100%; max-width:100%'/>
    </body>
    </html>";

PdfDocument pdf = renderer.RenderHtmlAsPdf(imageHtml);

// Add page numbers for multi-page documents
pdf.AddTextFooters("{page} of {total-pages}", IronPdf.Font.FontFamily.Arial, 10);

pdf.SaveAs("formatted-document.pdf");
$vbLabelText   $csharpLabel

What Customization Options Are Available for PDF Output?

The IronPDF homepage demonstrates the library's capabilities with syntax-highlighted C# code examples, including HTML to PDF conversion and document rendering methods

This technique wraps the image in HTML, giving you precise control over how JPG images appear on PDF pages while maintaining CSS styling consistency. You can set margins, apply scaling, add watermarks, and position images exactly where needed in the single PDF file, supporting complex layout requirements for regulatory documents.

For advanced rendering customization including viewport control and JavaScript rendering delays, explore IronPDF's rendering options documentation.

How Do You Add Headers, Footers, and Watermarks to Converted PDFs?

Adding headers, footers, and watermarks to converted PDFs is straightforward with IronPDF. These elements are essential for compliance workflows, branding consistency, and document identification in enterprise systems. Headers and footers can include dynamic content such as the current date, page numbers, and custom HTML. Watermarks -- both text and image-based -- can be stamped onto every page using the custom watermark API.

using IronPdf;

// Convert JPG to PDF
PdfDocument pdf = ImageToPdfConverter.ImageToPdf("invoice-scan.jpg");

// Add a text watermark for draft documents
pdf.ApplyWatermark("<h1 style='color:red;opacity:0.3'>DRAFT</h1>", rotation: 45, opacity: 80);

// Add a footer with the page number and date
pdf.AddHtmlFooters(new HtmlHeaderFooter()
{
    HtmlFragment = "<div style='text-align:right;font-size:10px'>Page {page} of {total-pages} -- {date}</div>",
    Height = 20
});

pdf.SaveAs("watermarked-invoice.pdf");
using IronPdf;

// Convert JPG to PDF
PdfDocument pdf = ImageToPdfConverter.ImageToPdf("invoice-scan.jpg");

// Add a text watermark for draft documents
pdf.ApplyWatermark("<h1 style='color:red;opacity:0.3'>DRAFT</h1>", rotation: 45, opacity: 80);

// Add a footer with the page number and date
pdf.AddHtmlFooters(new HtmlHeaderFooter()
{
    HtmlFragment = "<div style='text-align:right;font-size:10px'>Page {page} of {total-pages} -- {date}</div>",
    Height = 20
});

pdf.SaveAs("watermarked-invoice.pdf");
$vbLabelText   $csharpLabel

This pattern is particularly useful for regulated industries where every distributed document must carry a classification marking or a draft indicator until final approval. Combined with digital signatures, watermarks provide a complete chain-of-custody record for audit trail systems.

How Do You Secure PDF Documents After Converting from JPG?

Security is non-negotiable for documents containing sensitive imagery -- medical scans, financial records, and legal exhibits all require access controls. After converting JPG images to PDF, IronPDF lets you apply password protection and permission restrictions in the same workflow.

using IronPdf;

// Convert the image
PdfDocument pdf = ImageToPdfConverter.ImageToPdf("medical-scan.jpg");

// Set an owner password (admin) and a user password (read-only access)
pdf.SecuritySettings.OwnerPassword = "admin-secret";
pdf.SecuritySettings.UserPassword = "readonly-access";

// Restrict editing and copying, but allow printing
pdf.SecuritySettings.AllowUserPrinting = true;
pdf.SecuritySettings.AllowUserEditing = false;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserAnnotations = false;

// Encrypt with AES-256
pdf.SecuritySettings.EncryptionLevel = PdfEncryptionLevel.AES_256;

pdf.SaveAs("secured-medical-scan.pdf");
using IronPdf;

// Convert the image
PdfDocument pdf = ImageToPdfConverter.ImageToPdf("medical-scan.jpg");

// Set an owner password (admin) and a user password (read-only access)
pdf.SecuritySettings.OwnerPassword = "admin-secret";
pdf.SecuritySettings.UserPassword = "readonly-access";

// Restrict editing and copying, but allow printing
pdf.SecuritySettings.AllowUserPrinting = true;
pdf.SecuritySettings.AllowUserEditing = false;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserAnnotations = false;

// Encrypt with AES-256
pdf.SecuritySettings.EncryptionLevel = PdfEncryptionLevel.AES_256;

pdf.SaveAs("secured-medical-scan.pdf");
$vbLabelText   $csharpLabel

For deployments targeting PDF/A-3 for long-term archival, IronPDF can convert and validate against the ISO 19005 standard in a single pass. This is particularly relevant for healthcare and legal verticals where document retention policies mandate archival-safe formats.

IronPDF supports Windows, Mac, and Linux deployments with the same security API surface, so security policies are portable across environments. Learn more about platform-specific setup in the IronPDF Linux guide.

What Are Your Next Steps?

IronPDF transforms JPG to PDF .NET development from a multi-step task into a reliable, single-method operation with enterprise-grade security and compliance features. The library handles single images, multiple JPG files, and a range of image formats with consistent, high-quality results -- without relying on external online services that could compromise data sovereignty.

Unlike PDF converter drag-and-drop websites, IronPDF gives you programmatic control for automated document workflows, batch processing, and enterprise integration with full API documentation. The converter processes images efficiently while maintaining quality and audit trails, making it suitable for applications ranging from healthcare document management to financial compliance systems.

Key enterprise benefits include:

Start your free trial to experience how IronPDF simplifies image to PDF conversion in your .NET projects with enterprise-grade security, or explore the full licensing options for production deployment.

Frequently Asked Questions

How do you convert a single JPG file to PDF in C#?

Call ImageToPdfConverter.ImageToPdf("photo.jpg") from IronPDF. This returns a PdfDocument object you can save with .SaveAs("output.pdf"). No additional configuration is required for a basic conversion.

Can IronPDF combine multiple JPG images into one PDF file?

Yes. Pass a string array of file paths to ImageToPdfConverter.ImageToPdf(new string[] { "page1.jpg", "page2.jpg" }). Each image becomes a separate page in the combined PDF, in the order provided.

What image formats does IronPDF's converter support?

IronPDF supports JPEG, PNG, TIFF (including multi-page), BMP, and GIF files through the same ImageToPdfConverter API. The library detects the format automatically.

How do you preserve image quality when converting JPG to PDF?

IronPDF preserves the original resolution by default. For archival output, use pdf.SaveAsLinearized(). To control file size, use pdf.CompressImages(quality) where quality is between 1 and 100.

How do you customize the page size of the output PDF?

Use ChromePdfRenderer with RenderingOptions.PaperSize and RenderingOptions.PaperOrientation to set any standard or custom page size. Wrap the image in an HTML string and render it with RenderHtmlAsPdf() for full layout control.

How do you add a watermark to a PDF converted from JPG?

After converting, call pdf.ApplyWatermark(htmlFragment, rotation, opacity) to stamp a text or image watermark on every page. HTML watermarks support custom fonts, colors, and opacity.

How do you password-protect a PDF after converting from JPG?

Set pdf.SecuritySettings.OwnerPassword and pdf.SecuritySettings.UserPassword, then configure AllowUserPrinting, AllowUserEditing, and AllowUserCopyPasteContent. Set pdf.SecuritySettings.EncryptionLevel to PdfEncryptionLevel.AES_256 for strongest encryption.

Does IronPDF support PDF/A archival format for converted images?

Yes. IronPDF can convert images to PDF/A-compliant documents for long-term archival, meeting ISO 19005 requirements used in healthcare, legal, and government document retention policies.

On which platforms does IronPDF run for JPG to PDF conversion?

IronPDF supports Windows, macOS, and Linux, including Docker containers and AWS Lambda. The same API surface works across all platforms without additional dependencies.

Why use IronPDF instead of an online JPG to PDF converter?

Online converters require uploading files to third-party servers, which creates data exposure risks and limits automation. IronPDF runs entirely within your application, giving you programmatic control, security policies, audit trails, and no external service dependency.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...

Read More

Iron Support Team

We're online 24 hours, 5 days a week.
Chat
Email
Call Me