5

Has anyone seen this particular error from Ghostscript when executing the following raster.Open:

using (var raster = new GhostscriptRasterizer())
{
raster.Open(pdfFileStream, _version, true);

where _version is:

Ghostscript.NET.GhostscriptVersionInfo _version = Ghostscript.NET.GhostscriptVersionInfo.GetLastInstalledVersion(Ghostscript.NET.GhostscriptLicense.GPL | Ghostscript.NET.GhostscriptLicense.AFPL, Ghostscript.NET.GhostscriptLicense.GPL);

System.OverflowException: Arithmetic operation resulted in an overflow. at Microsoft.WinAny.Interop.DynamicNativeLibrary.FinalizeSections(MEMORY_MODULE* memory_module) at Microsoft.WinAny.Interop.DynamicNativeLibrary.MemoryLoadLibrary(Byte[] data) at Microsoft.WinAny.Interop.DynamicNativeLibrary..ctor(Byte[] buffer) at Ghostscript.NET.GhostscriptLibrary..ctor(GhostscriptVersionInfo version, Boolean fromMemory) at Ghostscript.NET.Interpreter.GhostscriptInterpreter..ctor(GhostscriptVersionInfo version, Boolean fromMemory) at Ghostscript.NET.Viewer.GhostscriptViewer.Open(String path, GhostscriptVersionInfo versionInfo, Boolean dllFromMemory) at Ghostscript.NET.Viewer.GhostscriptViewer.Open(Stream stream, GhostscriptVersionInfo versionInfo, Boolean dllFromMemory) at Ghostscript.NET.Rasterizer.GhostscriptRasterizer.Open(Stream stream, GhostscriptVersionInfo versionInfo, Boolean dllFromMemory) at PersonnelDocuments.Controllers.SearchController.Splitter(Stream fileStream, IEnumerable'1 adminKeys) at PersonnelDocuments.Controllers.SearchController.d__14.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.b__36(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult'1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase'1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.b__3d() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.b__3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass33.b__32(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult'1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.b__1c() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.b__1e(IAsyncResult asyncResult)

George Alexandria
  • 2,841
  • 2
  • 16
  • 24
John Linton
  • 199
  • 1
  • 13
  • 1
    Did you ever find a solution to this? I've got it occurring intermittently. – Ben Ford Mar 07 '18 at 09:11
  • 2
    I ended up using a static lock and opening the library with: raster.Open(pdfFileStream, _version, false); as there was some issue opening from memory I believe. So my users were okay with some periodic extra latency (if say 2 users were queued by the lock) because the nature of my website is a kind of slow-but-accurate focus on PDF uploads that inherently already take a long time. – John Linton Mar 08 '18 at 15:55
  • I came across this again today. Changing `dllFromMemory` from true to false solved it for me as well. But why? – Lionet Chen Feb 14 '20 at 04:18

0 Answers0