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

GhostScriptRasterizer shows a PageCount of 0 for all PDFs under GhostScript 9.27 #62

Closed
ryanoshea opened this issue Apr 5, 2019 · 9 comments

Comments

@ryanoshea
Copy link

ryanoshea commented Apr 5, 2019

Package version: 1.21
Ghostscript binary version: 9.27 x64
Platform: Windows 10 1809
Project: ASP.NET on .NET Framework 4.6.1, C#

Running the following code produces a GhostscriptRasterizer that has a PageCount of 0.

using (var rasterizer = new GhostscriptRasterizer())
{
    rasterizer.Open("<path to file>");
    // rasterizer.PageCount == 0
}

The same outcome occurs with any input PDF, regardless of contents. It also occurs when calling the Stream overload of Open() with a FileStream or MemoryStream.

Downgrading to Ghostscript 9.26 on the same system fixes the issue.

Apologies in advance if 9.27 is not supported by package version 1.21; I couldn't seem to find a compatibility table.

@voltaek
Copy link

voltaek commented Aug 21, 2019

We ran into the same issue, where v9.26 works fine, but v9.27 never finds any pages. We're using a 32 bit compiled version on .NET Framework 4 for building a Windows service.

I suspect that the "tidying" of the Postscript namespace done in v9.27 may be to blame here. See their changelog entry, specifically the "Incompatible changes" section, for more info.

@brianarch82
Copy link

brianarch82 commented Aug 24, 2019

I encountered a similar problem as well. Commenting out the code below seemed to fix the problem. I don't know anything about GhostScript / Postscript otherwise I would try to fix it.

// open PDF support dictionaries
//this.Execute(@"
// GS_PDF_ProcSet begin
// pdfdict begin");

Please find the changelogs below.

2019-03-19 09:25:48 -0700
Ray Johnston ray.johnston@artifex.com
ebbb3ec7d20b5f4c444eb11fc9835e07229ccbd9

Fix lib/pdf2dsc.ps to use documented Ghostscript pdf procedures.

We eliminated GS_PDF_ProcSet and pdfdict, but runpdfbegin, dopdfpages,
and runpdfend are still available.

lib/pdf2dsc.ps

@tareq2
Copy link

tareq2 commented Nov 6, 2019

The same problem. Is there any fix ?

@deremakif
Copy link

Still same problem!

@epinox
Copy link

epinox commented May 4, 2020

I have a similar problem. I wanted to use the viewer to display a PDF in a form. The events "DisplayUpdate" and "DisplayPage" are not called, only "DisplaySize". It does not work with version 9.52, only up to version 9.26.

@thienquang07
Copy link

same problem here on Ghostscript version 9.52

@thienquang07
Copy link

just went back to version 9.26 and it worked fine.

@JeffOkaki
Copy link

Still a problem and a huge waste of time. Ill try and get a fix submitted. Using GS 9.26 or commenting out the code below works

Ghostscript.NET\Ghostscript.NET\Viewer\FormatHandlers
GhostscriptViewerPdfFormatHandler.cs line 85 through 89

GS_PDF_ProcSet' and 'pdfdict' are private as of GS 9.27

        // open PDF support dictionaries
       // this.Execute(@"
         //       GS_PDF_ProcSet begin
          //      pdfdict begin");

mgieseki/dvisvgm@bc51951

seems to have already fixed it in their product.

@jhabjan
Copy link
Contributor

jhabjan commented Feb 4, 2021

Fixed in today's v.1.2.2. release.

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

9 participants