[comp.windows.open-look] Pageview problem

brown@ftms.UUCP (Vidiot) (03/27/91)

Version OW 2.0

The pageview man page says "pageview renders a document, a page at a time,".
To that I have to say BullShit :-(

I have a couple of groff produced PostScript files, one containing three
pages and the other 26 pages.  Needless to say that when I bring up pageview
and load each file, ALL of the pages get displayed.  So much for each page at
a time.

Does anyone have a hint as to what pageview is looking for for pagebreaks?
Does it want %%Page:?  If so, the document has: %%Page: 1 1, etc.

Is pageview broke or an I missing something?

Thanks in advance.
-- 
harvard\
  ucbvax!uwvax!astroatc!ftms!brown
rutgers/
INTERNET: spool.cs.wisc.edu!astroatc!ftms!brown

rberlin@birdlandEng.Sun.COM (Rich Berlin) (03/27/91)

In article <35@ftms.UUCP>, brown@ftms.UUCP (Vidiot) writes:
|> 
|> Version OW 2.0
|> 
|> The pageview man page says "pageview renders a document, a page at a time,".
|> To that I have to say BullShit :-(
|> 
|> I have a couple of groff produced PostScript files, one containing three
|> pages and the other 26 pages.  Needless to say that when I bring up pageview
|> and load each file, ALL of the pages get displayed.  So much for each page at
|> a time.
|> 
|> Does anyone have a hint as to what pageview is looking for for pagebreaks?
|> Does it want %%Page:?  If so, the document has: %%Page: 1 1, etc.
|> 
|> Is pageview broke or an I missing something?
|> 
|> Thanks in advance.
|> -- 
|> harvard\
|>   ucbvax!uwvax!astroatc!ftms!brown
|> rutgers/
|> INTERNET: spool.cs.wisc.edu!astroatc!ftms!brown

This question might be a good candidate for the FAQ list.

Yes, PageView needs the structuring comments; I'd say there's a good
chance that groff is producing non-conforming PostScript.  The
"%%Page: 1 1" comment sounds correct, but pageview also requires some
of the other comments in order to work correctly, and that may be
causing the problem.  If the prolog sections aren't correctly
delimited, things are likely to break.  I don't think it cares about
things like %%DocumentFonts.

-- Rich

marc@sequoia.cray.com (Marc Bouron) (03/27/91)

In article <35@ftms.UUCP>, brown@ftms.UUCP (Vidiot) writes:
|> 
|> Version OW 2.0
|> 
|> The pageview man page says "pageview renders a document, a page at a time,".
|> To that I have to say BullShit :-(
|> 
|> I have a couple of groff produced PostScript files, one containing three
|> pages and the other 26 pages.  Needless to say that when I bring up pageview
|> and load each file, ALL of the pages get displayed.  So much for each page at
|> a time.
|> 
|> Does anyone have a hint as to what pageview is looking for for pagebreaks?
|> Does it want %%Page:?  If so, the document has: %%Page: 1 1, etc.
|> 
|> Is pageview broke or an I missing something?
|> 
|> Thanks in advance.

So it's not only me!!!  I've noticed this a couple of times - PostScript
produced with IBM's Script/VS will sometimes produce output where all the
pages are overlayed.  I only imagine that PageView is real finicky about the
%%Comments?


[M][a][r][c]


################################################################################
#                           #  marc@sequoia.cray.com           #     .   .     #
#  Marc CR Bouron           #  M.Bouron@cray.co.uk     (ARPA)  #    _|\ /|_    #
#  Cray Research (UK) Ltd.  #  M.Bouron@crayuk.uucp  (DOMAIN)  #   (_|_V_|_)   #
#  +44 344 485971 x2208     #  M.Bouron@uk.co.cray    (JANET)  #     |   |     #
#                           #  ...!ukc!crayuk!M.Bouron (UUCP)  #               #
################################################################################

naughton@wind.Eng.Sun.COM (Patrick Naughton) (03/28/91)

In article <35@ftms.UUCP>, brown@ftms.UUCP (Vidiot) writes:
|> 
|> Version OW 2.0
|> 
|> The pageview man page says "pageview renders a document, a page at a time,".
|> To that I have to say BullShit :-(
|> 
|> I have a couple of groff produced PostScript files, one containing three
|> pages and the other 26 pages.  Needless to say that when I bring up pageview
|> and load each file, ALL of the pages get displayed.  So much for each page at
|> a time.
|> 
|> Does anyone have a hint as to what pageview is looking for for pagebreaks?
|> Does it want %%Page:?  If so, the document has: %%Page: 1 1, etc.
|> 
|> Is pageview broke or an I missing something?
|> 
|> Thanks in advance.
|> -- 
|> harvard\
|>   ucbvax!uwvax!astroatc!ftms!brown
|> rutgers/
|> INTERNET: spool.cs.wisc.edu!astroatc!ftms!brown


Looks like it is once again time for my bi-annual "why does pageview
care about comments?" explanation...

Here it is pasted from a comp.lang.postscript discussion last year.

        Yes, pageview REQUIRES the Adobe Structuring Conventions to be
        followed to the letter.  Many people have written programs
        which output PostScript as if they had never seen Appendix C of
        the RedBook; while others read it and chose to ignore it for
        reasons beyond me (Frame).  Common errors range from having no
        comments at all, to misspelling "%%Page", to having code in the
        "no-mans-land" between the "%%EndProlog" and the first
        "%%Page:".  I've even seen files which went to the trouble to
        insert comments, but made up their own like "%%BeginPage:" and
        "%%EndPage:"!  A future version of PageView will have a "dumb
        mode" which will use showpage to step through a non-conforming
        document front to back with no random access.


Here are the adobe structuring conventions which pageview enforces:
Pageview sends the code from the beginning of the document to the
%%EndProlog to the server first, then the code between the %%BeginSetup
and %%EndSetup, (notice that it does not send any code between the
%%EndProlog and %%BeginSetup, nor between the %%EndSetup and the first
%%Page.)  Then for each page you want to view, it interprets the code
which is between %%Page 'n' and and the next %%Page: (or %%Trailer for
the last page).


%!PS-Adobe-2.1
%%BeginProcSet
        % You can make any definitions you want here, but cannot
        % change the state of the interpreter.  This is the "prologue",
        % which can be permanently downloaded or made available once
        % for a large number of individual document bodies.
%%EndProcSet
%%EndProlog
--- any code in here will be IGNORED! ---
% ------------- cut here for permanent download of the prologue ----------
%%BeginSetup
        % You can change the state of the interpreter here, and
        % provide any job-specific setup like reencoding fonts.
        % Bear in mind that YOU are responsible for any state
        % you set here and how it is used by each page.  The
        % structuring conventions just guarantee that it will
        % always be executed first, before any of the pages.  The
        % structuring conventions to not dictate *which* page
        % will be the one to execute after setup.  It could be
        % page 1, page 4, or page 15, depending on page selection
        % and reordering that may be done by the server.  This section
        % is part of the individual document body, and must be
        % repeated with each document.  It is not part of the prologue.
%%EndSetup
--- any code in here will be IGNORED! ---
% ------------- cut here for page reordering or subsetting ---------------
%%Page: "label" m
        % any code can go here.  It may rely on prologue definitions
        % made before the %%EndProlog comment, and it may rely on
        % state set up in the Setup section ONLY IF it also leaves
        % that state set at the end of the page.  This is because
        % the pages must not be interdependent, and any of them may
        % be executed in any order.
        % If a matrix representing the current matrix is stored into
        % a variable during setup, it is reasonable to use this value
        % with "setmatrix" to establish the coordinate system at the
        % beginning of each page.
%%Page: "label" n
        % This is exactly the same as page "m"
%%Trailer
        % The structuring conventions guarantee only that this code
        % will be executed last, after the final page.  It is
        % appropriate here to remove your dictionaries from the
        % dictionary stack and to make sure you've left nothing
        % on the operand stack.
%%EOF
        % If this is the end of job and an end-of-file would normally
        % appear here, this comment may be used to indicate end-of-
        % file in a transport-mechanism-independent manner.

-- 
    ______________________________________________________________________
    Patrick J. Naughton				   email: naughton@sun.com
    Sun Laboratories				   voice: (415) 336 - 1080

brown@vidiot.UUCP (Vidiot) (03/28/91)

In article <10561@exodus.Eng.Sun.COM> naughton@wind.Eng.Sun.COM (Patrick Naughton) writes:
<
<Looks like it is once again time for my bi-annual "why does pageview
<care about comments?" explanation...
<
<Here it is pasted from a comp.lang.postscript discussion last year.

Sorry, I missed it last year.  Thanks for the info, it is much appreciated.
-- 
      harvard\     att!nicmad\          spool.cs.wisc.edu!astroatc!vidiot!brown
Vidiot  ucbvax!uwvax..........!astroatc!vidiot!brown
      rutgers/  decvax!nicmad/ INTERNET:vidiot!brown%astroatc@spool.cs.wisc.edu

csd35@seq1.keele.ac.uk (Jonathan Knight) (03/28/91)

From article <10540@exodus.Eng.Sun.COM>, by rberlin@birdlandEng.Sun.COM (Rich Berlin):
> In article <35@ftms.UUCP>, brown@ftms.UUCP (Vidiot) writes:
> |> Is pageview broke or an I missing something?

Pageview is broken.

> Yes, PageView needs the structuring comments; I'd say there's a good
> chance that groff is producing non-conforming PostScript.  The
> "%%Page: 1 1" comment sounds correct, but pageview also requires some
> of the other comments in order to work correctly, and that may be
> causing the problem.  If the prolog sections aren't correctly
> delimited, things are likely to break.  I don't think it cares about
> things like %%DocumentFonts.

The bug with pageview is noted in the groff documentation.  Re-compile
groff with the '-DBROKENSPOOLER' flag switched on and groff will then
do its best to work around the problem.

This is from the groff docs:
# Include -DBROKEN_SPOOLER in CPPDEFINES if you have a PostScript
# spooler or previewer that is unable to cope with anything after
# %%EndProlog and before the first page (old versions of TranScript
# have this problem) or gets confused by included documents (the Sun
# pageview previewer has this problem), or if you are going to be
# sharing PostScript documents with others who might be running such a
# spooler or previewer.


-- 
  ______    JANET :jonathan@uk.ac.keele.cs     Jonathan Knight,
    /       BITNET:jonathan%cs.kl.ac.uk@ukacrl Department of Computer Science
   / _   __ other :jonathan@cs.keele.ac.uk     University of Keele, Keele,
(_/ (_) / / UUCP  :...!ukc!kl-cs!jonathan      Staffordshire.  ST5 5BG.  U.K.

jjc@jclark.UUCP (James Clark) (03/29/91)

In article <35@ftms.UUCP> brown@ftms.UUCP (Vidiot) writes:

   I have a couple of groff produced PostScript files, one containing three
   pages and the other 26 pages.  Needless to say that when I bring up pageview
   and load each file, ALL of the pages get displayed.  So much for each page at
   a time.

   Does anyone have a hint as to what pageview is looking for for pagebreaks?
   Does it want %%Page:?  If so, the document has: %%Page: 1 1, etc.

   Is pageview broke or an I missing something?

I have had several people report this problem to me.  Apparently
pageview gets confused by lines after the first line that begin with
`%!'.  Note that such lines are allowed by the Document Structuring
Conventions, so this is a bug in pageview.  If you compile groff
(actually just ps/ps.c) with -DBROKEN_SPOOLER, it will, amongst other
things, strip out any such lines.  In fact the Makefile explicitly
says to use -DBROKEN_SPOOLER if you're going to be using pageview.
(although it gave an incorrect reason for this in versions earlier
than 1.01).

James Clark
jjc@jclark.uucp
jjc@ai.mit.edu

naughton@wind.Eng.Sun.COM (Patrick Naughton) (03/30/91)

Guilty as charged.  There was a bug in the V2 pageview which caused it
to fail when loading documents with included PostScript documents (a
line beginning with %!) inside of them... This is fixed in the latest
version. (Don't ask me when you can get it.)


In article <JJC.91Mar28210438@jclark.UUCP>, jjc@jclark.UUCP (James Clark) writes:
|> In article <35@ftms.UUCP> brown@ftms.UUCP (Vidiot) writes:
|> 
|>    I have a couple of groff produced PostScript files, one containing three
|>    pages and the other 26 pages.  Needless to say that when I bring up pageview
|>    and load each file, ALL of the pages get displayed.  So much for each page at
|>    a time.
|> 
|>    Does anyone have a hint as to what pageview is looking for for pagebreaks?
|>    Does it want %%Page:?  If so, the document has: %%Page: 1 1, etc.
|> 
|>    Is pageview broke or an I missing something?
|> 
|> I have had several people report this problem to me.  Apparently
|> pageview gets confused by lines after the first line that begin with
|> `%!'.  Note that such lines are allowed by the Document Structuring
|> Conventions, so this is a bug in pageview.  If you compile groff
|> (actually just ps/ps.c) with -DBROKEN_SPOOLER, it will, amongst other
|> things, strip out any such lines.  In fact the Makefile explicitly
|> says to use -DBROKEN_SPOOLER if you're going to be using pageview.
|> (although it gave an incorrect reason for this in versions earlier
|> than 1.01).
|> 
|> James Clark
|> jjc@jclark.uucp
|> jjc@ai.mit.edu

-- 
    ______________________________________________________________________
    Patrick J. Naughton				   email: naughton@sun.com
    Sun Laboratories				   voice: (415) 336 - 1080

brown@vidiot.UUCP (Vidiot) (03/30/91)

In article <JJC.91Mar28210438@jclark.UUCP> jjc@jclark.UUCP (James Clark) writes:
<
<I have had several people report this problem to me.  Apparently
<pageview gets confused by lines after the first line that begin with
<`%!'.  Note that such lines are allowed by the Document Structuring
<Conventions, so this is a bug in pageview.  If you compile groff
<(actually just ps/ps.c) with -DBROKEN_SPOOLER, it will, amongst other
<things, strip out any such lines.  In fact the Makefile explicitly
<says to use -DBROKEN_SPOOLER if you're going to be using pageview.
<(although it gave an incorrect reason for this in versions earlier
<than 1.01).

See previous posting about a cure for this problem, with what James points
out here as one of them.

But, I have to agree with the logic at Sun regarding how pageview works.
As pointed out in my previous posting, pageview considers the next instance
of %! to mean that another PostScript document has been included and to
ignore all comments until the next %%Trailer, which better be part of the
included document.  Then it will look at the comments again.  This idea
here, as I gather it, is that the included document is part of the page
that it is trying to display.  The included document should only really
be one page and part of the page it was included with.

Well, groff kind-of messes up that logic.  By adding the %! line again,
pageview thought that another PostScript file was included and rightfully
displayed everything until the %%Trailer came along.  In this case, there
wasn't an included document.  I agree with the person responsible for the
pageview code.  If the offending %! is edited from the groff document, the
document is displayed correctly, one page at a time.  With the -DBROKEN_
SPOOLER flag turned on, it too displays correctly.

I feel that groff should not put in the extra %! line at all.  It is the
only thing that fools pageview, no matter what the state of -DBROKEN_SPOOLER.
Either PostScript output will display correctly, except as noted.

I suspect that James will disagree with me, but it is what I believe.
-- 
      harvard\     att!nicmad\          spool.cs.wisc.edu!astroatc!vidiot!brown
Vidiot  ucbvax!uwvax..........!astroatc!vidiot!brown
      rutgers/  decvax!nicmad/ INTERNET:vidiot!brown%astroatc@spool.cs.wisc.edu

brown@vidiot.UUCP (Vidiot) (03/31/91)

In article <10732@exodus.Eng.Sun.COM> naughton@wind.Eng.Sun.COM (Patrick Naughton) writes:
<Guilty as charged.  There was a bug in the V2 pageview which caused it
<to fail when loading documents with included PostScript documents (a
<line beginning with %!) inside of them... This is fixed in the latest
<version. (Don't ask me when you can get it.)

Answer me this.  Going under the assumption that included PostScript files
are not supposed to be anything other than a single page, if the new version
of pageview pays attention to the comments of the included PostScript file,
might it only display the included part of the PostScript and not the whole
page?  Then this would be a bug in the opposite direction, i.e., incomplete
displaying of the page.

As I was told by the person maintaining the pageview code, when it runs
across a %! inside of the document, it is supposed to ignore all comments
until the %%Trailor.  This will make it display the included document and
the main page and then stop at the main document's %%Page.  If I understand
what you are saying, the new pageview may stop at a %%Page inside of the
included document, even if it is the single page that it should be.  Therefore
it would not display the main document's information for that page.

In my case, the groff document put in a %! when there wasn't an included
document, so the display was out-of-sync, and I believe rightly so.

Now I am getting confused.  What is the new version of pageview going to do?
-- 
      harvard\     att!nicmad\          spool.cs.wisc.edu!astroatc!vidiot!brown
Vidiot  ucbvax!uwvax..........!astroatc!vidiot!brown
      rutgers/  decvax!nicmad/ INTERNET:vidiot!brown%astroatc@spool.cs.wisc.edu