밥탄이 기록일지
CheckMate RPA C# PDF 여러개 분할하기 (Spire.pdf) 본문
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Text;
// PDF 분할을 위한 dll
using Spire.Pdf;
public partial class CustomScript
{
public void Execute_Code()
{
string[] pdf = null;
int count = 0;
// 특정 폴더에 있는 모든 pdf 저장
Path path = Path.Combine(@"C:\");
pdf = Directory.GetFiles(path "*.pdf", searchOption: SearchOption.AllDirectories);
// 저장된 pdf 개수만큼 회전
for (int i = 0; i < pdf.Length; i++)
{
PdfDocument doc = new PdfDocument(pdf [i].ToString());
String pattern = path + "_{0}.pdf";
doc.Split(pattern);
doc.Close();
}
}
}
결과
C 폴더에 PDF 파일이 3개이고 각각 2,3,4 페이지를 가졌다면
C 폴더에 _0 ~ _8.총 9개의 pdf 파일로 분할된다.
CheckMate RPA 는 dll 을 다운로드받는 형식이 아니기때문에
Spire.Pdf.dll 파일을 따로 구비해주어야 한다.
'CheckMate RPA' 카테고리의 다른 글
CheckMate RPA C# Delay (0) | 2023.02.06 |
---|---|
CheckMate RPA C# 시간차 출력 (TimeSpan) (0) | 2023.01.19 |
CheckMate RPA C# 날짜 데이터 출력 (Datetime) (0) | 2022.12.20 |
CheckMate RPA C# 웹 페이지 크롤링 값 저장하기 (HtmlAgilityPack.dll) (0) | 2022.12.20 |
CheckMate RPA C# PDF 1개 분할하기 (Spire.pdf) (0) | 2022.11.22 |