我有一个Class,PDF 文件复制问题
Class 如下: 功能是上传一个PDF文件,然后把它拆分成每一页一个PDF文件存放到相关目录
现在想改成不需要拆分,直接复制这个上传的文件到特定目录,请问如何更改
public class PdfExtractorUtility
{
public void ExtractPages(string sourcePdfPath, string OutputPath, string OrderNumber)
{
try
{
// Intialize a new PdfReader instance with the contents of the source Pdf file:
PdfReader reader = new PdfReader(sourcePdfPath);
int pageQuantity = reader.NumberOfPages;
for (int i = 1; i <= pageQuantity; i++)
{
string OutputPathPdf = OutputPath + OrderNumber + "_Page_" + i + ".pdf";
Document sourceDocument = new Document(reader.GetPageSizeWithRotation(i));
PdfCopy pdfCopyProvider = new PdfCopy(sourceDocument, new System.IO.FileStream(OutputPathPdf, System.IO.FileMode.Create));
sourceDocument.Open();
PdfImportedPage importedPage = pdfCopyProvider.GetImportedPage(reader, i);
pdfCopyProvider.AddPage(importedPage);
sourceDocument.Close();
}
reader.Close();
}
catch (Exception ex)
{
throw ex;
}
}
}