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


Groups > comp.lang.postscript > #2281 > unrolled thread

Getting progress data update from Ghostscript

Started byPeter C <kkchan7440@gmail.com>
First post2015-05-22 02:04 -0700
Last post2015-05-22 15:15 +0100
Articles 4 — 2 participants

Back to article view | Back to comp.lang.postscript


Contents

  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

#2281 — Getting progress data update from Ghostscript

FromPeter C <kkchan7440@gmail.com>
Date2015-05-22 02:04 -0700
SubjectGetting progress data update from Ghostscript
Message-ID<11365feb-899b-42fa-bbbe-2cb9c96b93b0@googlegroups.com>
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.

Please let me know which particular source code or at least point me to the right direction. It seems there is no documentation for this purpose.

Thanks in advance.

[toc] | [next] | [standalone]


#2282

Fromken <ken@spamcop.net>
Date2015-05-22 12:35 +0100
Message-ID<MPG.2fc924afd41e32af9898fd@usenet.plus.net>
In reply to#2281
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

[toc] | [prev] | [next] | [standalone]


#2283

FromPeter C <kkchan7440@gmail.com>
Date2015-05-22 05:11 -0700
Message-ID<403fa89e-af00-4fc0-ad71-a1de09dffafc@googlegroups.com>
In reply to#2282
> 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.

Initially I am thinking of getting progress data from driver side, for example a TIFF or PNG driver. Using image height as an percentage measurement but that does not include interpretation time. 

> 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).
> 
> 				Ken

Yes, postscript will be rather tricky to get page count. PDF should be doable.

BTW is there any discussion group about ghostscript code modification or enhancement.

[toc] | [prev] | [next] | [standalone]


#2284

Fromken <ken@spamcop.net>
Date2015-05-22 15:15 +0100
Message-ID<MPG.2fc94a5755af9f1d9898fe@usenet.plus.net>
In reply to#2283
In article <403fa89e-af00-4fc0-ad71-a1de09dffafc@googlegroups.com>, 
kkchan7440@gmail.com says...

> > 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.
> 
> Initially I am thinking of getting progress data from driver side, for example a TIFF or PNG driver. Using image height as an percentage measurement but that does not include interpretation time. 

That's only going to work if the device is using a clist (display list). 
Normally the entire canvas is held in memory and rendered to by the 
marking operations, then the entire canvas is written to the output.

So you will need to enforce clist mode, which may impact performance. 
Its also not a really good measure, since as you note, it doesn't 
include any interpretation time at all.

Additionally you will need to reproduce any changes you make in the 
devices each time we make a new release, so its going to be awkward to 
maintain.


> Yes, postscript will be rather tricky to get page count. PDF should be 
> doable.

There is already code for retrieving the page count in a PDF file. In 
the general case, in a PostScript file, its not possible at all.

 
> BTW is there any discussion group about ghostscript code modification or enhancement.

There is the gs-devel mailing list, and that's about it.


			Ken

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.postscript


csiph-web