标签:readonly string nbsp int count enum doc tutorial new
Nuget安装iText7
using iText.Kernel.Utils; using iText.Kernel.Pdf; using System.IO; public class MyPdfSplitter : PdfSplitter { private readonly string _destFolder; private int _pageNumber; public MyPdfSplitter(PdfDocument pdfDocument, string destFolder) : base(pdfDocument) { _destFolder = destFolder; } protected override PdfWriter GetNextPdfWriter(PageRange documentPageRange) { _pageNumber++; return new PdfWriter(Path.Combine(_destFolder, $"pdf{_pageNumber}.pdf")); } } static void ITextSplitPdf() { string rawPdfFile = @"C:\Users\ffu\Downloads\Essential_Javascript_--_A_Javascript_Tutorial.pdf"; string splitPDFDir = Directory.GetCurrentDirectory() + "//"; using (var pdfDoc = new PdfDocument(new PdfReader(rawPdfFile))) { var splitDocuments = new MyPdfSplitter(pdfDoc, splitPDFDir).SplitByPageCount(1); foreach (var splitDocument in splitDocuments) { splitDocument.Close(); } } }
标签:readonly string nbsp int count enum doc tutorial new
原文地址:https://www.cnblogs.com/Fred1987/p/11116256.html