The exact results are a bit unpredictable. I get different results when i run it on different computers (Windows Server 2008 R2 and Windows 7).
Using Latest versions of both.
On the windows server, it is using 64 bits Ghostscript, on the Windows 7 it is using the 32bit version.
The code for converting is:
(The stream is just a filestream)
Using Latest versions of both.
On the windows server, it is using 64 bits Ghostscript, on the Windows 7 it is using the 32bit version.
The code for converting is:
(The stream is just a filestream)
using (var rasterizer = new GhostscriptRasterizer())
using (var memoryStream = new MemoryStream())
{
stream.CopyTo(memoryStream);
memoryStream.Seek(0, SeekOrigin.Begin);
rasterizer.Open(memoryStream, gsversion, false);
return this.CreateTiffFile(color, rasterizer);
}
Snippet from CreateTiffFilevar page = rasterizer.GetPage(300, 300, i)
This fails with an ArgumentException at on my Windows 7 computer:System.Drawing.dll!System.Drawing.Bitmap.Bitmap(int width, int height, System.Drawing.Imaging.PixelFormat format) Unknown
Ghostscript.NET.dll!Ghostscript.NET.Viewer.GhostscriptViewerImage.GhostscriptViewerImage(int width, int height, int stride, System.Drawing.Imaging.PixelFormat format) Unknown
Ghostscript.NET.dll!Ghostscript.NET.Viewer.GhostscriptViewerImage.Create(int width, int height, int stride, System.Drawing.Imaging.PixelFormat format) Unknown
Ghostscript.NET.dll!Ghostscript.NET.Viewer.GhostscriptViewerDisplayHandler.Presize(System.IntPtr handle, System.IntPtr device, int width, int height, int raster, uint format) Unknown
Ghostscript.NET.dll!Ghostscript.NET.GhostscriptDisplayDeviceHandler.display_presize(System.IntPtr handle, System.IntPtr device, int width, int height, int raster, uint format) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
Ghostscript.NET.dll!Ghostscript.NET.Interpreter.GhostscriptInterpreter.Run(string str) Unknown
Ghostscript.NET.dll!Ghostscript.NET.Viewer.GhostscriptViewer.ShowPage(int pageNumber, bool refresh) Unknown
Ghostscript.NET.dll!Ghostscript.NET.Rasterizer.GhostscriptRasterizer.GetPage(int xDpi, int yDpi, int pageNumber) Unknown
If i debug with the soruce for Ghostscript.Net available i see that it is because it tries to create a document with zero height and width.