Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #2282

Re: Getting progress data update from Ghostscript

From ken <ken@spamcop.net>
Newsgroups comp.lang.postscript
Subject Re: Getting progress data update from Ghostscript
Date 2015-05-22 12:35 +0100
Message-ID <MPG.2fc924afd41e32af9898fd@usenet.plus.net> (permalink)
References <11365feb-899b-42fa-bbbe-2cb9c96b93b0@googlegroups.com>

Show all headers | View raw


In article <11365feb-899b-42fa-bbbe-2cb9c96b93b0@googlegroups.com>, 
kkchan7440@gmail.com says...
> 
> I am looking a way to retrieve progress data from Ghostscript. Something like processing percentage, ripping which page and etc. I am prepare to write some C code to do so. This is for linux platform.

There is no way to do this because the interpreter itself doesn't know. 
THere ar things you can do though

1) PostScript is delivered as a stream of bytes, the interpreter cannot 
tell how far through a strema it is, because it doens't know how big the 
input is.

However, the sample application delivered with Ghostscript on all 
platforms (which is what people *think* of as Ghostscript) is not the 
entire story. You can write a completely different front-end, and that 
can potentially tell how large an input is, and it knows how many bytes 
of that input it has delivered to the interpreter, so it can tell what 
the percentage progress is.

So provided you intend to supply files to the application, and not use 
some kind of network or serial input, you can do ths yourself. It won't 
be 'Ghostscript' though, at least not as people usually thinkg of GS, it 
will be your own application which uses the Ghostscript interpreter.


2) Unless the input file is DSC compliant, there is no way to tell how 
many pages a PostScript program will render. (and even files whch claim 
to be DSC-compliant are often lying).

You can define an EndPage procedure which will allow you to determine 
how many pages have been processed.


Note that neither of these points are relevant when dealing with a PDF 
file as input. Firstly because the PDF interpreter knows how many pages 
are in the PDF file, and can deliver them in any order.

Secondly, it doesn't know how big the actual input stream is (without 
some serious digging about in the internals of the PDF file) and the PDF 
file is not delivered to the PDF interpreter by a stream mechanism. This 
makes it impossible to know how far through the PDF file the interpreter 
is.

Bear in mind that, unlike a PostScript file, thePDF interpreter does not 
start at the beiginning and read every byte till it reaches the end.



				Ken

Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Getting progress data update from Ghostscript Peter C <kkchan7440@gmail.com> - 2015-05-22 02:04 -0700
  Re: Getting progress data update from Ghostscript ken <ken@spamcop.net> - 2015-05-22 12:35 +0100
    Re: Getting progress data update from Ghostscript Peter C <kkchan7440@gmail.com> - 2015-05-22 05:11 -0700
      Re: Getting progress data update from Ghostscript ken <ken@spamcop.net> - 2015-05-22 15:15 +0100

csiph-web