PdfSharp을 이용한 Tiff To Pdf 변환 예제 입니다.
PdfSharp 은 MIT Licence로 opensource로 알고 있습니다.
출처 : https://www.pdfsharp.net/Licensing.ashx?AspxAutoDetectCookieSupport=1
Licensing - PDFsharp & MigraDoc
PDFsharp and MigraDoc Foundation are published under the MIT License. See the PDFsharp License. See the MigraDoc Foundation License. PDFsharp and MigraDoc Foundation are Open Source and free to useCopy, modify and integrate the source code of PDFsharp and
www.pdfsharp.net
// See https://aka.ms/new-console-template for more information
using PdfSharp.Drawing;
using PdfSharp.Pdf;
using PdfSharp.Snippets.Drawing;
using System.Drawing;
using System.Drawing.Imaging;
using (Image image = Image.FromFile(@"D:\document\팩스이미지1.tif"))
{
int pageCount = image.GetFrameCount(FrameDimension.Page);
PdfDocument doc = new PdfDocument();
for (int i = 0; i < pageCount; i++)
{
image.SelectActiveFrame(FrameDimension.Page, i);
using (MemoryStream ms = new MemoryStream())
{
image.Save(ms, ImageFormat.Bmp);
XImage img = XImage.FromStream(ms);
PdfPage page = new PdfPage();
doc.Pages.Add(page);
XGraphics xgr = XGraphics.FromPdfPage(doc.Pages[i]);
xgr.DrawImage(img, 0, 0);
}
}
doc.Save(@"D:\document\팩스이미지1.pdf");
doc.Close();
}
출력 결과 입니다.

'C#' 카테고리의 다른 글
[C#] Interop 한 Excel API 가 정상적으로 종료 되지 않을 때 처리 방안 (0) | 2024.09.03 |
---|---|
[C#] Singletone Instance 생성을 이용한 Log File Write 처리 예제 입니다. (0) | 2024.08.05 |
BitMiracle.Docotic.Pdf를 이용한 Tiff To Pdf 변환 예제 (0) | 2024.06.16 |
[C#] HttpClient.PostAsync 메서드 에는 HttpCompletionOption을 설정 할 수 없는 부분에 대한 대처 방안 (0) | 2024.02.04 |
[C#] HttpClient 에 CookieContainer 이용 JSESSIONID 설정 진행 예제 (0) | 2024.02.04 |