using (var ms = new MemoryStream(file)) {
var document = PdfReader.Open(ms);
if (SetFontResolver == false) {
SetFontResolver = true;
GlobalFontSettings.FontResolver = new FontResolver();
}
foreach (var page in document.Pages) {
var content = ContentReader.ReadContent(page); //error
CustomMsg: Microsoft Windows NT 6.3.9600.0 8.0.7.-1
Message:Unexpected EOF
Source:ICSharpCode.SharpZipLib
StackTrace: at ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream.Fill()
at ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at PdfSharpCore.Pdf.Filters.FlateDecode.Decode(Byte[] data, FilterParms parms)
at PdfSharpCore.Pdf.Filters.Filter.Decode(Byte[] data, PdfDictionary decodeParms)
at PdfSharpCore.Pdf.Filters.Filtering.Decode(Byte[] data, PdfItem filterItem, PdfItem decodeParms)
at PdfSharpCore.Pdf.Advanced.PdfContent.Decode()
at PdfSharpCore.Pdf.Advanced.PdfContent..ctor(PdfDictionary dict)
at PdfSharpCore.Pdf.PdfPage.get_Contents()
at PdfSharpCore.Pdf.Content.CParser..ctor(PdfPage page)
at PdfSharpCore.Pdf.Content.ContentReader.ReadContent(PdfPage page)
at ToolGood.GearReducer.Infrastructure.PdfHelper.AddTexts(Byte[] file, List`1 items, String watermarkPath) in E:\somain\ToolGood.GearReducer_sk\src-en\ToolGood.GearReducer.Infrastructure\PdfHelper.cs:line 122
at ToolGood.GearReducer.Pages.Download.PdfFileModel.OnPostAsync(String n) in E:\somain\ToolGood.GearReducer_sk\src-en\ToolGood.GearReducer\Pages\Download\PdfFile.cshtml.cs:line 123
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Convert[T](Object taskAsObject)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync()
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync()
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
CustomMsg: Microsoft Windows NT 6.3.9600.0 8.0.7.-1 Message:Unexpected EOF Source:ICSharpCode.SharpZipLib StackTrace: at ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream.Fill() at ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream.Read(Byte[] buffer, Int32 offset, Int32 count) at PdfSharpCore.Pdf.Filters.FlateDecode.Decode(Byte[] data, FilterParms parms) at PdfSharpCore.Pdf.Filters.Filter.Decode(Byte[] data, PdfDictionary decodeParms) at PdfSharpCore.Pdf.Filters.Filtering.Decode(Byte[] data, PdfItem filterItem, PdfItem decodeParms) at PdfSharpCore.Pdf.Advanced.PdfContent.Decode() at PdfSharpCore.Pdf.Advanced.PdfContent..ctor(PdfDictionary dict) at PdfSharpCore.Pdf.PdfPage.get_Contents() at PdfSharpCore.Pdf.Content.CParser..ctor(PdfPage page) at PdfSharpCore.Pdf.Content.ContentReader.ReadContent(PdfPage page) at ToolGood.GearReducer.Infrastructure.PdfHelper.AddTexts(Byte[] file, List`1 items, String watermarkPath) in E:\somain\ToolGood.GearReducer_sk\src-en\ToolGood.GearReducer.Infrastructure\PdfHelper.cs:line 122 at ToolGood.GearReducer.Pages.Download.PdfFileModel.OnPostAsync(String n) in E:\somain\ToolGood.GearReducer_sk\src-en\ToolGood.GearReducer\Pages\Download\PdfFile.cshtml.cs:line 123 at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Convert[T](Object taskAsObject) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync() at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync() at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)