PaperCut

From DCWiki
Revision as of 12:10, 18 September 2013 by CakDS@hampshire.edu (Talk | contribs) (Normal Script)

Jump to: navigation, search

Installing the Client

Macintosh

Run the installer on smb://balder.hampshire.edu/private/papercut-client/mac/client-local-install

After install, a login window will appear. This is optional. If you do log in though, DO NOT tell PaperCut to remember your credentials.

In order to force the client to load for each user and keep said users (who don't always know what's best for them) from quitting the client, a login hook will need to be established. After installation completes, log into the Admin account and navigate to "Applications" -> "PCClient" ctrl+click on the icon and choose "Show Package Contents." In "Contents" -> "Resources" run the file "install-login-hook.command" follow the prompts in the terminal window.

The config.properties file should have the following options already set:

auth-ttl-default=0
auth-ttl-values=0
minimized=Y
noquit=Y
server-ip=192.33.12.94
server-name=salmoneus
server-port=9191
user=guest

Add a printer with:

  1. System Preferences -> Print and Fax
  2. Click that tiny little plus icon at the bottom of the list of printers
    1. Protocol: Internet Printing Protocol - IPP
    2. Address: papercut.hampshire.edu
    3. Queue: printers/LO_3rd_Floor_BW
    4. Name: papercut.hampshire.edu
    5. Location: <blank>
    6. Print Using: Generic PostScript Printer

Windows

Install client from \\balder.hampshire.edu\private\papercut-client\win\client-local-install.exe

The config.properties file should have the following options already set:

auth-ttl-default=0
auth-ttl-values=0
minimized=Y
noquit=Y
server-ip=192.33.12.94
server-name=salmoneus
server-port=9191
user=guest

Set up a printer by:

  1. Start -> Devices and Printers -> Add a printer
  2. Network Printer -> "The printer I want isn't listed"
  3. Select a shared printer by name -> http://papercut.hampshire.edu:631/printers/LO_3rd_Floor_BW
  4. Driver -> Xerox Workcentre 5325/5330/5335 PS Driver (Download here: http://www.support.xerox.com/support/workcentre-5300-series/downloads/enus.html)

Ubuntu

Make sure you have Java 5.0+ installed.

To connect to Balder:

  • server: balder
  • type: windows share
  • share: private
  • domain name: administration

Copy files at \\balder.hampshire.edu\private\papercut-client\client\linux to /usr/local/papercut/client

Run the following to change permissions of the files:

cd /usr/local/papercut/client
chmod 755 ./pc-client-linux.sh 

To trigger on login:

  • Open Startup Applications.
  • Click 'Add'
  • Navigate to /usr/local/papercut/client
  • Choose 'pc-client-linux.sh'
  • Name it whatever you want (PaperCut client)


The config.properties file should have the following options already set:

auth-ttl-default=0
auth-ttl-values=0
minimized=Y
noquit=Y
server-ip=192.33.12.94
server-name=salmoneus
server-port=9191
user=guest

Set up a printer by:

  1. Open 'Printers'
  2. Click 'Add'
  3. Enter URI: "ipp://papercut.hampshire.edu:631/printers/LO_3rd_Floor_BW"
  4. Choose 'Generic' -> 'PostScript' -> 'PostScript Printer Foomatic/Postscript [en] (recommended)'
    • Airport Lounge driver: ???

Adding a Printer to the PaperCut Server

  1. Add the printer via the CUPS interface
    1. First create a tunnel to the PaperCut server with ssh -NL 8080:127.0.0.1:631 YOURUSERNAME@papercut
    2. Browse to http://localhost:8080/admin
    3. Click Add Printer
      • At this point you will be prompted for your LDAP username and password. A warning may appear that your password will be sent in clear text but remember that it will be sent in the clear to localhost:8080 which is a secure tunnel to papercut:631 so don't worry about it.
    4. Choose AppSocket/HP JetDirect
    5. Enter the path to the printer (e.g. socket://loxx4260-1.hampshire.edu:9100)
    6. Enter the Name, Description and Location of the printer and click Share This Printer
    7. Under Or Provide a PPD File click Choose File and select a PPD
      • xr_generic.ppd can be found on \\Balder\private\Xerox for Xerox WorkCentre printers
    8. Click Query Printer for Default Options
  2. Enable the printer for use with PaperCut
    1. SSH to the PaperCut server
    2. Run sudo /home/papercut/providers/print/linux-x64/configure-cups
      • You will be prompted to set the status of each CUPS printer for use with PaperCut. You want to (L)eave most of them enabled which you can do by just pressing Enter. You want to enable your new printer by typing "e" and enter.
  3. Verify printer addition
    1. Log into https://salmoneus.hampshire.edu:9192/admin with admin / ieRe1che
    2. Select the printer and scroll down to "Advanced Configuration" Check the box for "Unauthenticated printer (enable popup authentication)." Scroll down to the bottom of the page and click "Apply."


Printer URIs

ipp://papercut.hampshire.edu:631/printers/LO_1st_Floor_Left

ipp://papercut.hampshire.edu:631/printers/LO_1st_Floor_Right

ipp://papercut.hampshire.edu:631/printers/LO_3rd_Floor_BW

ipp://papercut.hampshire.edu:631/printers/LO_3rd_Floor_Color

ipp://papercut.hampshire.edu:631/printers/LO_Airport

Scripting

Normal Script

 /*
 cakDS@hampshire.edu
 9/20/12
 This script promts users to convert their print job to Duplex if it would save them money and us paper
 */
 function printJobHook(inputs, actions) {
   if(!inputs.job.isAnalysisComplete) { return; }
   
   //Edit the settings below according to your policy and environment.
   var DISCOURAGE_SIMPLEX_PRINTING = true;
   
   // Show warning only if printing more than X pages.
   var SIMPLEX_WARNING_PAGE_LIMIT = 1;
   
   // Advanced Charging values. Update manually / contact papercut to find these values programmatically
   var BASE_COST = 0.05;
   var DUPLEX_DISCOUNT = 0.04;
   
   var COST_SIMPLEX = inputs.job.totalPages * BASE_COST;
   
   // This is the PaperCut way
   //var COST_DUPLEX = (Math.floor(inputs.job.totalPages / 2) * ((BASE_COST - DUPLEX_DISCOUNT) * 2)) + ((inputs.job.totalPages % 2) * BASE_COST);
   // This is the way that makes sense
   var COST_DUPLEX = (Math.ceil(inputs.job.totalPages / 2) * BASE_COST) + (Math.floor(inputs.job.totalPages / 2) * (BASE_COST - DUPLEX_DISCOUNT));
   
   var COST_SAVINGS = COST_SIMPLEX - COST_DUPLEX;
   var PAGE_SAVINGS = inputs.job.totalPages - Math.ceil(inputs.job.totalPages / 2);
   var PAGE_SAVINGS_TEXT = PAGE_SAVINGS + ' pages';
   if(PAGE_SAVINGS == 1) { PAGE_SAVINGS_TEXT = '1 page'; }
   
   if(inputs.job.isDuplex) {
     actions.log.info("Fixed printing cost of duplexed " + inputs.job.totalPages + "-page document from " + inputs.utils.formatNumber(inputs.job.cost, 2) + " to " + inputs.utils.formatNumber(COST_DUPLEX, 2));
     actions.job.setCost(COST_DUPLEX);
   } else {
     // Discourage users from printing too many pages in simplex.
     if(
       DISCOURAGE_SIMPLEX_PRINTING  
       && inputs.job.totalPages > SIMPLEX_WARNING_PAGE_LIMIT
     ) {
       var htmlForm = "<html>"
           + "     <div style='width:400px; height:210px; padding: 10px; color:#6F6F6F; background: url(http://%PC_SERVER%/scripting/print/recipes/images/treebg.png) no-repeat;'>"
           + "             <div style='padding: 10px; font-weight: bold; font-size: 20px; text-align: center;'>"
           + "                     <img src='http://%PC_SERVER%/images/icons/24x24/warning.png'>"
           + "                      Duplex Printing Alert"
           + "                     <img src='http://%PC_SERVER%/images/icons/24x24/warning.png'>"
           + "             </div>"
           + "             <div style='font-size: 14px; font-weight: bold; text-align: center;'>"
           + "                     Please cancel and use double-sided printing instead!"
           + "             </div>"
           + "             <br><br>"
           + "             <div style='font-size: 12px;'>"
           + "                     Did you know that this job will produce " + inputs.utils.formatNumber(inputs.job.environmentGramsCO2, 0) + "grams of CO<sub>2</sub> equiv.?"
           + "                     This is equivalent to leaving a 60W bulb on for <b>" + inputs.utils.formatNumber(inputs.job.environmentBulbHours, 1) + " hours</b>!"
           + "                     <br><br>"
           + "                     You could halve this impact, saving " + PAGE_SAVINGS_TEXT + " and <b>" + inputs.utils.formatCost(COST_SAVINGS) + "</b> by printing double-sided."
           + "             </div>"
           + "     </div>"
           + "</html>";
       
       var response;
       // Display the message with custom dialog title and description (options).
       response = actions.client.promptPrintCancel(
         htmlForm,
         {
           'dialogTitle': 'Policy Alert',
           'dialogDesc': inputs.job.documentName,
           'hideJobDetails': false
         }
       );
       
       if(response == "CANCEL" || response == "TIMEOUT") {
         actions.job.cancel();
         // don't display any more dialogs
         return;
       }
     }
   }
 }
​

Redirect Script

function printJobHook(inputs, actions) {
 actions.job.redirect("LO_1st_Floor_Left");
 actions.client.sendMessage("The printer " + inputs.job.printerName + " is currently experiencing technical difficulties. Your print job has been printed on LEFT instead.");
}