CheckMate RPA

CheckMate RPA C# PDF to Excel 변환하기 (SautinSoft.PdfFocus.dll)

밥탄이 2023. 4. 12. 11:26
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Text;

public partial class CustomScript
{
	public void Execute_Code()
	{
		// 변환 후 저장할 엑셀 파일명
		s_ConvertExcel = s_Current_PDF.Replace(".pdf", ".xls");
		
		SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
		
		// 변환할 PDF 파일 (현재파일)
		f.OpenPdf(s_Current_PDF);
		
		// 변환 완료
		f.ToExcel(s_ConvertExcel);
	}
}

이전에 올렸던 Spire.pdf.dll 을 사용한 pdf 변환법과는 차이점이 있다.

 

1. Spire.pdf 을 이용하여 pdf를 변환할 땐 페이지를 먼저 자른 후 1페이지씩 변환을 진행해야했는데

SautinSoft.PdfFocus 을 이용하여 변환할 땐 pdf to excel 과정에서 페이지가 "sheet"로 구분되어 저장된다.

 

2. Spire.pdf 을 이용하여 pdf를 변환할 땐 변환할 pdf 에 따라 수행시간에 차이가 압도적으로 발생했지만

SautinSoft.PdfFocus 을 이용하여 변환할 땐 시간이 일정하게 소요되었다.

 

3. 코드 간소화가 가능하다. 대신 Spire.pdf 에서는 엑셀 버전을 xlsx, xls 선택할 수 있었지만 sautinsoft에서는 xls로만 변환이 가능하다.