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# ' 카테고리의 다른 글
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 |
특정 위치에 파일 중복 여부 체크 하고 새로운 파일명 구하기 예제 (0) | 2023.08.23 |
C# Process.Start(string fileName) 이용 시에 0x80004005 발생 해결 방안 모색 (0) | 2023.02.28 |