Sorry, I had overlooked the link in the very first post.
Also thanks for the patch which shows how cups-filters (most probably
pstops) massages the file.
The file has actually 993 pages:
$ gs -q -dBATCH -dNOPAUSE -sDEVICE=bbox all.ps 2>&1 | grep
%%BoundingBox: | wc -l
993
or simply display it with
gs all.ps
(and press Enter 993 times).
evince also shows only the 422 pages which your PostScript viewer shows
to you.
The file has strange internal page numbering:
$ grep -i '%%Page: ' all.ps | wc -l
993
$ grep -i '%%Page: ' all.ps
It redefines "showpage" (the PostScript function to display/print a page
when completed rendering it:
$ grep showpage all.ps | wc -l
1
$ grep showpage all.ps
/p{pop showpage pagesave restore /pagesave save def}def
This makes a single "p" displaying/printing the page.
So let us search for those "p"s:
$ grep ' p$' all.ps | wc -l
993
So Ghostscript (or the print process) outputting 993 pages seems correct
to me, and I do not understand why evince and also your PostScript
viewer only output 422 pages. Perhaps they consider duplicate page
numbers as duplicate pages and skip them.
First numbers in "%%Page:" lines:
$ grep -i '%%Page: ' all.ps | cut -d ' ' -f 2 | sort | uniq | wc -l
422
Second numbers in "%%Page:" lines:
$ grep -i '%%Page: ' all.ps | cut -d ' ' -f 3 | sort | uniq | wc -l
422
The changes coming from cups-filters/the pstops filter mainly only
change the DSC comments, letting the second number in the "%%Page:"
lines going from 1 to 993 instead of being the same as the first number,
starting from 1 again and again. This seems to make the viewers
accepting all pages.
I hope this gives some insight.
On 01/10/2021 13:11, Andre Heider wrote:
Hi Till,
On 01/10/2021 12:32, Till Kamppeter wrote:
Andre, could you attach your PostScript file, once the original and
also the one you get after pre-processing when using "GSCall echo %s
%s %s;
cp %s /tmp"? Thanks.
attached a patch for the original .ps file, see the first post for a link.
But maybe that patch already hints at the problem?
Cheers,
Andre