Bug 424951

Summary: Cannot produce number-up prints from paps output
Product: [Fedora] Fedora Reporter: Tim Waugh <twaugh>
Component: papsAssignee: Akira TAGOH <tagoh>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 8   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-06-25 03:00:52 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
self-modified PostScript file none

Description Tim Waugh 2007-12-14 13:42:28 UTC
Description of problem:
paps does not produce DSC-compliant PostScript and so printing e.g. 4-up pages
from paps output does not work.

Version-Release number of selected component (if applicable):
paps-0.6.8-1.fc8

How reproducible:
100%

Steps to Reproduce:
1.echo -e '\n\n1\n\014\n\n2\n\014\n\n3\n\014\n\n4\n' >4.txt
2.lp -onumber-up=4 4.txt
  
Actual results:
The foomatic filter for the print job stops due to a ghostscript error.

Expected results:
Single sheet of paper with four numbers written on the front.

Additional info:
Running 'cupstestdsc' on the paps filter output shows that it is not DSC
compliant.  Note that cupstestdsc can only point out errors; it does not
guarantee compliance.

But the first two problems are:

1. there are two %%BeginProlog sections.
2. the setpagesize call needs to be moved to a new Begin/EndSetup section after
the prolog.

Even with these things corrected, gs is still not happy with the output after
pstops tries to number-up the pages onto a single sheet.

Here is how to run the filters individually:

/usr/lib/cups/filter/texttopaps 1 me '' 1 'number-up=4' 4.txt >paps.ps
/usr/lib/cups/filter/pstops 1 me '' 1 'number-up=4' paps.ps >ps.ps
gs ps.ps

I get:

GPL Ghostscript 8.61 (2007-11-21)
Copyright (C) 2007 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Loading NimbusSanL-Regu font from /usr/share/fonts/default/Type1/n019003l.pfb...
3340872 1769483 2264160 971586 2 done.
Error: /undefined in last_x
Operand stack:
   last_x   -7414
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--  
--nostringval--   2   %stopped_push   --nostringval--   --nostringval--  
--nostringval--   false   1   %stopped_push   1905   1   3   %oparray_pop   1904
  1   3   %oparray_pop   1888   1   3   %oparray_pop   1771   1   3  
%oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--  
--nostringval--   --nostringval--   2   %stopped_push   --nostringval--  
--nostringval--   --nostringval--   %loop_continue   --nostringval--  
--nostringval--
Dictionary stack:
   --dict:1143/1684(ro)(G)--   --dict:0/20(G)--   --dict:81/200(L)--  
--dict:27/42(L)--   --dict:5/11(L)--   --dict:13/21(L)--   --dict:4/11(L)--
Current allocation mode is local
Current file position is 7539
GPL Ghostscript 8.61: Unrecoverable error, exit code 1

I originally reported this as a CUPS bug, thinking that pstops was behaving
incorrect:
  http://www.cups.org/str.php?L2626

Comment 1 Akira TAGOH 2007-12-28 02:02:28 UTC
Created attachment 290466 [details]
self-modified PostScript file

This is a self-modified PostScript according to CUPS guys and your suggestion
that was generated through paps. however I'm still getting an error on gs
because pstops	restores objects after showpage. this breaks off all the
changes happened in the local virtual memory during drawing the previous page.
which paps relies on for next page.

Comment 2 Tim Waugh 2008-01-10 11:53:11 UTC
Then paps is not producing a DSC-compliant document.  It needs to put that sort
of thing in %PageSetup, surely?

Comment 3 Akira TAGOH 2008-01-10 14:46:33 UTC
Ok. should be fixed in 0.6.8-2.fc9.

Comment 4 Tim Waugh 2008-01-10 15:17:08 UTC
Brilliant, that works!

One final change: the final '%%Pages:' line should appear after the '%%Trailer'
line, not before.  After that change, 'cupstestdsc' now reports PASS for the output.

Comment 5 Akira TAGOH 2008-01-15 03:51:48 UTC
Fixed in 0.6.8-3.fc9.