Quantcast
Channel: Ghostscript.NET
Viewing all articles
Browse latest Browse all 393

Commented Unassigned: Arithmetic operation resulted in an overflow [2243]

$
0
0
Hello,

i get following exception while converting PDF to image...
i use ghostscript 9.14 and ghostscript.net 1.1.8

thanks..

```
An exception of type 'System.OverflowException' occurred.
---------------------------------------------------------
08/12/2014 14:52:34
Type : System.OverflowException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : Arithmetic operation resulted in an overflow.
Source : Ghostscript.NET
Help link :
Data : System.Collections.ListDictionaryInternal
TargetSite : Void FinalizeSections(MEMORY_MODULE*)
HResult : -2146233066
Stack Trace : 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(MemoryStream stream, GhostscriptVersionInfo versionInfo, Boolean dllFromMemory)

```


using that code

```
MemoryStream ms = new MemoryStream();
GhostscriptVersionInfo _lastInstalledVersion = null;
GhostscriptRasterizer _rasterizer = null;
byte[] pdfByteArray = <<<This is a method parameter>>>;
List<byte[]> exportedImageByteList = new List<byte[]>();

try
{
int desired_x_dpi = 300;
int desired_y_dpi = 300;

_lastInstalledVersion =
GhostscriptVersionInfo.GetLastInstalledVersion(
GhostscriptLicense.GPL | GhostscriptLicense.AFPL,
GhostscriptLicense.GPL);

_rasterizer = new GhostscriptRasterizer();
_rasterizer.Open(new MemoryStream(pdfByteArray), _lastInstalledVersion, true);

Logger.Info("This Log will not hit when exception occurs");

for (int i = 1; i < _rasterizer.PageCount+1; i++)
{
ms.Position = 0;
System.Drawing.Image img = _rasterizer.GetPage(desired_x_dpi, desired_y_dpi, i);
img.Save(ms, ImageFormat.Gif);
ms.Position = 0;
exportedImageByteList.Add(ms.ToArray());
}

}
catch (Exception ex)
{
Logger.ErrorException("Exception !!!", ex);
}
```
Comments: ** Comment from web user: josip **

Hi,

Did you try to use the "false" option?

Cheers,
Josip


Viewing all articles
Browse latest Browse all 393

Trending Articles