|
@@ -43,14 +43,15 @@ namespace HiTeachCC.Service.Core.Implement
|
|
|
}
|
|
|
else if (FileType.GetExtention(file.FileName).ToLower().Equals("pdf"))
|
|
|
{
|
|
|
- //PdfDocument inputDocument = PdfSharpCore.Pdf.IO.PdfReader.Open(file.OpenReadStream(), PdfDocumentOpenMode.Import);
|
|
|
- //int count = inputDocument.PageCount;
|
|
|
- //int limit= BaseConfigModel.Configuration.GetSection("HABOOKConfig:PDFLimit").Get<int>();
|
|
|
- //if (count > limit) {
|
|
|
- // throw new BizException(500, "PDF file cannot exceed "+limit+" pages!");
|
|
|
- //}
|
|
|
+ PdfDocument inputDocument = PdfSharpCore.Pdf.IO.PdfReader.Open(file.OpenReadStream(), PdfDocumentOpenMode.Import);
|
|
|
+ int count = inputDocument.PageCount;
|
|
|
+ int limit = BaseConfigModel.Configuration.GetSection("HABOOKConfig:PDFLimit").Get<int>();
|
|
|
+ if (count > limit)
|
|
|
+ {
|
|
|
+ throw new BizException(500, "PDF file cannot exceed " + limit + " pages!");
|
|
|
+ }
|
|
|
await ProcessPDF(file, resdict);
|
|
|
- resdict.Add("page", 1000);
|
|
|
+ resdict.Add("page", count);
|
|
|
return resdict;
|
|
|
}
|
|
|
else {
|