C# 전용 PDF 라이브러리

  • PDF 생성, 병합 및 편집
  • 독립형 고기능 임베디드 PDF 뷰어 탑재
  • Linux, Windows, macOS 및 Docker 지원
  • 완전한 Ahead-of-Time (AOT) 지원
PM>Install-Package Pdfium.Net.SDK NuGet v5.1.3 Downloads 1.9M Published 2026-09-03

.NET용 엔터프라이즈급 PDF 워크플로우

Pdfium.Net SDK는 기본적인 뷰잉 엔진을 완전한 문서 프로세서로 확장합니다. 강력한 C# / VB.NET API를 통해 심층적인 콘텐츠 편집, 대화형 양식 채우기, 표준 준수 PDF/A 생성 및 상상할 수 있는 거의 모든 기능을 지원합니다.

구조화된 XML 메타데이터를 파이프라인에 직접 내장하여 전자 세금 계산서(Factur-X / ZUGFeRD) 발행을 손쉽게 자동화하세요. 어떤 문서 문제든 해결하고, 몇 달이 아닌 단 며칠 만에 바로 사용 가능한 워크플로우를 구축할 수 있습니다.

주요 기능

  • PDF 생성, 병합, 분할 및 편집
  • 임베デッド PDF 뷰어 구성 요소
  • AcroForms 완전 지원, 대화형 필드 및 JavaScript
  • 주석 및 댓글 관리
  • 고급 텍스트 도구: 검색, 단어/문자 추출 및 웹 링크 파싱
  • 북마크, 대상, 첨부 파일 및 레이블
  • 문서 보안: 암호 보호 및 권한 플래그
  • 페이지 지오메트리(Media/Crop/Bleed 박스) 및 PDF 레이어 제어
  • PDF 색 공간 완전 지원: RGB, CMYK, ICC, Pattern 등
  • 로우레벨 페이지 객체 제어(텍스트, 경로, 셰이딩 및 이미지)
  • PDF/A, ZUGFeRD 및 Factur-X 완벽 지원

플랫폼 및 인프라

  • Google PDFium 프로젝트 기반의 타의 추종을 불허하는 처리 속도
  • .NET Framework 2.0부터 .NET 10까지 지원
  • 클라우드 및 Docker 컨테이너 지원(Azure 및 AWS 포함)
  • 완전한 Ahead-of-Time (AOT) 지원
  • Windows 지원: x64 및 레거시 x86 아키텍처
  • Linux 지원: GLIBC 2.17 (x64, x86, ARM, ARM64), 최소 OS Ubuntu 16.04+ / Debian 9+
  • Linux Musl 지원: 네이티브 Alpine Linux (x64, x86, ARM, ARM64) Docker 베이스
  • macOS 지원: Apple Silicon (arm64) 및 Intel (x86_64)를 지원하는 Universal Binary dylib
  • Android 지원: arm64-v8a, armeabi-v7a, x86_64, x86용 Bionic NDK 타겟
  • iOS 지원: arm64 디바이스 및 시뮬레이터(arm64/x86_64)용 독립 슬라이스가 포함된 XCFramework

Production-Ready Code Examples

Explore clean, copy-pasteable C# examples for common PDF manipulation tasks. See how easily the SDK integrates into your application pipeline with minimal configuration.

C# 시작하기:

PDF 파일을 동적으로 생성하는 방법

일련의 이미지에서 프로그래밍 방식으로 PDF를 생성하는 방법

PDF 파일을 인쇄하는 방법

PDF 파일을 열고 텍스트를 추출하는 방법

PDF 파일에서 텍스트를 검색하는 방법

텍스트를 비동기적으로 검색하는 방법

PDF에서 추출한 텍스트의 좌표를 얻는 방법

PDF 문서에서 이미지를 추출하는 방법

PDF 문서를 별도의 문서로 분할하는 방법

여러 PDF의 페이지를 하나의 문서로 결합하는 방법

PDF 문서의 각 페이지를 이미지로 변환하는 방법

PDF 필드에서 프로그래밍 방식으로 데이터를 채우고 추출하는 방법

 
/// <summary>
/// Create PDF Document on The Fly in C# using Pdfium.Net SDK Library
/// </summary>
public void CreatePdf()
{
    // The PDF coordinate system origin is at the bottom left corner of the page. 
    // The X-axis is pointing to the right. The Y-axis is pointing in upward direction.
    // The sizes and coordinates in this method are given in the inches.

    // Step 1: Initialize PDF library and create empty document
    // Return value: PdfDocument main class
    PdfCommon.Initialize();
    var doc = PdfDocument.CreateNew();  // Create a PDF document

    // Step 2: Add new page
    // Arguments: page width: 8.27", page height: 11.69", Unit of measure: inches
    //  The PDF unit of measure is point. There are 72 points in one inch.
    var page = doc.Pages.InsertPageAt(doc.Pages.Count, 8.27f * 72, 11.69f * 72);

    // Step 3: Add graphics and text contents to the page
    // Insert image from file using standard System.Drawing.Bitmap class
    using (PdfBitmap logo = PdfBitmap.FromFile(@"c:\examples\logo_square.png"))
    {
        PdfImageObject imageObject = PdfImageObject.Create(doc, logo, 0, 0);
        //image resolution is 300 DPI and location is 1.69 x 10.0 inches.
        imageObject.Matrix = new FS_MATRIX(logo.Width * 72 / 300, 0, 0, logo.Height * 72 / 300, 1.69 * 72, 10.0 * 72);
        page.PageObjects.Add(imageObject);
    }

    // Create fonts used for text objects
    PdfFont calibryBold = PdfFont.CreateFont(doc, "CalibriBold");
    // Insert text objects at 7.69"; 11.02" and font size is 25
    PdfTextObject textObject = PdfTextObject.Create("Sample text", 1.69f * 72, 11.02f * 72, calibryBold, 25);
    textObject.FillColor = FS_COLOR.Black;
    page.PageObjects.Add(textObject);

    // Step 5: Generate page content and save pdf file
    // argument: PDF file name
    page.GenerateContent();
    doc.Save(@"c:\examples\sample_document.pdf", SaveFlags.NoIncremental);
}

C# Pdfium.Net SDK 라이브러리는 개발자에게 PDF 문서를 쉽게 생성할 수 있는 기회를 제공해 드립니다. 이 예제에서는 페이지 개체를 사용하여 이러한 문서를 만드는 방법을 보여줍니다.

다양한 유형(텍스트, 이미지, 윤곽선, 모양 등)의 페이지 개체를 생성하시고 페이지의 아무 곳에나 배치하실 수 있습니다.

/// <summary>
/// Generate PDF document From Multiple Images in C# using PDF Library
/// </summary>
public void GeneratePdf()
{
    //Initialize C# PDF Library
    PdfCommon.Initialize();
    //Create a PDF document
    using (var doc = PdfDocument.CreateNew())
    {
        //Read images
        var files = System.IO.Directory.GetFiles(@"c:\Examples\Images\", "*.*", System.IO.SearchOption.AllDirectories);
        foreach (var file in files)
        {
            //Create empty PdfBitmap
            using (PdfBitmap pdfBitmap = PdfBitmap.FromFile(file))
            {
                //Create Image object
                var imageObject = PdfImageObject.Create(doc, pdfBitmap, 0, 0);
                //Calculate size of image in PDF points
                var size = CalculateSize(pdfBitmap.Width, pdfBitmap.Height);
                //Add empty page to PDF document
                var page = doc.Pages.InsertPageAt(doc.Pages.Count, size);
                //Insert image to newly created page
                page.PageObjects.Add(imageObject);
                //set image matrix
                imageObject.Matrix = new FS_MATRIX(size.Width, 0, 0, size.Height, 0, 0);
                //Generate PDF page content to content stream
                page.GenerateContent();
            }
        }
        // Save  PDF document as "saved.pdf" in no incremental mode
        doc.Save(@"c:\Examples\test.pdf", SaveFlags.NoIncremental);
    }
}
/// <summary>
/// The function takes width and height of the bitmap in pixels as well as 
/// horizontal and vertical DPI and calculates the size of the PDF page. 
/// To understand the conversion you should know the following:
///     One inch contains exactly 72 PDF points;
///     DPI of the scanned image may vary and depends on scanning resolution
/// </summary>
private FS_SIZEF CalculateSize(int width, int height, float dpiX = 300, float dpiY = 300)
{
    return new FS_SIZEF()
    {
        Width = width * 72 / dpiX,
        Height = height * 72 / dpiY
    };
}

이 예에서는 간단한 C# 코드와 PDF 라이브러리를 사용하여 스캔한 이미지 세트에서 PDF 문서를 만드는 방법을 보여줍니다.

/// <summary>
/// Printing PDF Files in C# using PDF Library
/// </summary>
public void PrintPdf()
{
    var doc = PdfDocument.Load(@"c:\Examples\test.pdf");  // Read PDF file
    var printDoc = new PdfPrintDocument(doc);
    printDoc.Print();
}

위의 코드는 기본 프린터에서 PDF 문서를 인쇄합니다. 또한 인쇄 진행률과 함께 표준 인쇄 대화 상자를 표시합니다. 진행 창을 숨기고 싶으시면 아래와 같이 코드를 변경해 보십시오.

public void PrintPdf()
{
    var doc = PdfDocument.Load(@"c:\Examples\test.pdf");
    var printDoc = new PdfPrintDocument(doc);
    PrintController printController = new StandardPrintController();
    printDoc.PrintController = printController;
    printDoc.Print(); // C# Print PDF document
}

PdfPrintDocument는 표준 PrintDocument 클래스에서 파생되므로 사용자 입력에 따라 PrintDocument를 설정하는 .Net Framework 인쇄 대화 상자(PrinterDialog)를 사용하실 수 있습니다.

public void OnPrintClick()
{
    if (PdfViewer.Document.FormFill != null)
        PdfViewer.Document.FormFill.ForceToKillFocus();

    //create an instance of PrintDocument class
    var printDoc = new PdfPrintDocument(PdfViewer.Document); // create an instance of Print document class that is used for printing PDF document.

    //Create a standard print dialog box
    var dlg = new PrintDialog();
    dlg.AllowCurrentPage = true;
    dlg.AllowSomePages = true;
    dlg.UseEXDialog = true;
    //sets the PrintDocument used to obtain PrinterSettings.
    dlg.Document = printDoc;
    //show PrinterDialog and print pdf document
    if (dlg.ShowDialog() == DialogResult.OK)
        printDoc.Print();   // C# Print PDF
}
 
/// <summary>
/// Read PDF File and Extract Text From it in C#
/// </summary>
public void ExtractText()
{
    //Initialize the SDK library
    //You have to call this function before you can call any PDF processing functions.
    PdfCommon.Initialize();

    //Open and load a PDF document from a file.
    using (var doc = PdfDocument.Load(@"c:\Examples\test.pdf")) // C# Read PDF File
    {
        foreach (var page in doc.Pages)
        {
            //Gets number of characters in a page or -1 for error.
            //Generated characters, like additional space characters, new line characters, are also counted.
            int totalCharCount = page.Text.CountChars;

            //Extract text from page to the string
            string text = page.Text.GetText(0, totalCharCount);

            page.Dispose();
        }
    }
}

Pdfium.Net SDK는 개발자에게 거의 모든 PDF 파일에서 전체 텍스트를 쉽게 추출할 기회를 제공해 드립니다.

/// <summary>
/// Search for a Text in a PDF File in C# With Pdfium.Net SDK Library
/// </summary>
public void Search()
{
    // Read PDF document and enumerate pages
    using (var doc = PdfDocument.Load(@"c:\Examples\test.pdf")) 
    {
        //Enumerate pages
        foreach (var page in doc.Pages)
        {
            var found = page.Text.Find("text for search", FindFlags.MatchWholeWord, 0);
            if (found == null)
                return; //nothing found
            do
            {
                var textInfo = found.FoundText;
                foreach (var rect in textInfo.Rects)
                {
                    float x = rect.left;
                    float y = rect.top;
                    //...
                }
            } while (found.FindNext());

            page.Dispose();
        }
    }
}

이 예제에서는 간단한 C# 코드와 PDF 라이브러리를 사용하여 문서에서 텍스트를 검색하는 방법을 보여줍니다.

이 예제에서는 C# PDF 라이브러리를 사용하여 비동기적으로 텍스트를 검색하는 방법을 보여줍니다.

/// <summary>
/// Extract Text Coordinates from Pdf in C# using PDF Library
/// </summary>
public void ExtractTextInfo()
{
    //Initialize the SDK library
    //You have to call this function before you can call any PDF processing functions.
    PdfCommon.Initialize();

    //Open and load a PDF document from a file.
    using (var doc = PdfDocument.Load(@"c:\Examples\test.pdf")) // C# Read PDF File
    {
        //Get second page from document
        using (var page = doc.Pages[1])
        {
            //Extract text information structure from the page
            // 10 - Index for the start characters
            // 25 - Number of characters to be extracted
            var textInfo = page.Text.GetTextInfo(10, 25);

            //Gets text from textInfo structure
            string text = textInfo.Text;

            //Gets a collection of rectangular areas bounding specified text.
            var rects = textInfo.Rects;
        }
    }
}

Pdfium.Net SDK는 개발자에게 모든 PDF 파일에서 텍스트 좌표를 쉽게 추출할 수 있는 기회를 제공해 드립니다.

/// <summary>
/// Extracting Images from Pdf File With .Net C# and PDF Library
/// </summary>
private int _writtenImageIndex = 0;

public void ExtractAllImages()
{
    //Initialize the SDK library
    //You have to call this function before you can call any PDF processing functions.
    PdfCommon.Initialize();

    //Open and load a PDF document from a file.
    using (var doc = PdfDocument.Load(@"c:\Examples\test.pdf")) // C# Read PDF File
    {
        //Enumerate all pages sequentially in a given document
        foreach (var page in doc.Pages)
        {
            //Extract and save images
            ExtractImagesFromPage(page);

            //dipose page object to unload it from memory
            page.Dispose();
        }
    }
}

private void ExtractImagesFromPage(PdfPage page)
{
    //Enumerate all objects on a page
    foreach (var obj in page.PageObjects)
    {
        var imageObject = obj as PdfImageObject;
        if (imageObject == null)
            continue; //if not an image object then nothing do

        //Save image to disk
        var path = string.Format(@"c:\Images\image_{0}.png", ++_writtenImageIndex);
        imageObject.Bitmap.Image.Save(path, ImageFormat.Png);
    }
}

이 예제는 PDF 파일에서 다양한 형식의 이미지를 추출하여 디스크에 저장하는 방법을 보여줍니다.

/// <summary>
/// Split PDF in C# using PDF Library
/// </summary>
public void SplitDocument()
{
    //Initialize the SDK library
    //You have to call this function before you can call any PDF processing functions.
    PdfCommon.Initialize();

    //Open and load a PDF document from a file.
    using (var sourceDoc = PdfDocument.Load(@"c:\Examples\test.pdf")) // C# Read PDF File
    {
        //Create one PDF document for pages 1-5.
        using (var doc = PdfDocument.CreateNew())
        {
            //Import pages from source document
            doc.Pages.ImportPages(sourceDoc, "1-5", 0);
            //And save it to doc1.pdf
            doc.Save(@"c:\Examples\doc1.pdf", SaveFlags.Incremental);
        }

        //Create another PDF document for pages 5-10.
        using (var doc = PdfDocument.CreateNew())
        {
            //Also import pages
            doc.Pages.ImportPages(sourceDoc, "5-10", 0);
            //And save them too
            doc.Save(@"c:\Examples\doc2.pdf", SaveFlags.Incremental);
        }
    }
}

다음 코드 예제에서는 PDF 라이브러리를 사용하여 문서를 별도의 페이지로 분할하는 방법을 보여줍니다.

/// <summary>
/// Merge PDFs in C# using PDF Library
/// </summary>
public void MergePdf()
{
    //Initialize the SDK library
    //You have to call this function before you can call any PDF processing functions.
    PdfCommon.Initialize();

    //Open and load a PDF document in which will be merged other files
    using (var mainDoc = PdfDocument.Load(@"c:\Examples\test.pdf")) // C# Read source PDF File #1
    {
        //Open one PDF document.
        using (var doc = PdfDocument.Load(@"c:\Examples\doc1.pdf")) //Read PDF File #2
        {
            //Import all pages from document
            mainDoc.Pages.ImportPages(
                doc,
                string.Format("1-{0}", doc.Pages.Count),
                mainDoc.Pages.Count
                );
        }

        //Open another PDF document.
        using (var doc = PdfDocument.Load(@"c:\Examples\doc2.pdf"))
        {
            //Import all pages from document
            mainDoc.Pages.ImportPages(
                doc,
                string.Format("1-{0}", doc.Pages.Count),
                mainDoc.Pages.Count
                );
        }

        mainDoc.Save(@"c:\Examples\ResultDocument.pdf", SaveFlags.NoIncremental);
    }
}

C# PDF 라이브러리를 사용하시면 소스 파일에서 특정 페이지를 선택하시고 단일 PDF 문서로 병합하실 수 있습니다.

이 예는 ImportPages 작업을 사용하여 이 통합을 수행하는 방법을 보여줍니다.

/// <summary>
/// Render whole PDF document using C# PDF Library
/// </summary>
public void RenderPages()
{
    using (var doc = PdfDocument.Load(@"c:\Examples\test.pdf")) // C# Read PDF Document
    {
        int idx = 0;
        foreach (var page in doc.Pages)
        {
            int width = (int)(page.Width / 72.0 * 96);
            int height = (int)(page.Height / 72.0 * 96);
            using (var bitmap = new PdfBitmap(width, height, true))
            {
                bitmap.FillRect(0, 0, width, height, FS_COLOR.White);
                page.Render(bitmap, 0, 0, width, height, PageRotate.Normal, RenderFlags.FPDF_LCD_TEXT);
                bitmap.Image.Save($"c:\\Examples\\page_{idx++}", ImageFormat.Png);
            }
        }
    }
}

In this example we create a bitmap of each page, so we calculate the required width and height of the bitmap in pixels converted from the dimensions of the PDF page in Points. Each Point is 1/72 of an inch, so we basically take the vertical or horizontal DPI of the image (96 in our example), multiply it to corresponding dimension and divide by 72.

Next we create a new PdfBitmap using the dimensions we just computed. The last parameter of the constructor tells to use the true color mode.

Then we fill the entire bitmap with white and render the page to it. That's all!

/// <summary>
/// Filling Editable PDF Fields and Extracting Data From Them using .Net PDF Library
/// </summary>
public void FillFields()
{
    var doc = PdfDocument.Load(@"c:\Examples\test.pdf", new PdfForms()); // C# Read PDF Document

    int i = 0;
    foreach (var field in doc.FormFill.InterForm.Fields)
    {
        if (field.FieldType == Patagames.Pdf.Enums.FormFieldTypes.FPDF_FORMFIELD_TEXTFIELD)
        {
            field.Value = "This is a field #" + (++i);
        }
    }
}

이 예에서는 .Net PDF 라이브러리를 사용하여 PDF 문서에서 편집 가능한 양식을 프로그래밍 방식으로 채우는 방법을 보여줍니다.

 

사용 가능한 개발자 지원

제품 라이선스를 구입하시면 훌륭한 라이브러리 이상의 것을 얻을 수 있습니다. 이를 최대한 활용하기 위해 개발 팀에서 직접 12개월 동안 무료 기술 지원을 받고 1년 동안 무료 업데이트를 받으실 수도 있습니다.

I've tried your latest release and it works perfectly ― solves both my problems! Thanks for meeting my request ―it's much appreciated. We still use [other product] for some legacy projects, but we have dropped it for all new projects. Although the [other product] library itself is good, we found their support to be poor ― without doubt Pdfium.NET support has proven to be far better, both in speed and quality!
Again, many thanks for your first-rate service and excellent product. -Terry
The link is hidden due to ethical concerns.

저희는 귀하가 귀하의 앱에 집중할 수 있도록 단순성에 중점을 둡니다.

Pdfium.Net SDK 개발의 주요 목표는 개발자에게 간단하고 직관적으로 만드는 것입니다. 클래스 라이브러리는 기본 pdfium 라이브러리 사용에 대한 모든 세부 사항을 추상화하고 세계 개체 및 기타 직관적인 클래스를 기반으로 하는 인터페이스를 제공해 드립니다.

또한 Pdfium.Net SDK가 잘 문서화되어 있습니다! 저희는 초보자와 숙련된 사용자에게 Pdfium.Net SDK에서 가능한 것에 대한 개요를 제공하는 것을 목표로 하는 광범위한 문서를 제공해 드립니다.

 

엔터프라이즈 및 클라우드 서비스에 최적화

One of our targets is to provide developers with high quality tool for dynamic PDF creation on any server system like Microsoft Azure.

Azure에 배포할 때 SDK가 작동하는 것을 획인했습니다 (테스트한 여러 제품이 작동하지 않았습니다 - 이 것을 광고할 수 있습니다.
다시 한번 감사합니다! -Cyberg
https://forum.patagames.com/posts/m1105-Workability-in-various-environments#post1105

PDF 뷰어용 임베디드 컴포넌트

.Net 앱에서 PDF 문서 표시

귀하의.Net 앱에서 PDF 파일을 보는 기능을 구현해 보십시오! 다중 보기 모드, 미세 조정 및 전체 양식 지원을 통해 PDF 뷰어는 앱에 완벽하게 맞고 디자인에 맞게 조정됩니다.

  • 완전히 사용자 정의 가능한 인터페이스
  • 대화형 양식 지원
  • 유연한 이벤트 처리
  • 쉬운 통합
  • 오픈 소스 코드
WPF Viewer Winforms Viewer
C# PDF Viewer
PdfViewer의 모양에 대한 자세한 내용을 얻기 위해 문서를 참고하십시오.

Pdfium.Net SDK

다운로드

NuGet 패키지는 nuget.org의 공식 리포지토리에서 사용하실 수 있습니다.

PM> Install-Package Pdfium.Net.SDK
NuGet v5.1.3 Downloads 1.9M Published 2026-09-03

다음 플랫폼을 위해 설계되었습니다

Microsoft .Net Framework 2.0+ Microsoft .Net Standard 2.0+ Microsoft Visual Studio NuGet Microsoft Azure