I had the same issue in a winform app.
The cause was I was reusing a single GhostscriptViewer instance to open multiple documents. Even creating a new instance for each pdf was throwing the exception when the garbage collector didn't had enough time to dispose the unmanaged resources. I ended up by creating a private member variable to hold the GhostscriptViewer and before opening a new pdf I disposed the viewer if it was not null:
The cause was I was reusing a single GhostscriptViewer instance to open multiple documents. Even creating a new instance for each pdf was throwing the exception when the garbage collector didn't had enough time to dispose the unmanaged resources. I ended up by creating a private member variable to hold the GhostscriptViewer and before opening a new pdf I disposed the viewer if it was not null:
private GhostscriptViewer gsViewer;
// ...
if(this.gsViewer != null)
this.gsViewer.Dispose();
this.gsViewer = new GhostscriptViewer();
poz