图片转PDF
using IronPdf;
using System.IO;
using System.Linq;

// One or more images as IEnumerable. This example selects all JPEG images in a specific 'assets' folder.
var imageFiles = Directory.EnumerateFiles("assets").Where(f => f.EndsWith(".jpg") || f.EndsWith(".jpeg"));

// Converts the images to a PDF and save it.
ImageToPdfConverter.ImageToPdf(imageFiles).SaveAs("composite.pdf");

// Also see PdfDocument.RasterizeToImageFiles() method to flatten a PDF to images or thumbnails
NuGet Download
PM > Install-Package IronPdf
图片转PDF

图片转PDF

假设有一张单独的图像位于计算机的IronPdf.ImageToPdfConverter.ImageToPdf方法并提供其文件路径,快速将其转换为PDF文档:

您也可以使用ImageToPdfConverter将多张图像转换为单一PDF文档:

要了解有关使用IronPDF将图像转换为PDF以增强您的应用程序的更多信息,或发现Iron Software提供的完整开发者工具套件,包括IronBarcode、IronOCR等,请访问Iron Software网站。

学习使用 IronPDF 将图像转换为 PDF

System.IO.Directory.EnumerateFiles

ImageToPdfConverter.ImageToPdf

在 GitHub 上查看

准备开始了吗?

Nuget Downloads 21,916,531版本:2026.11刚刚发布