나는 여러 pdfs (심지어 1000+ 이상)를 가져 와서 하나의 pdf로 병합하는 프로그램을 가지고있다.iTextSharp pdf 병합 스풀 문제
프로그램이 완벽하게 작동하지만 스풀 오류가 발생했습니다.
합병 된 pdf를 Acrobat으로 열고 인쇄하는 경우 n 페이지의 단일 스풀을 프린터로 보내는 대신 원래의 pdfs 수만큼 스풀을 보내 프린터의 처리 속도가 매우 느립니다. 둘째 판 -
이것은 액션이 iText의 Chapter 6를 다운로드하십시오 클래스
Document document = new Document (iTextSharp.text.PageSize.A4);
PdfWriter writer = PdfWriter.GetInstance (document, new FileStream (outputFilename, FileMode.Create));
writer.SetFullCompression();
document.Open();
PdfContentByte cb = writer.DirectContent;
foreach(var file in files) {
PdfReader reader = new PdfReader (file);
int n = reader.NumberOfPages;
int i = 0;
while (i < n)
{
i++;
document.SetPageSize (reader.GetPageSizeWithRotation (i));
document.NewPage();
page = writer.GetImportedPage (reader, i);
rotation = reader.GetPageRotation (i);
cb.AddTemplate (page, 1f, 0, 0, 1f, 0, 0);
}
}
document.Close();
힌트 감사합니다. 이외에도, 그것은 스풀 문제도 해결합니다.). 나는이 코드를 몇 년 동안 사용했는지는 기억이 나지 않지만 더 이상 PdfWriter를 사용하지 않을 것이라는 점을 잘 알고있다. D –