Bug 1068896

Summary: CUPS pdftops: duplex to duplex-capable Postscript printer prints single-sided
Product: [Fedora] Fedora Reporter: Richard Chan <rc556677>
Component: ghostscriptAssignee: Tim Waugh <twaugh>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 20CC: jpopelka, rc556677, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: ghostscript-9.14-3.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1071267 (view as bug list) Environment:
Last Closed: 2014-06-15 01:53:22 UTC Type: Bug
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
Postscript PPD
none
"Bad" ps file: comes out single sided none

Description Richard Chan 2014-02-23 01:09:08 UTC
Created attachment 866511 [details]
Postscript PPD

Description of problem:

pdftops filter output sets /PageSize at the top of *every* page
description, not just once for the entire job.

This causes some Postscript printers to eject the "A" side
before the "B" side is rendered.
This results in a single-sided job.

Observed on Samsung 2851NLD, Brother MFC-9330CFW

Version-Release number of selected component (if applicable):
1.0.41-4.fc20

How reproducible:
Always if pdftops is invoked.

Steps to Reproduce:
1. Use a native Postscript PPD for Postscript/duplex capable printer e.g.
   Samsung 2851NLD, Brother MFC-9330CFW
2. Print a job to a Postscript printer that invokes pdftops; e.g., evince
   in duplex
3.

Actual results:
All pages come out single-sided.
Duplex=DuplexNoTumble *is* observed at the job header.

%%
[596 842] pdfSetupPaper 
occurs on *every* sheet; this causes the printer to eject the "A" side
before the "B" side is rendered


Expected results:
Duplex printing


Additional info:
Print text-to-ps invokes texttops filter; this sets /PageSize once;
duplex works fine

lp -P "PostscriptPrinter" -o sides=two-sided-long-edge textfile\
## works; texttops does not set /PageSize per page
## only per job

View Windows Postscript driver output; /PageSize is only set once
at the job level; duplex works.

Comment 1 Richard Chan 2014-02-23 01:10:52 UTC
Created attachment 866512 [details]
"Bad" ps file: comes out single sided

Every page starts with

595 842 pdfSetupPaper

Comment 2 Richard Chan 2014-02-23 01:13:37 UTC
If I filter pdfSetupPaper from the start of every page, duplex printing works


*cupsFilter: "application/vnd.cups-postscript 0 pagesize_filter"

/usr/lib/cups/filter/pagesize_filter:

#! /bin/sh
sed -e "s/ pdfSetupPaper/ pop pop/"

This deletes the pdfSetupPaper procedure call at the start of every page and
pops the unused arguments 595 842.

Comment 3 Tim Waugh 2014-02-24 12:04:10 UTC
Try this:

lpadmin -p PostscriptPrinter -o pdftops-renderer=gs

Does duplexing work now?

You can use "lpadmin -p PostscriptPrinter -r pdftops-renderer" to reset it.

Comment 4 Richard Chan 2014-02-25 16:03:22 UTC
No, I switched to the gs renderer and also got page ejection on the "A" side.
The per page setup looks like:

%%BeginPageSetup
%%EndPageSetup
/pagesave save def
11 0 obj
<</Type/Page/MediaBox [0 0 595.28 841.89]
/Parent 3 0 R
/Resources<</ProcSet[/PDF]
/Font 13 0 R
>>
/Contents 12 0 R
>>
endobj
%%EndPageSetup

Filters: 

I [25/Feb/2014:23:59:14 +0800] [Job 86] Started filter /usr/lib/cups/filter/pdftopdf (PID 
I [25/Feb/2014:23:59:14 +0800] [Job 86] Started filter /usr/lib/cups/filter/pdftops (PID 2
I [25/Feb/2014:23:59:14 +0800] [Job 86] Started backend /usr/lib/cups/backend/dnssd (PID 2
D [25/Feb/2014:23:59:14 +0800] [Job 86] Started filter gs (PID 23651)
D [25/Feb/2014:23:59:14 +0800] [Job 86] Started post-processing (PID 23652)
D [25/Feb/2014:23:59:14 +0800] [Job 86] Started filter pstops (PID 23653)

Comment 5 Richard Chan 2014-02-27 05:44:37 UTC
Poppler duplex issue: https://bugs.freedesktop.org/show_bug.cgi?id=72312


GS duplex issue: http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=5ddd13eda3853d53315b7ba656ccd32ad9814c34

I think my version of ghostscript does not have the duplex fix

$ rpm -qi  ghostscript
Name        : ghostscript
Version     : 9.10
Release     : 5.fc20

Comment 6 Tim Waugh 2014-02-27 16:46:18 UTC
Changing component to ghostscript for the ghostscript part of this.

Could you please try ghostscript-9.10-6.fc20 when it has finished building?:
  http://koji.fedoraproject.org/koji/taskinfo?taskID=6577258

Comment 7 Richard Chan 2014-02-27 21:21:43 UTC
Thank you! I can confirm that ghostscript-9.10-6.fc20 fixes duplex printing on 
Brother MFC-9330CDW using native Brother PostScript (BR-Script3) and the 
Brother PPD file.


lp -d Brother-MFC-9330CDW -o "sides=two-sided-long-edge pdftops-renderer=gs" -P 1-2 testfile.pdf



[Job 96] Started filter /usr/lib/cups/filter/pdftopdf (PID 12852)
[Job 96] Started filter /usr/lib/cups/filter/pdftops (PID 12853)
[Job 96] Started backend /usr/lib/cups/backend/dnssd (PID 12855)
[Job 96] Started filter gs (PID 12860)
[Job 96] Started post-processing (PID 12861)
[Job 96] Started filter pstops (PID 12862)


*PPD-Adobe: "4.3"
*%================================================
*%      Copyright(C) 2012 Brother Industries, Ltd.
*%      "Brother MFC-9330CDW BR-Script3"
*%================================================

*%==== General Information Keywords ========================
*FormatVersion: "4.3"
*FileVersion: "1.0"
*LanguageEncoding: ISOLatin1
*LanguageVersion: English
*Manufacturer: "Brother"
*PCFileName: "BRP9330E.PPD"
*Product: "(Brother MFC-9330CDW)"
*PSVersion: "(3010.106) 3"
*ShortNickName: "Brother MFC-9330CDW BR-Script3"
*ModelName: "Brother MFC-9330CDW BR-Script3"
*NickName: "Brother MFC-9330CDW BR-Script3"

Comment 8 Tim Waugh 2014-02-28 12:11:43 UTC
Thanks. I've filed bug #1071267 to track the remaining poppler issue.

Comment 9 Fedora Update System 2014-06-05 10:53:49 UTC
ghostscript-9.14-3.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/ghostscript-9.14-3.fc20

Comment 10 Fedora Update System 2014-06-05 14:23:39 UTC
ghostscript-9.14-3.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/ghostscript-9.14-3.fc19

Comment 11 Fedora Update System 2014-06-10 02:57:07 UTC
Package ghostscript-9.14-3.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing ghostscript-9.14-3.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-7139/ghostscript-9.14-3.fc20
then log in and leave karma (feedback).

Comment 12 Fedora Update System 2014-06-15 01:53:22 UTC
ghostscript-9.14-3.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2014-06-17 23:28:05 UTC
ghostscript-9.14-3.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.