iTextSharp | IronPDF를 사용하여 C#에서 PDF에 디지털 서명 추가하는 방법
Syncfusion PDF Framework에서 IronPDF로 마이그레이션하면 좌표 기반 그래픽 API가 포함된 대규모 스위트에서 단독으로 HTML/CSS 우선의 현대적인 Chromium 렌더링 라이브러리로 PDF 생성 워크플로가 변환됩니다. 이 가이드는 스위트 전용 라이선싱, 복잡한 배포 요구 사항 및 좌표 기반 포지셔닝을 제거하는 완전한 단계별 마이그레이션 경로를 제공합니다.
SyncfusionPDF에서 IronPDF로의 마이그레이션 이유
Syncfusion PDFFramework 이해
Syncfusion PDF Framework는 C#을 사용하여 PDF 문서를 생성, 편집 및 보안하는 광범위한 기능을 제공하는 포괄적인 라이브러리입니다. Syncfusion의 Essential Studio의 일부로 제공되며, 여러 플랫폼에 걸쳐 천 개 이상의 구성 요소를 포함합니다.
PDF 라이브러리는 단일 컴포넌트로 구매할 수 없습니다. Syncfusion은 이제 PDF, Word, Excel 및 PowerPoint 라이브러리를 UI 컴포넌트 없이 묶은 "Document SDK" 티어를 제공하며, 전체 Essential Studio 패키지와 함께 제공됩니다. PDF 기능만 필요한 팀은 최소한 문서 SDK를 선택해야 하며, 다른 문서 라이브러리가 사용되지 않을 때 이는 부담스러울 수 있습니다.
번들 라이선싱 문제
Syncfusion의 라이선스 모델은 PDF 기능만 필요한 팀에게 큰 도전을 제기합니다:
- 라이브러리별 구매 없음: PDF는 Document SDK (PDF + Word + Excel + PowerPoint) 또는 전체 Essential Studio에 묶여 있으며, 독립적으로 라이선스를 받을 수 없습니다
- 커뮤니티 라이선스 제한사항: 무료 티어는 <$1M 연간 매출, ≤5명의 개발자, AND ≤10명의 총 직원, 외부 자본에 대한 $3M 평생 제한을 요구합니다
- 복잡한 배포 라이선싱: 웹, 데스크탑, 서버 배포를 위한 다른 라이선스
- 연간 갱신 필요: 최소 1년간의 연간 비용을 요구하는 구독 모델
- 개발자 1인당 가격: 팀 규모에 따라 비용이 선형적으로 증가
- 번들 블로트: Document SDK는 PDF만 필요해도 Word/Excel/PowerPoint 종속성을 당기며; 전체 Essential Studio는 1000+ UI 컴포넌트를 추가
Syncfusion PDFvsIronPDF비교
| 측면 | Syncfusion PDF | IronPDF |
|---|---|---|
| 구매 모델 | Document SDK 번들 또는 전체 Essential Studio (라이브러리별 SKU 없음) | 독립형 |
| 라이선스 | 복잡한 티어 | 개발자별 간단한 |
| 커뮤니티 제한 | <$1M revenue, ≤5 devs, ≤10 employees, ≤$3M outside capital | 무료 체험판 후 라이선스 |
| 배포 | 여러 라이선스 유형 | 하나의 라이선스가 모든 것을 다룸 |
| API 스타일 | 좌표 기반 그래픽 + HTML 변환기 | HTML/CSS 우선 |
| HTML 엔진 | Blink (별도 Windows/Linux/Mac NuGets) | 번들로 제공되는 Chromium |
| CSS 지원 | 모던 (Blink) — Chromium과 가까운 동등성 | CSS3/플렉스박스/그리드를 완벽히 지원 |
| 종속성 | 다중 패키지 | 단일 NuGet |
| 번들 요구사항 | 예 (Document SDK 또는 Essential Studio) | 아니요 |
| PDF에 초점 | 광범위한; 더 큰 번들에 일부 | 좁은; PDF 중심 |
IronPDF는 PDF 기능을 단독 제품으로 제공하여 보다 집중된 접근 방식을 제공합니다. 이 차이는 비용 고려사항과 통합의 용이성 양쪽에 중요한 영향을 미칩니다.
모던 .NET을 채택하는 팀에게 IronPDF의 독립 라이센싱 및 HTML/CSS 우선 접근은 번들 종속성 없이 유연성을 제공합니다.
시작하기 전에
필수 조건
- .NET 환경: .NET Framework 4.6.2+ 또는 .NET Core 3.1+ / .NET 5/6/7/8/9+
- NuGet 접근 권한: NuGet 패키지를 설치할 수 있는 능력
- IronPDF 라이선스: ironpdf.com에서 라이선스 키를 획득하세요
NuGet 패키지 변경 사항
# RemoveSyncfusionpackages
dotnet remove package Syncfusion.Pdf.Net.Core
dotnet remove package Syncfusion.HtmlToPdfConverter.Net.Windows
dotnet remove package Syncfusion.Licensing
# Install IronPDF
dotnet add package IronPdf
라이선스 구성
Syncfusion:
// Must register before anySyncfusioncalls
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR-SYNCFUSION-KEY");' Must register before any Syncfusion calls
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR-SYNCFUSION-KEY")IronPDF:
// One-time at startup
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";' One-time at startup
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"완전한 API 참조
네임스페이스 변경
// Before:SyncfusionPDF
using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Parsing;
using Syncfusion.HtmlConverter;
using Syncfusion.Drawing;
// After: IronPDF
using IronPdf;
using IronPdf.Rendering;Imports IronPdf
Imports IronPdf.Rendering핵심 API 매핑
| Syncfusion | IronPDF |
|---|---|
PdfDocument | ChromePdfRenderer |
PdfLoadedDocument | PdfDocument.FromFile() |
HtmlToPdfConverter | ChromePdfRenderer |
graphics.DrawString() | HTML 텍스트 요소 |
graphics.DrawImage() | <img> 태그 |
PdfGrid | HTML <table> |
PdfStandardFont | CSS font-family |
PdfBrushes.Black | CSS color: black |
document.Security | pdf.SecuritySettings |
PdfTextExtractor | pdf.ExtractAllText() |
ImportPageRange() | PdfDocument.Merge() |
document.Save(stream) | pdf.SaveAs(path) |
document.Close(true) | 필요 없음 |
코드 마이그레이션 예제
예제 1: HTML/URL에서 PDF 변환
이전 (Syncfusion PDF):
// NuGet: Install-Package Syncfusion.Pdf.Net.Core
using Syncfusion.HtmlConverter;
using Syncfusion.Pdf;
using System.IO;
class Program
{
static void Main()
{
// Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
// Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.example.com");
// Save the document
FileStream fileStream = new FileStream("Output.pdf", FileMode.Create);
document.Save(fileStream);
document.Close(true);
fileStream.Close();
}
}' NuGet: Install-Package Syncfusion.Pdf.Net.Core
Imports Syncfusion.HtmlConverter
Imports Syncfusion.Pdf
Imports System.IO
Module Program
Sub Main()
' Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter()
' Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.example.com")
' Save the document
Dim fileStream As New FileStream("Output.pdf", FileMode.Create)
document.Save(fileStream)
document.Close(True)
fileStream.Close()
End Sub
End Module이후 (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
class Program
{
static void Main()
{
// Create a PDF from a URL
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://www.example.com");
// Save the PDF
pdf.SaveAs("Output.pdf");
}
}' NuGet: Install-Package IronPdf
Imports IronPdf
Module Program
Sub Main()
' Create a PDF from a URL
Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderUrlAsPdf("https://www.example.com")
' Save the PDF
pdf.SaveAs("Output.pdf")
End Sub
End Module이 예제는 기본 API 차이를 보여줍니다.SyncfusionPDF는 HtmlToPdfConverter 인스턴스를 필요로 하며, Convert()를 호출하여 PdfDocument를 반환하고, 그런 다음 수동으로 FileStream를 생성하고, 문서와 스트림을 저장하고 닫습니다.
IronPDF는 단 세 줄의 코드로 ChromePdfRenderer를 RenderUrlAsPdf()와 함께 사용합니다. FileStream 관리도 없이, Close() 호출도 없이—IrronPDF는 정리를 자동으로 처리합니다. HTML에서 PDF로의 문서에서 포괄적인 예제를 참조하세요.
예제 2: 텍스트에서 PDF 생성
이전 (Syncfusion PDF):
// NuGet: Install-Package Syncfusion.Pdf.Net.Core
using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Drawing;
using System.IO;
class Program
{
static void Main()
{
// Create a new PDF document
PdfDocument document = new PdfDocument();
// Add a page
PdfPage page = document.Pages.Add();
// Create a font
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
// Draw text
page.Graphics.DrawString("Hello, World!", font, PdfBrushes.Black, new PointF(10, 10));
// Save the document
FileStream fileStream = new FileStream("Output.pdf", FileMode.Create);
document.Save(fileStream);
document.Close(true);
fileStream.Close();
}
}' NuGet: Install-Package Syncfusion.Pdf.Net.Core
Imports Syncfusion.Pdf
Imports Syncfusion.Pdf.Graphics
Imports Syncfusion.Drawing
Imports System.IO
Module Program
Sub Main()
' Create a new PDF document
Dim document As New PdfDocument()
' Add a page
Dim page As PdfPage = document.Pages.Add()
' Create a font
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
' Draw text
page.Graphics.DrawString("Hello, World!", font, PdfBrushes.Black, New PointF(10, 10))
' Save the document
Dim fileStream As New FileStream("Output.pdf", FileMode.Create)
document.Save(fileStream)
document.Close(True)
fileStream.Close()
End Sub
End Module이후 (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Rendering;
class Program
{
static void Main()
{
// Create a PDF from HTML string
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello, World!</h1>");
// Save the document
pdf.SaveAs("Output.pdf");
}
}' NuGet: Install-Package IronPdf
Imports IronPdf
Imports IronPdf.Rendering
Module Program
Sub Main()
' Create a PDF from HTML string
Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf("<h1>Hello, World!</h1>")
' Save the document
pdf.SaveAs("Output.pdf")
End Sub
End ModuleSyncfusion PDF는 좌표 기반 그래픽 모델을 사용합니다. 당신은 PdfDocument를 생성하고, PdfPage를 추가하고, PdfFontFamily.Helvetica와 함께 PdfFont를 생성한 다음, 명시적 좌표(new PointF(10, 10)), 폰트, 브러시(PdfBrushes.Black)와 함께 page.Graphics.DrawString()를 호출합니다. 마지막으로, FileStream 생성 및 폐기를 관리합니다.
IronPDF는 HTML/CSS 우선 접근 방식을 사용합니다. Instead of coordinates, you write <h1>Hello, World!</h1> and let CSS handle positioning, fonts, and colors. 이 접근 방식은 더 간단하고 더 유지 관리하기 쉬우며, 개발자가 이미 보유하고 있는 기술을 활용합니다. 더 많은 정보를 보려면 튜토리얼을 참조하세요.
예제 3: PDF 문서 병합
이전 (Syncfusion PDF):
// NuGet: Install-Package Syncfusion.Pdf.Net.Core
using Syncfusion.Pdf;
using Syncfusion.Pdf.Parsing;
using System.IO;
class Program
{
static void Main()
{
// Load the first PDF document
FileStream stream1 = new FileStream("Document1.pdf", FileMode.Open, FileAccess.Read);
PdfLoadedDocument loadedDocument1 = new PdfLoadedDocument(stream1);
// Load the second PDF document
FileStream stream2 = new FileStream("Document2.pdf", FileMode.Open, FileAccess.Read);
PdfLoadedDocument loadedDocument2 = new PdfLoadedDocument(stream2);
// Merge the documents
PdfDocument finalDocument = new PdfDocument();
finalDocument.ImportPageRange(loadedDocument1, 0, loadedDocument1.Pages.Count - 1);
finalDocument.ImportPageRange(loadedDocument2, 0, loadedDocument2.Pages.Count - 1);
// Save the merged document
FileStream outputStream = new FileStream("Merged.pdf", FileMode.Create);
finalDocument.Save(outputStream);
// Close all documents
finalDocument.Close(true);
loadedDocument1.Close(true);
loadedDocument2.Close(true);
stream1.Close();
stream2.Close();
outputStream.Close();
}
}' NuGet: Install-Package Syncfusion.Pdf.Net.Core
Imports Syncfusion.Pdf
Imports Syncfusion.Pdf.Parsing
Imports System.IO
Module Program
Sub Main()
' Load the first PDF document
Dim stream1 As FileStream = New FileStream("Document1.pdf", FileMode.Open, FileAccess.Read)
Dim loadedDocument1 As PdfLoadedDocument = New PdfLoadedDocument(stream1)
' Load the second PDF document
Dim stream2 As FileStream = New FileStream("Document2.pdf", FileMode.Open, FileAccess.Read)
Dim loadedDocument2 As PdfLoadedDocument = New PdfLoadedDocument(stream2)
' Merge the documents
Dim finalDocument As PdfDocument = New PdfDocument()
finalDocument.ImportPageRange(loadedDocument1, 0, loadedDocument1.Pages.Count - 1)
finalDocument.ImportPageRange(loadedDocument2, 0, loadedDocument2.Pages.Count - 1)
' Save the merged document
Dim outputStream As FileStream = New FileStream("Merged.pdf", FileMode.Create)
finalDocument.Save(outputStream)
' Close all documents
finalDocument.Close(True)
loadedDocument1.Close(True)
loadedDocument2.Close(True)
stream1.Close()
stream2.Close()
outputStream.Close()
End Sub
End Module이후 (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using System.Collections.Generic;
class Program
{
static void Main()
{
// Load PDF documents
var pdf1 = PdfDocument.FromFile("Document1.pdf");
var pdf2 = PdfDocument.FromFile("Document2.pdf");
// Merge PDFs
var merged = PdfDocument.Merge(new List<PdfDocument> { pdf1, pdf2 });
// Save the merged document
merged.SaveAs("Merged.pdf");
}
}' NuGet: Install-Package IronPdf
Imports IronPdf
Imports System.Collections.Generic
Class Program
Shared Sub Main()
' Load PDF documents
Dim pdf1 = PdfDocument.FromFile("Document1.pdf")
Dim pdf2 = PdfDocument.FromFile("Document2.pdf")
' Merge PDFs
Dim merged = PdfDocument.Merge(New List(Of PdfDocument) From {pdf1, pdf2})
' Save the merged document
merged.SaveAs("Merged.pdf")
End Sub
End ClassPDF를 병합하는 데 있어서의 차이점은 극적입니다.SyncfusionPDF는 각 입력 문서에 대한 FileStream 객체를 생성하고, 그것들을 PdfLoadedDocument로 로드하고, 새 PdfDocument를 생성하고, 각 소스를 위한 시작 및 종료 인덱스를 가진 ImportPageRange()를 호출하고, 출력 FileStream를 생성한 다음 여섯 개의 별도 객체(finalDocument, loadedDocument1, loadedDocument2, stream1, stream2, outputStream)를 닫습니다.
IronPDF는 각 PDF를 로드하는 PdfDocument.FromFile()와 문서 목록을 수용하는 정적 PdfDocument.Merge() 메서드를 사용합니다. 스트림 관리도 없고, 수동 페이지 범위 계산도 없고, 닫기 호출도 없습니다.
API 철학의 주요 차이점
좌표 기반과 HTML/CSS 우선 방식
Syncfusion PDF는 전통적인 PDF 라이브러리에서 상속된 좌표 기반 그래픽 모델을 사용합니다:
// Syncfusion:수동positioning
page.Graphics.DrawString("Text", font, PdfBrushes.Black, new PointF(100, 200));
page.Graphics.DrawRectangle(brush, new RectangleF(50, 50, 200, 100));' Syncfusion:수동positioning
page.Graphics.DrawString("Text", font, PdfBrushes.Black, New PointF(100, 200))
page.Graphics.DrawRectangle(brush, New RectangleF(50, 50, 200, 100))IronPDF는 레이아웃을 위해 HTML/CSS를 사용합니다:
// IronPDF: CSS-based positioning
var html = @"
<div style='margin: 50px; padding: 20px; border: 1px solid black;'>
<p style='color: black;'>Text</p>
</div>";
var pdf = renderer.RenderHtmlAsPdf(html);' IronPDF: CSS-based positioning
Dim html As String = "
<div style='margin: 50px; padding: 20px; border: 1px solid black;'>
<p style='color: black;'>Text</p>
</div>"
Dim pdf = renderer.RenderHtmlAsPdf(html)HTML/CSS 접근 방식은 웹 개발자에게 더 직관적이고, 유지 관리가 더 쉬우며, 다른 페이지 크기에서 일관된 결과를 제공합니다.
스트림 관리와 자동 정리
Syncfusion PDF는 명시적인 스트림 및 문서 폐기를 요구합니다:
// Syncfusion:수동cleanup
FileStream fileStream = new FileStream("Output.pdf", FileMode.Create);
document.Save(fileStream);
document.Close(true);
fileStream.Close();' Syncfusion:수동cleanup
Dim fileStream As New FileStream("Output.pdf", FileMode.Create)
document.Save(fileStream)
document.Close(True)
fileStream.Close()IronPDF는 자동으로 정리를 처리합니다:
// IronPDF:자동cleanup
pdf.SaveAs("Output.pdf");' IronPDF:자동cleanup
pdf.SaveAs("Output.pdf")기능 비교
| 기능 | Syncfusion PDF | IronPDF |
|---|---|---|
| 단독 구매 | 아니오 (문서 SDK 또는 Essential Studio) | 예 |
| 라이선스 | 커뮤니티 제한이 있는 상업용 | 단순화된 상업용 |
| HTML 엔진 | Blink (플랫폼별 NuGets) | 번들로 제공되는 Chromium |
| CSS3 지원 | Blink를 통한 최신 | 완전함 (플렉스박스, 그리드) |
| API 스타일 | 좌표 기반 그래픽 + HTML 변환기 | HTML/CSS 우선 |
| 스트림 관리 | 수동 | 자동 |
| 종속성 | 다중 패키지 | 단일 NuGet |
| 배포 복잡성 | 잠재적으로 복잡함 | 직관적 |
마이그레이션 체크리스트
사전 마이그레이션
- 코드베이스에서 모든Syncfusion PDF사용 내역 목록 작성
- 라이센스 비용 및 배포 요건 문서화
PdfGrid,PdfGraphics,HtmlToPdfConverter사용을 식별합니다- ironpdf.com에서IronPDF라이선스 키 획득
코드 업데이트
-Syncfusion패키지를 제거합니다(Syncfusion.Pdf.Net.Core, Syncfusion.HtmlToPdfConverter.Net.Windows, Syncfusion.Licensing)
IronPdfNuGet 패키지를 설치합니다- 네임스페이스 가져오기를 업데이트합니다(
using Syncfusion.Pdf;→using IronPdf;) Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense()를IronPdf.License.LicenseKey = "..."로 교체합니다HtmlToPdfConverter.Convert()를ChromePdfRenderer.RenderUrlAsPdf()또는RenderHtmlAsPdf()로 교체합니다PdfDocument+Pages.Add()+Graphics.DrawString()를ChromePdfRenderer.RenderHtmlAsPdf()로 교체합니다PdfLoadedDocument를PdfDocument.FromFile()로 교체합니다ImportPageRange()를PdfDocument.Merge()로 교체합니다document.Save(stream)를pdf.SaveAs(path)로 교체합니다- 모든
document.Close(true)및stream.Close()호출을 제거합니다 PdfGrid를 HTML<table>요소로 교체합니다PdfStandardFont를 CSSfont-family로 교체합니다PdfBrushes를 CSScolor속성으로 교체합니다
테스트
- PDF 출력의 시각적 비교
- CSS 렌더링 개선 확인 (플렉스박스, 그리드가 이제 작동)
- 텍스트 추출 테스트
- 병합 및 분할 테스트
- 성능 비교

커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.