PaperCut

From DCWiki
Jump to: navigation, search

Installing the Client

Macintosh

Run the installer on smb://patterson.hampshire.edu/it/UserSupport/Papercut/PaperCut 17.0.6 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.

To set the client to load for all users:

1. Log in to the test Mac as user with Administrator access.

2. Download our basic launchd plist here: https://www.papercut.com/kb/uploads/Main/PaperCut_LaunchD.zip This plist assumes that PCClient.app is stored in /Applications/, if this is not the case please skip to Advanced Configuration Options below.

3. Copy the enclosed com.papercut.client.plist to /Library/LaunchAgents/

4. Next we’ll be opening Terminal.app to verify the permissions are correct on the plist to ensure launchctl will be able to operate the plist. If you are unaccustomed to using Terminal you can copy and paste the following commands in.

     cd /Library/LaunchAgents/
     sudo chown root:wheel com.papercut.client.plist
     sudo chmod 644 com.papercut.client.plist

5. Next we’ll verify that the permissions for the file are correct:

     ls -lah com.papercut.client.plist
  The output should look like:
     -rw-r--r--@ 1 root wheel 458B Jul 29 2014 com.papercut.client.plist

If you prefer to have the client load only for the student user, do the same thing from the Student account, but place it in Users/student/Library/LaunchAgents

For reference, the com.papercut.client.plist file is listed below: <?xml version="1.0" encoding="UTF-8"?>

 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
     <key>Label</key>
     <string>com.papercut.client.agent</string>
     <key>ProgramArguments</key>
     <array>
         <string>/Applications/PCClient.app/Contents/MacOS/JavaAppLauncher</string>
     </array>
     <key>KeepAlive</key>
     <true/>
 </dict>
 </plist>

You can copy over the config.properties file from smb://patterson.hampshire.edu/it/UserSupport/Papercut/PaperCut 17.0.6 Client/config.properties

Or alternatively, the config.properties file should have the following options already set (with one adjustment you'll need to make, below):

minimized=Y
noquit=Y
server-ip=192.33.12.94
server-name=salmoneus
server-port=9191
user=guest

You will want to change the user=guest line as follows:

user=papercutSRVC

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. Address: papercut.hampshire.edu
    2. Protocol: Internet Printing Protocol - IPP
    3. Queue: printers/LO_*
    4. Name: papercut.hampshire.edu
    5. Location: <blank>
    6. Print Using: Select Software...
      1. Ricoh MP c2500 PS for 3rd floor and APL, Ricoh MP 6500 PS for left and right

Windows

Install client from \\patterson.hampshire.edu\it\UserSupport\Papercut\PaperCut 17.0.6 Client\win\client-local-install.exe

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

minimized=Y
noquit=Y
server-ip=192.33.12.94
server-name=salmoneus
server-port=9191

Add the following line:

user=papercutSRVC

Or, alternatively, just copy over config.properties from: \\patterson.hampshire.edu\it\UserSupport\Papercut\PaperCut 17.0.6 Client\config.properties

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_*
  4. Driver -> Ricoh MP c2500 PS for 3rd floor and APL, Ricoh MP 6500 PS for left and right

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
      • A PPD can be found on \\patterson\it\papercut client 14.x\Xerox xxx PPDs\xxx.ppd 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 your own username or 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."
    3. Add the default printing script to the printer (just copy it from another printer like LO_1st_Floor_Left)

Printer URIs

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

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

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_HU

Scripting

New Normal Script with Duplex and Color discouraged

/*
cakDS@hampshire.edu and glIT@hampshire.edu and regIT@hampshire.edu
2/2/17
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; }
  
  var isDuplex = false;
  //Edit the settings below according to your policy and environment.
  var DISCOURAGE_SIMPLEX_PRINTING = true;
  var DISCOURAGE_COLOR_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.50;
  var DUPLEX_DISCOUNT = 0.03;
  var GRAYSCALE_DISCOUNT = 0.45;
  
  var COST_COLOR_SIMPLEX = BASE_COST * inputs.job.totalPages;
  var COST_BW_SIMPLEX = (BASE_COST - GRAYSCALE_DISCOUNT) * inputs.job.totalPages;
  var COST_COLOR_DUPLEX = (Math.ceil(inputs.job.totalPages / 2) * BASE_COST) + (Math.floor(inputs.job.totalPages / 2) * (BASE_COST - DUPLEX_DISCOUNT));
  var COST_BW_DUPLEX = (Math.ceil(inputs.job.totalPages / 2) * (BASE_COST - GRAYSCALE_DISCOUNT)) + (Math.floor(inputs.job.totalPages / 2) * ((BASE_COST - GRAYSCALE_DISCOUNT) - DUPLEX_DISCOUNT));
  
  
  var BW_CONVERSION_SAVINGS_SIMPLEX = COST_COLOR_SIMPLEX - COST_BW_SIMPLEX;
  var BW_CONVERSION_SAVINGS_DUPLEX = COST_COLOR_DUPLEX - COST_BW_DUPLEX;
  
  // Test for grayscale printing
  if(!inputs.job.isColor)
  {
    BASE_COST = BASE_COST - GRAYSCALE_DISCOUNT;
    
  }
  
  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) {
    isDuplex = true;
    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 htmlFormDuplex = "<html>"
          + "     <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js\"></script>"
          + "     <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: 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>"
          + "             <br/><br/>"
          + "             <div style='font-size: 14px; font-weight: bold; text-align: center;'>"
          + "                     Do you want to print double-sided?"
          + "             </div>"
          + "     </div>"
          + "</html>";
      
      var responseDuplex;
      // Display the message with custom dialog title and description (options).
      responseDuplex = actions.client.promptYesNo(htmlFormDuplex);
      
      if (responseDuplex == 'YES') {
        actions.log.debug('User chose to convert their job to duplex.');
        actions.job.setCost(COST_DUPLEX);
        actions.job.convertToDuplex();
        isDuplex = true;
      } else if (responseDuplex == 'NO') {
        actions.log.debug('User chose not to convert their job to duplex.');
      }
    } else {
      actions.log
        .debug("Didn't offer to convert job to duplex as user is not " +
               'running the client software.');
      // don't display any more dialogs
      return;
    }
  }
  
  if (inputs.job.isColor)
  {
    // tantalize the user with how much cheaper it would be to print in BW
    var currentCost;
    var costBW;
    var costSavings;
    
    if (isDuplex) {
      currentCost = COST_COLOR_DUPLEX;
      costBW = COST_BW_DUPLEX;
      costSavings = BW_CONVERSION_SAVINGS_DUPLEX;
    }
    else {
      currentCost = COST_COLOR_SIMPLEX;
      costBW = COST_BW_SIMPLEX;
      costSavings = BW_CONVERSION_SAVINGS_SIMPLEX;
    }
    
    if(DISCOURAGE_COLOR_PRINTING) {
      var htmlFormColor = "<html>"
          + "     <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js\"></script>"
          + "     <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'> "
          + "                     Color Printing Alert"
          + "                     <img src='http://%PC_SERVER%/images/icons/24x24/warning.png'>"
          + "             </div>"
          + "             <div style='font-size: 12px;'>"
          + "                     Did you know that this job will cost " + inputs.utils.formatCost(currentCost) + " because you are printing in color?"
          + "                     If you convert this job to grayscale, it will only cost " + inputs.utils.formatCost(costBW) + "!"
          + "                     <br><br>"
          + "                     That means you'd save <b>" + inputs.utils.formatCost(costSavings) + "</b> by printing in grayscale."
          + "             </div>"
          + "             <br/><br/>"
          + "             <div style='font-size: 14px; font-weight: bold; text-align: center;'>"
          + "                     Do you want to print in grayscale?"
          + "             </div>"
          + "     </div>"
          + "</html>";
      
      var responseColor;
      // Display the message with custom dialog title and description (options).
      responseColor = actions.client.promptYesNo(htmlFormColor);
      
      if (responseColor == 'YES') {
        actions.log.debug('User chose to convert their job to grayscale.');
        actions.job.setCost(costBW);
        actions.job.convertToGrayscale();
      } else if (responseColor == 'NO') {
        actions.log.debug('User chose not to convert their job to grayscale.');
      }
    } else {
      actions.log
        .debug("Didn't offer to convert job to grayscale as user is not " +
               'running the client software.');
      // don't display any more dialogs
      return;
    }
  }
}

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) {
 // Change this:
 var newPrinter = "LO_1st_Floor_Left";


 if (!inputs.job.isAnalysisComplete) { return; }
 actions.job.redirect(newPrinter);
 actions.client.sendMessage("The printer " + inputs.job.printerName + " is currently experiencing technical difficulties. Your print job has been printed on " + newPrinter + " instead.");
}​​

Service Account

eijii9Nei