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

Created Unassigned: System.OutOfMemoryException: Insufficient memory to continue the execution of the program [2254]

$
0
0
When I use GhostscriptRasterizer.GetPage to get PDF page as image, I got the exception, not happening all the time:
System.OutOfMemoryException: Insufficient memory to continue the execution of the program.

System.Runtime.InteropServices.Marshal.AllocHGlobal(IntPtr cb)
Ghostscript.NET.Viewer.GhostscriptViewerDisplayHandler.Page(IntPtr handle, IntPtr device, Int32 copies, Int32 flush)
Ghostscript.NET.GhostscriptDisplayDeviceHandler.display_page(IntPtr handle, IntPtr device, Int32 copies, Int32 flush)
Ghostscript.NET.Interpreter.GhostscriptInterpreter.Run(String str)
Ghostscript.NET.Viewer.GhostscriptViewerPdfFormatHandler.ShowPage(Int32 pageNumber)
Ghostscript.NET.Viewer.GhostscriptViewer.ShowPage(Int32 pageNumber, Boolean refresh)
Ghostscript.NET.Rasterizer.GhostscriptRasterizer.GetPage(Int32 xDpi, Int32 yDpi, Int32 pageNumber)

Code:
using (var source = new MemoryStream(documentFileContent))
{
using (var rasterizer = new Ghostscript.NET.Rasterizer.GhostscriptRasterizer())
{
rasterizer.Open(source, version, true);

for (var i = 1; i <= rasterizer.PageCount; i++)
{
var img = rasterizer.GetPage(desiredDpi, desiredDpi, i);

Viewing all articles
Browse latest Browse all 393

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>