This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours

Bug 244979

Summary: add page-ranges and accounting to textonly filter
Product: [Fedora] Fedora Reporter: Opher Shachar <ophers>
Component: cupsAssignee: Tim Waugh <twaugh>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 6Keywords: Reopened
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 1.2.12-1.fc8 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-07-16 07:45:35 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 235704    
Attachments:
Description Flags
CUPS textonly filter with page-ranges and accounting
none
CUPS textonly filter with page-ranges and accounting none

Description Opher Shachar 2007-06-20 07:55:26 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; MathPlayer 2.0; .NET CLR 2.0.50727; .NET CLR 1.1.4322; FDM; .NET CLR 3.0.04506.30)

Description of problem:
I hope this is the place to submit feature request/improvments... if not then my apologies.
Currently the textonly filters only handles number of copies.
I've attached a modified version that handles page-ranges option and does page accounting based on FF in the input file.

Version-Release number of selected component (if applicable):


How reproducible:
Always


Steps to Reproduce:
New feature request.

Actual Results:


Expected Results:


Additional info:
Comment 1 Opher Shachar 2007-06-20 07:57:36 EDT
Created attachment 157451 [details]
CUPS textonly filter with page-ranges and accounting
Comment 2 Opher Shachar 2007-06-26 18:11:36 EDT
Hi Tim,
First as to the appending of the FF to the last printed page, I concur with 
you. My original rational was that without this the first page of copy#2 would 
follow the last page of copy#1.

Next, when 'unset PR' is used page accounting seems to go wrong. The man page 
for CUPS filter has this to say: (output to stderr)

PAGE: page-number #-copies 
PAGE: #-pages total 
Adds an entry to the current PageLog. The first form adds #-copies to the job-
media-sheets-completed attribute. The second form sets the job-media-sheets-
completed attribute to #-pages. 

...but when I was testing the _second form_ did not do as expected. So hence 
PR=1-999999. For my needs accurate page accounting was indispensable.

Please feel free to modify the script as you see fit.

Regards,
Opher Shachar.
Comment 3 Opher Shachar 2007-06-26 19:06:13 EDT
Hello again.
Tim, you managed to confuse me :)
This code: 

    if (( pagenum == pl )); then
      echo -n "${REPLY}" >>"$TMPFILE2"
      # If EOF then page has no final FF
      [[ ! "$EOF" ]] && echo -ne '\f' >>"$TMPFILE2"
      echo "PAGE: $pagenum $COPIES" >&2
    fi

does *not* insert unwarranted FF. The 'read' command strips the delimiter (FF) 
form $REPLY so this code outputs it back just if it was present in the first 
place. If we have not reached EOF then we _must_ have encountered FF witch got 
stripped...

Regards,
Opher Shachar.
Comment 4 Tim Waugh 2007-06-27 04:45:52 EDT
(In reply to comment #3)
> The 'read' command strips the delimiter (FF) 
> form $REPLY so this code outputs it back just if it was present in the first 
> place.

Ah, now I understand!  Thanks for clarifying this.
Comment 5 Opher Shachar 2007-07-08 09:01:00 EDT
Good news!
Outputting Total page count does work - it was a documentation error (see STR 
#2427).
Also modified the loop to be more eficiet by setting the FF variable:

    FF=$(echo -ne '\f')

So I've updated my script and uploading it.

Opher Shachar.
Comment 6 Opher Shachar 2007-07-08 09:09:02 EDT
Created attachment 158730 [details]
CUPS textonly filter with page-ranges and accounting
Comment 7 Tim Waugh 2007-07-09 10:32:14 EDT
Thanks.  Fixed in CVS.