제품 비교 A Comparison of Splitting PDF in C# Between iTextSharp and IronPDF 커티스 차우 업데이트됨:10월 16, 2025 다운로드 IronPDF NuGet 다운로드 DLL 다운로드 윈도우 설치 프로그램 무료 체험 시작하기 LLM용 사본 LLM용 사본 LLM용 마크다운 형식으로 페이지를 복사하세요 ChatGPT에서 열기 ChatGPT에 이 페이지에 대해 문의하세요 제미니에서 열기 제미니에게 이 페이지에 대해 문의하세요 Grok에서 열기 Grok에게 이 페이지에 대해 문의하세요 혼란 속에서 열기 Perplexity에게 이 페이지에 대해 문의하세요 공유하다 페이스북에 공유하기 트위터에 공유하기 LinkedIn에 공유하기 URL 복사 이메일로 기사 보내기 PDF (Portable Document Format) files are widely used for sharing and presenting documents, and there are times when you may need to split a PDF into multiple files. Whether you want to extract specific pages, divide a large document into smaller sections, or create individual files for each chapter, splitting PDFs can be a valuable task in various scenarios. In this article, we'll learn how to split PDFs using C#. C# is a versatile and powerful language, and there are several libraries available that make it relatively straightforward to manipulate PDFs. We will explore the following two libraries for splitting PDFs in C#. iTextSharp IronPDF How to Split PDF in C# Using iTextSharp First, install the iText7 library. Create a PdfReader from the input PDF file. Use a PdfDocument to work with the PDF content. Calculate the number of pages for each split file. Set initial page range values. Use a loop to process each split file. Create a new PdfDocument for the current split file. Copy pages from the original document to the new one. Update page range values for the next iteration. Save the completed output PDF. Repeat until all files are created. Continue the process for the specified number of split files. IronPDF IronPDF is a powerful C# library designed for working with PDF files. It provides features for creating, modifying, and extracting content from PDF documents. Developers can generate PDFs from scratch, edit existing PDFs, and merge or split them. Additionally, IronPDF excels at converting HTML content to PDF format, making it useful for generating reports or documentation. With support for digital signatures, security features, and high-quality output, IronPDF simplifies PDF-related tasks in .NET applications. iTextSharp iTextSharp (iText 7) is a widely used library for working with PDF files in the .NET framework. It provides powerful features for creating, modifying, and extracting content from PDF documents programmatically. Developers can use iTextSharp to add text, images, tables, and other graphical elements to PDFs. Additionally, it supports document assembly, digital signatures, and compliance with archival and accessibility standards. Originally a Java library, iTextSharp was ported to .NET and has an active community of developers and users. Installing the IronPDF Library To install the IronPDF NuGet package using Package Manager Console in Visual Studio, follow these steps: In Visual Studio, go to Tools -> NuGet Package Manager -> Package Manager Console. Use the following command to install the IronPDF NuGet package: Install-Package IronPdf This will download and install the IronPDF package along with its dependencies into your project. Once the installation is complete, you can start using IronPDF in your C# project for PDF-related tasks. Alternatively, you can install IronPDF using the NuGet Package Manager in Visual Studio, or add the package directly to your project file. Another option is downloading the package from the official website and manually adding it to your project. Each method provides a straightforward way to integrate IronPDF into your C# project for PDF-related functionalities. Installing the iTextSharp Library To install iTextSharp using Package Manager Console in Visual Studio, you can follow these steps: In Visual Studio, go to Tools -> NuGet Package Manager -> Package Manager Console. Use the following command to install the iTextSharp NuGet package: Install-Package itext7 Install-Package itext7 SHELL This will download and install the iTextSharp package along with its dependencies into your project. Once the installation is complete, you can start using iTextSharp in your C# project for working with PDFs. Split PDF Documents in C# Using IronPDF We can split a PDF file into multiple PDF files using IronPDF. It provides a simple way to achieve this. The following code will take the source PDF file as input and split it into multiple PDF files. using IronPdf; class Program { static void Main(string[] args) { string file = "input.pdf"; // The folder to save the split PDFs string outputFolder = "output_split"; int numberOfSplitFiles = 3; // Specify how many parts you want to split the PDF into // Call the SplitPdf method to split the PDF SplitPdfUsingIronPDF(file, outputFolder, numberOfSplitFiles); } static void SplitPdfUsingIronPDF(string inputPdfPath, string outputFolder, int numberOfSplitFiles) { // Load the input PDF PdfDocument sourceFile = PdfDocument.FromFile(inputPdfPath); // Initialize page range values int firstPage = 1; int lastPage = 2; int totalPageInOneFile = sourceFile.PageCount / numberOfSplitFiles; for (int i = 1; i <= numberOfSplitFiles; i++) { // Copy multiple pages into a new document PdfDocument newSplitPDF = sourceFile.CopyPages(firstPage, lastPage); // Generate the output file path string name = $@"{outputFolder}\SplitPDF_IronPDF_{i}.pdf"; // Save the new split PDF newSplitPDF.SaveAs(name); // Update page range values for the next iteration firstPage = lastPage + 1; lastPage += totalPageInOneFile; } } } using IronPdf; class Program { static void Main(string[] args) { string file = "input.pdf"; // The folder to save the split PDFs string outputFolder = "output_split"; int numberOfSplitFiles = 3; // Specify how many parts you want to split the PDF into // Call the SplitPdf method to split the PDF SplitPdfUsingIronPDF(file, outputFolder, numberOfSplitFiles); } static void SplitPdfUsingIronPDF(string inputPdfPath, string outputFolder, int numberOfSplitFiles) { // Load the input PDF PdfDocument sourceFile = PdfDocument.FromFile(inputPdfPath); // Initialize page range values int firstPage = 1; int lastPage = 2; int totalPageInOneFile = sourceFile.PageCount / numberOfSplitFiles; for (int i = 1; i <= numberOfSplitFiles; i++) { // Copy multiple pages into a new document PdfDocument newSplitPDF = sourceFile.CopyPages(firstPage, lastPage); // Generate the output file path string name = $@"{outputFolder}\SplitPDF_IronPDF_{i}.pdf"; // Save the new split PDF newSplitPDF.SaveAs(name); // Update page range values for the next iteration firstPage = lastPage + 1; lastPage += totalPageInOneFile; } } } $vbLabelText $csharpLabel Code Explanation The purpose of this code is to split a given PDF file into multiple smaller PDF files using the IronPDF library. The SplitPdfUsingIronPDF method is defined to achieve this functionality. Method Parameters inputPdfPath: A string representing the path to the input PDF file (e.g., "input.pdf"). outputFolder: A string representing the output folder where the split PDF files will be saved (e.g., "output_split"). numberOfSplitFiles: An integer indicating how many smaller PDF files the original PDF will be split into. Splitting Process Inside the SplitPdfUsingIronPDF method: A PdfDocument object named sourceFile is created by loading the PDF from the specified inputPdfPath. Two integer variables, firstPage and lastPage, are initialized. These represent the page range for splitting. totalPageInOneFile is calculated by dividing the total page count of the source PDF by the specified numberOfSplitFiles. A loop iterates from 1 to numberOfSplitFiles: A new PdfDocument object named newSplitPDF is created. Pages from firstPage to lastPage (inclusive) are copied from the sourceFile to newSplitPDF. The resulting smaller PDF is saved with a filename like "SplitPDF_IronPDF_1.pdf" (for the first split) in the specified output folder. The firstPage and lastPage values are updated for the next iteration. Note You should replace "input.pdf" with the actual path to your input PDF file. Ensure that the IronPDF library is properly installed and referenced in your project. The output files are created as: Split PDFs in C# Using iTextSharp Now, we will use iTextSharp to split our PDF document into multiple PDF files. The following code will take the source file as input and split that PDF document into multiple smaller files. using System; using iText.Kernel.Pdf; class Program { static void Main(string[] args) { string inputPath = "input.pdf"; // Output PDF files path (prefix for the generated files) string outputPath = "output_split"; int numberOfSplitFiles = 3; // Specify how many parts you want to split the PDF into // Call the SplitPdf method to split the PDF SplitPdfUsingiTextSharp(inputPath, outputPath, numberOfSplitFiles); } static void SplitPdfUsingiTextSharp(string inputPdfPath, string outputFolder, int numberOfSplitFiles) { using (PdfReader reader = new PdfReader(inputPdfPath)) { using (PdfDocument doc = new PdfDocument(reader)) { // Calculate the number of pages for each split file int totalPageInOneFile = doc.GetNumberOfPages() / numberOfSplitFiles; int firstPage = 1; int lastPage = totalPageInOneFile; for (int i = 1; i <= numberOfSplitFiles; i++) { // Generate the output file path string filename = $@"{outputFolder}\SplitPDF_iTextSharp_{i}.pdf"; // Create a new document and attach a writer for the specified output file using (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(filename))) { // Copy pages from the original document to the new document doc.CopyPagesTo(firstPage, lastPage, pdfDocument); } // Update page range values for the next iteration firstPage = lastPage + 1; lastPage += totalPageInOneFile; } } } } } using System; using iText.Kernel.Pdf; class Program { static void Main(string[] args) { string inputPath = "input.pdf"; // Output PDF files path (prefix for the generated files) string outputPath = "output_split"; int numberOfSplitFiles = 3; // Specify how many parts you want to split the PDF into // Call the SplitPdf method to split the PDF SplitPdfUsingiTextSharp(inputPath, outputPath, numberOfSplitFiles); } static void SplitPdfUsingiTextSharp(string inputPdfPath, string outputFolder, int numberOfSplitFiles) { using (PdfReader reader = new PdfReader(inputPdfPath)) { using (PdfDocument doc = new PdfDocument(reader)) { // Calculate the number of pages for each split file int totalPageInOneFile = doc.GetNumberOfPages() / numberOfSplitFiles; int firstPage = 1; int lastPage = totalPageInOneFile; for (int i = 1; i <= numberOfSplitFiles; i++) { // Generate the output file path string filename = $@"{outputFolder}\SplitPDF_iTextSharp_{i}.pdf"; // Create a new document and attach a writer for the specified output file using (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(filename))) { // Copy pages from the original document to the new document doc.CopyPagesTo(firstPage, lastPage, pdfDocument); } // Update page range values for the next iteration firstPage = lastPage + 1; lastPage += totalPageInOneFile; } } } } } $vbLabelText $csharpLabel Code Explanation This code demonstrates how to split a large PDF file into smaller chunks using iTextSharp. Each smaller PDF document will contain a portion of the original document. Splitting PDF Using iTextSharp The main functionality is encapsulated in the SplitPdfUsingiTextSharp method. The above method takes three parameters: inputPdfPath, outputFolder, and numberOfSplitFiles. Using PdfReader and PdfDocument Inside the SplitPdfUsingiTextSharp method: A PdfReader object named reader is created by loading the PDF from the specified inputPdfPath. A PdfDocument object named doc is initialized using the reader. The total number of pages in the source PDF is divided by numberOfSplitFiles to determine how many pages each smaller PDF should contain. Splitting Process A loop iterates from 1 to numberOfSplitFiles: A new smaller PDF file is created with a filename like "SplitPDF_iTextSharp_1.pdf" (for the first split) in the specified output folder. Inside this new PDF document (pdfDocument), pages are copied from the original doc: firstPage to lastPage (inclusive) are copied. The smaller PDF is saved. The firstPage and lastPage values are updated for the next iteration. Note Ensure that the iTextSharp library is properly installed and referenced in your project. Replace "input.pdf" with the actual path to your input PDF file. Comparison To compare the two split methods using iTextSharp and IronPDF, let's evaluate them based on several factors: Ease of Use: iTextSharp: The iTextSharp method involves creating a PdfReader, PdfDocument, and PdfWriter. It calculates page ranges and copies pages to a new document. This approach requires understanding the iTextSharp API. IronPDF: The IronPDF method involves creating a PdfDocument from the source file, copying pages, and saving them to a new file. It has a more straightforward API. Code Readability: iTextSharp: The code involves more steps, making it slightly longer and potentially more complex to read. IronPDF: The code is concise and more readable due to fewer steps and method calls. Performance: iTextSharp: Performance may be affected by the repeated creation and disposal of PdfDocument instances. IronPDF: The method involves fewer steps and offers better performance due to efficient page copying. Memory Usage: iTextSharp: Creating multiple PdfDocument instances will consume more memory. IronPDF: The method is more memory-efficient due to its simplified approach. Conclusion In conclusion, both iTextSharp and IronPDF offer robust solutions for splitting PDF files in C#, each with its own set of advantages. IronPDF stands out for its simplicity, readability, and potentially better performance due to a more straightforward approach. Developers seeking a balance between versatility and ease of use may find IronPDF to be a compelling choice. Additionally, IronPDF offers a free trial. Ultimately, the selection between iTextSharp and IronPDF depends on individual project requirements and the preferred development style. 참고해 주세요iTextSharp is a registered trademark of its respective owner. This site is not affiliated with, endorsed by, or sponsored by iTextSharp. All product names, logos, and brands are property of their respective owners. Comparisons are for informational purposes only and reflect publicly available information at the time of writing. 자주 묻는 질문 원본 서식을 유지하면서 C#에서 PDF를 분할하려면 어떻게 해야 하나요? IronPDF를 사용하면 서식을 유지하면서 C#에서 PDF를 분할할 수 있습니다. IronPDF는 PDF를 로드하고 분할할 페이지 범위를 지정할 수 있는 간단한 API를 제공하여 결과 PDF에서 원본 서식이 유지되도록 합니다. C#에서 PDF를 분할할 때 iTextSharp와 IronPDF의 주요 차이점은 무엇인가요? 주요 차이점은 사용 편의성과 성능에 있습니다. IronPDF는 더 적은 단계로 더 간단한 API를 제공하므로 서식을 잃지 않고 PDF를 더 쉽게 분할할 수 있습니다. 반면, iTextSharp는 PdfReader, PdfDocument, PdfWriter와 같은 여러 인스턴스를 생성해야 하므로 더 복잡할 수 있습니다. C#을 사용하여 PDF에서 특정 페이지를 추출할 수 있나요? 예, IronPDF를 사용하면 C#으로 된 PDF에서 특정 페이지를 쉽게 추출할 수 있습니다. PDF를 로드하고 원하는 페이지 번호를 지정하면 IronPDF를 사용하여 이러한 페이지를 추출하여 새 PDF 문서로 저장할 수 있습니다. IronPDF는 다른 PDF 라이브러리에 비해 코드 가독성을 어떻게 개선하나요? IronPDF는 명확하고 간결한 API를 제공하여 여러 클래스와 객체의 필요성을 줄임으로써 코드 가독성을 향상시킵니다. 따라서 분할과 같은 PDF 조작 작업에 필요한 코드가 간소화되어 더 깔끔하고 유지 관리하기 쉬운 코드가 생성됩니다. 라이브러리를 구매하기 전에 C#에서 PDF 분할 기능을 테스트할 수 있나요? 예, IronPDF는 개발자가 PDF 분할 기능 및 기타 기능을 테스트할 수 있는 무료 평가판을 제공합니다. 이 평가판 기간을 통해 구매 결정을 내리기 전에 기능과 성능을 평가할 수 있습니다. 문서 분할을 위한 PDF 라이브러리를 선택할 때 고려해야 할 요소는 무엇인가요? PDF 라이브러리를 선택할 때는 사용 편의성, API 단순성, 성능, 원본 문서 서식을 유지하는 기능 등의 요소를 고려하세요. 사용자 친화적인 API와 효율적인 성능으로 인해 IronPDF가 선호되는 경우가 많습니다. Visual Studio C# 프로젝트에 IronPDF를 설치하려면 어떻게 해야 하나요? Visual Studio C# 프로젝트에 IronPDF를 설치하려면 NuGet 패키지 관리자 콘솔에서 Install-Package IronPdf 명령을 사용하여 설치하세요. NuGet 패키지 관리자 UI를 통해 추가하거나 IronPDF의 공식 웹사이트에서 다운로드할 수도 있습니다. PDF를 분할하면 품질이나 서식에 영향을 미칠 수 있나요? IronPDF로 PDF를 분할하면 원본 문서의 품질과 서식이 보존됩니다. IronPDF의 효율적인 처리로 원본 콘텐츠의 무결성을 유지합니다. 커티스 차우 지금 바로 엔지니어링 팀과 채팅하세요 기술 문서 작성자 커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다. 커티스는 개발 분야 외에도 사물 인터넷(IoT)에 깊은 관심을 가지고 있으며, 하드웨어와 소프트웨어를 통합하는 혁신적인 방법을 연구합니다. 여가 시간에는 게임을 즐기거나 디스코드 봇을 만들면서 기술에 대한 애정과 창의성을 결합합니다. 관련 기사 게시됨 1월 20, 2026 Generate PDF Using iTextSharp in MVC vs IronPDF: A Complete Comparison ITextSharp와 IronPDF를 사용하여 ASP.NET MVC에서 PDF 생성 방법을 비교하세요. 어떤 라이브러리가 더 나은 HTML 렌더링과 더 쉬운 구현을 제공하는지 알아보세요. 더 읽어보기 업데이트됨 1월 7, 2026 Ghostscript GPL vs IronPDF: Technical Comparison Guide 고스트스크립트 GPL과 IronPDF의 주요 차이점을 알아보세요. AGPL 라이선스와 상용, 명령줄 스위치와 네이티브 .NET API, HTML-PDF 기능을 비교해 보세요. 더 읽어보기 업데이트됨 1월 21, 2026 Which ASP.NET PDF Library Offers the Best Value for .NET Core Development? ASP.NET Core 애플리케이션을 위한 최고의 PDF 라이브러리를 찾아보세요. IronPDF의 Chrome 엔진과 Aspose 및 Syncfusion의 대안을 비교해 보세요. 더 읽어보기 PDFsharp vs iTextSharp (C# PDF Library Comparison)IronPDF vs PDFSharpCore: Which .NET...
게시됨 1월 20, 2026 Generate PDF Using iTextSharp in MVC vs IronPDF: A Complete Comparison ITextSharp와 IronPDF를 사용하여 ASP.NET MVC에서 PDF 생성 방법을 비교하세요. 어떤 라이브러리가 더 나은 HTML 렌더링과 더 쉬운 구현을 제공하는지 알아보세요. 더 읽어보기
업데이트됨 1월 7, 2026 Ghostscript GPL vs IronPDF: Technical Comparison Guide 고스트스크립트 GPL과 IronPDF의 주요 차이점을 알아보세요. AGPL 라이선스와 상용, 명령줄 스위치와 네이티브 .NET API, HTML-PDF 기능을 비교해 보세요. 더 읽어보기
업데이트됨 1월 21, 2026 Which ASP.NET PDF Library Offers the Best Value for .NET Core Development? ASP.NET Core 애플리케이션을 위한 최고의 PDF 라이브러리를 찾아보세요. IronPDF의 Chrome 엔진과 Aspose 및 Syncfusion의 대안을 비교해 보세요. 더 읽어보기