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

New Post: problem with GhostscriptRasterizer reading from MemoryStream and the solution

$
0
0
Hello
There is a problem when Calling GhostscriptRasterizer.Open with a MemoryStream. It says that the format must be pdf, ps or eps. My file is eps and opens correctly in the Viewer sample.

I tracked the problem down to the method GhostScriptViewer.StoreMemoryStreamToTemporaryFile. It tries to figure out the file extensions by looking at a couple of bytes in the stream, but it fails to recognize my file data. There is something wrong with this check or perhaps my file is of a different version of the format.

Anyway I fixed it by adding an overloaded method that also take the extension as a paramater and then no check is needed. I only check that the parameter contains a valid extension. I also made a couple of other overloads to support opening using this method.

Great lib otherwise!

Viewing all articles
Browse latest Browse all 393

Trending Articles



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