Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown error on rasterizer.GetPage on gs 10.02.1 (closing without exception) #131

Open
jpsaunier opened this issue Jan 6, 2025 · 0 comments

Comments

@jpsaunier
Copy link

Good morning,
I have a file which opens perfectly under Ghostscript (10.02.1) which displays the two contained pages.
But the code below (using your library with gsdll64.dll and gsdll32.dll) produces an error which completely stops execution (even under Visual Studio, the software closes without any possibility of debugging, and no exception are provided !!!).
The hard stop happens in the line image = rasterizer.GetPage(DPI, pageNumber); on the second page.

I would like to provide you with the file by private message for debugging.

            Image image = null;

            try
            {
                using (var rasterizer = new GhostscriptRasterizer())
                {
                    using (var stream = File.Open(FilenameToTest, FileMode.Open,FileAccess.Read,FileShare.ReadWrite))
                    {
                        rasterizer.Open(stream, _gs_verssion_info, true);

                        if (rasterizer.PageCount == 0)
                            throw new Exception("No Page");
                        for (int pageNumber = 1; pageNumber <= rasterizer.PageCount; pageNumber++)
                        {
                            image = rasterizer.GetPage(DPI, pageNumber);
                            if (image.Width == 0)
                                throw new Exception("No Image");
                        }
                        rasterizer.Close();
                        stream.Close();
                        stream.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                Debugger.Break();
            }
@jpsaunier jpsaunier changed the title Unknown error on rasterizer.GetPage Unknown error on rasterizer.GetPage on gs 10.02.1 (closing without exception) Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant