跳過到頁腳內容
使用IRONPDF

如何將多張圖像合併為一個PDF

This article will demonstrate how to use Adobe Acrobat Online and the IronPDF C# library to create a PDF document from multiple photos and save the newly created PDF file to the local file system. Follow the steps below:

Step 1

Open the Adobe Acrobat Online website.

How to Combine Images Into One PDF, Figure 1: Adobe Acrobat website
Adobe Acrobat website

Step 2

You will need to log in to this website. If you don't have an Adobe Account, you need to create one by clicking on the signup button. Once you have signed up, click on the login button and enter your credentials to log in to the Adobe Acrobat website.

Step 3

Once you log in, you will see the interface for Adobe Acrobat Online. There will be many options related to PDFs. Next, click on the "All tools" tab.

How to Combine Images Into One PDF, Figure 2: Navigate to Adobe Acrobat Online page
Navigate to Adobe Acrobat Online page

Step 4

After that, you will see the list of tools offered by Adobe Acrobat Online and select the "JPG to PDF" tool.

How to Combine Images Into One PDF, Figure 3: Navigate to JPG to PDF tool on the website
Navigate to JPG to PDF tool on the website

Step 5

This will now open a popup for the JPG-to-PDF tool. You will see the options to "Drag and Drop files" and "Add a file from your device". You will be able to drag and drop multiple pictures or select all the images from the device from either the same folder or a different folder.

How to Combine Images Into One PDF, Figure 4: Drag-and-drop file modal for JPG to PDF
Drag-and-drop file modal for JPG to PDF

After selecting all the photos, click on the continue button. This will merge multiple images into a single PDF file. The process will merge images without using third-party apps in a single document.

How to Combine Images Into One PDF, Figure 5: Adobe Acrobat processing through uploaded files
Adobe Acrobat processing through uploaded files

After conversion, you will see the output PDF in a tab. You can download the PDF to your system by clicking on the download tray button.

IronPDF: C# PDF Library

The IronPDF C# PDF library is a .NET library for reading, writing, and customizing PDF documents. The IronPDF C# library seeks to provide the most complete, accurate, and cross-platform source of information about PDFs. It offers a high-level API that is designed to be as intuitive as possible. The library provides access to the vast majority of features available in Adobe Acrobat, including those not provided free of charge.

The library provides methods and properties that enable you to read and write PDF files using just a few lines of code. You can convert PDFs between different versions, read text from PDFs and metadata from PDFs without extracting them, add pages to existing documents, insert images onto pages at various positions and scales, extract text from pages within documents, create a new PDF from an existing document, and more. The library also includes support for images of various bit depths and formats, including PNGs and convert multi-frame TIFFs to PDFs. You can use the library to create your own PDFs or work with other people's PDFs. The library also provides support for creating and manipulating bookmarks within PDFs, finding text within PDFs, extracting text from PDFs, extracting shapes from documents and adding them to new PDFs, splitting PDF documents into pages and merging them back together again.

This section will use the IronPDF library to create a PDF file using multiple images. Let's now examine the code example for doing this.

Code Example

// Install the IronPdf NuGet package using the command: PM> Install-Package IronPdf
using IronPdf;
using System.IO;
using System.Linq;

class Program
{
    static void Main()
    {
        // Get enumerable images from a specific folder.
        var ImageFiles = Directory.EnumerateFiles(@"C:\project\assets")
                                  .Where(f => f.EndsWith(".jpg") || f.EndsWith(".jpeg"));

        // Convert the images to a PDF and save it to the specified location.
        ImageToPdfConverter.ImageToPdf(ImageFiles).SaveAs(@"C:\project\composite.pdf");

        // Note: Use PdfDocument.RasterizeToImageFiles() method 
        // to flatten a PDF into images or thumbnails if needed.
    }
}
// Install the IronPdf NuGet package using the command: PM> Install-Package IronPdf
using IronPdf;
using System.IO;
using System.Linq;

class Program
{
    static void Main()
    {
        // Get enumerable images from a specific folder.
        var ImageFiles = Directory.EnumerateFiles(@"C:\project\assets")
                                  .Where(f => f.EndsWith(".jpg") || f.EndsWith(".jpeg"));

        // Convert the images to a PDF and save it to the specified location.
        ImageToPdfConverter.ImageToPdf(ImageFiles).SaveAs(@"C:\project\composite.pdf");

        // Note: Use PdfDocument.RasterizeToImageFiles() method 
        // to flatten a PDF into images or thumbnails if needed.
    }
}
' Install the IronPdf NuGet package using the command: PM> Install-Package IronPdf
Imports IronPdf
Imports System.IO
Imports System.Linq

Friend Class Program
	Shared Sub Main()
		' Get enumerable images from a specific folder.
		Dim ImageFiles = Directory.EnumerateFiles("C:\project\assets").Where(Function(f) f.EndsWith(".jpg") OrElse f.EndsWith(".jpeg"))

		' Convert the images to a PDF and save it to the specified location.
		ImageToPdfConverter.ImageToPdf(ImageFiles).SaveAs("C:\project\composite.pdf")

		' Note: Use PdfDocument.RasterizeToImageFiles() method 
		' to flatten a PDF into images or thumbnails if needed.
	End Sub
End Class
$vbLabelText   $csharpLabel

In the above code, it is very easy to convert multiple images to a PDF file with just a few lines of code. This is the power of IronPDF. You don't need to go online and log in to a website. Simply open the editor and write some code — and your PDF converter is ready to use. For more details, please visit the Image to PDF conversion examples.

Licensing

IronPDF is totally free for development purposes. However, at the production level, payment is required. IronPDF offers three plans. The Lite plan is for individual developers, and the professional plan is for individuals or teams that need powerful PDF software without any limitations. The unlimited plan is designed for large corporations and agencies that need an enterprise-level solution. All three plans are free of charge during the development, evaluation, or testing phases, but if you decide to use IronPDF in production, you'll need to pay the license fee. For new users, there is a free trial with no strings attached! You can also purchase five Iron Software products for the price of two. Visit IronPDF licensing details for more information.

常見問題解答

如何使用 C# 將多張圖片合併到一張 PDF 檔案中?

您可以使用 IronPDF 的ImageToPdfConverter類別將多個影像轉換為單一 PDF 檔案。首先,安裝 IronPDF NuGet 包,然後編寫一個 C# 腳本來列出您的映像文件,並使用轉換器建立並儲存 PDF 文件。

如何在不使用線上工具的情況下將 JPG 轉換為 PDF?

透過使用 IronPDF,您可以以程式設計方式將 JPG 影像轉換為 PDF,從而繞過線上工具並直接在您的應用程式中執行轉換。

是否可以離線將圖片合併到 PDF 檔案中?

是的,使用 IronPDF,您可以利用其全面的 C# 庫離線將影像合併到 PDF 中,該庫提供了在沒有網路連線的情況下轉換和操作 PDF 文件的功能。

IronPDF是否支援將各種影像格式轉換為PDF?

IronPDF 支援將包括 JPG、PNG 和 TIFF 在內的多種影像格式轉換為 PDF,使其能夠靈活滿足不同的影像到 PDF 轉換需求。

如何處理PDF庫的許可問題?

IronPDF 提供多種授權選項:個人開發者的 Lite 版、團隊導向的 Professional 版以及大型企業的 Unlimited 版。該庫可免費用於開發,但用於生產環境則需要購買許可證。

我可以使用 C# 庫從 PDF 中提取文字嗎?

IronPDF 提供從 PDF 文件中提取文字的方法,使開發人員能夠以程式設計方式存取和操作文字內容。

與線上服務相比,使用 C# 庫建立 PDF 有哪些優勢?

使用 IronPDF 可以直接在應用程式中自動建立 PDF,與需要網路存取和帳戶登入的線上服務相比,可提供更大的控制、安全性和靈活性。

我如何在購買前試用PDF庫?

IronPDF 提供免費試用,讓您在購買前評估其功能和特性,確保其滿足您的特定需求。

IronPDF 是否支援與 .NET 10 結合使用,將影像合併到 PDF 中?

是的,IronPDF 完全相容於 .NET 10。您可以在 .NET 10 專案中使用相同的ImageToPdfConverter方法將影像合併到 PDF 中,無需任何額外的配置或變通方法。 IronPDF 的跨平台支援包括 .NET 10 等框架。

Curtis Chau
技術作家

Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。