tojocky / node-printer

Native node.js printer
1.54k stars 444 forks source link

CUPS #158

Closed rootedsoftware closed 7 years ago

rootedsoftware commented 7 years ago

Is there a way to see a list of commands I can use on a specific printer using CUPS?

When I run node getPrinterDriverOptions.js I get a huge list (included below) of options, but no matter what I set they don't see to make any effect on the printing. I'm trying to only print from the MultiPurpose (SideDeck) and also only one-sided.

Any help or direction is much appreciated.

Here is one way I've set the options

options: {
        CNSrcOption: {
          InputSlot: { SideDeck: true }
        }
      },

Here is the output of node getPrinterDriverOptions.js

1ppd for printer "Canon":{ CNSrcOption: { None: true, OptCas2: false },
  CNSidePaperDeck: { None: true, Small: false },
  CNFinisher: 
   { None: true,
     IN2TRAYF1: false,
     IFINE1: false,
     STFINJ1: false,
     BFINJ1: false },
  CNCopyTray: { None: true, CPTU1: false },
  CNFinTray: { None: true, FNTU1: false },
  CNPuncher: 
   { None: true,
     PUNU2: false,
     PUNU23: false,
     PUNF24: false,
     PUNS4: false },
  CNUseCSModeJobAccount: { mode1: true, mode2: false },
  CNUseCSModeSecured: { mode1: true, mode2: false },
  CNUseJobAccount: { False: true, True: false },
  CNEnableTrustPrint: { False: true, True: false },
  CNEnableCMSSettings: { False: true, True: false },
  CNInSlotManMediaType: 
   { PlainPaper1: true,
     PlainPaper2: false,
     RECYCLED: false,
     COLOR: false,
     PREPANCHED: false,
     LHEAD: false,
     BOND: false,
     HEAVY1: false,
     HEAVY2: false,
     HEAVY3: false,
     OHP: false,
     LABELS: false,
     TRACING: false,
     THIN: false,
     POSTCARD: false,
     ENVELOPE: false,
     TAB: false,
     '1SIDEDCOATED1': false,
     '1SIDEDCOATED2': false,
     '2SIDEDCOATED1': false,
     '2SIDEDCOATED2': false,
     JAPANESE: false },
  CNInSlotAMediaType: 
   { PlainPaper1: true,
     PlainPaper2: false,
     RECYCLED: false,
     COLOR: false,
     PREPANCHED: false,
     LHEAD: false,
     BOND: false,
     HEAVY1: false,
     HEAVY2: false,
     OHP: false,
     THIN: false },
  CNInSlotBMediaType: 
   { PlainPaper1: true,
     PlainPaper2: false,
     RECYCLED: false,
     COLOR: false,
     PREPANCHED: false,
     LHEAD: false,
     BOND: false,
     HEAVY1: false,
     HEAVY2: false,
     OHP: false,
     THIN: false,
     ENVELOPE: false,
     TAB: false },
  CNInSlotCMediaType: 
   { PlainPaper1: true,
     PlainPaper2: false,
     RECYCLED: false,
     COLOR: false,
     PREPANCHED: false,
     LHEAD: false,
     BOND: false,
     HEAVY1: false,
     HEAVY2: false,
     OHP: false,
     THIN: false },
  CNInSlotDMediaType: 
   { PlainPaper1: true,
     PlainPaper2: false,
     RECYCLED: false,
     COLOR: false,
     PREPANCHED: false,
     LHEAD: false,
     BOND: false,
     HEAVY1: false,
     HEAVY2: false,
     OHP: false,
     THIN: false },
  CNSideDeckMediaType: 
   { PlainPaper1: true,
     PlainPaper2: false,
     RECYCLED: false,
     COLOR: false,
     PREPANCHED: false,
     LHEAD: false,
     BOND: false,
     HEAVY1: false,
     THIN: false },
  PageSize: 
   { Letter: true,
     Letter_MAX: false,
     '11x17': false,
     '11x17_MAX': false,
     Ledger: false,
     Ledger_MAX: false,
     Legal: false,
     Legal_MAX: false,
     Statement: false,
     Statement_MAX: false,
     Executive: false,
     Executive_MAX: false,
     A5: false,
     A5_MAX: false,
     B5: false,
     B5_MAX: false,
     A4: false,
     A4_MAX: false,
     B4: false,
     B4_MAX: false,
     A3: false,
     A3_MAX: false,
     Postcard: false,
     Postcard_MAX: false,
     dbl_postcard: false,
     dbl_postcard_MAX: false,
     '4x_postcard': false,
     '4x_postcard_MAX': false,
     jenv_you3: false,
     jenv_you3_MAX: false,
     jenv_kaku2: false,
     jenv_kaku2_MAX: false,
     jenv_chou3: false,
     jenv_chou3_MAX: false,
     Monarch: false,
     Monarch_MAX: false,
     Com10: false,
     Com10_MAX: false,
     dl_envelope: false,
     dl_envelope_MAX: false,
     Envelope_C5: false,
     Envelope_C5_MAX: false,
     SRA3: false,
     SRA3_MAX: false,
     '12x18': false,
     '12x18_MAX': false,
     'A4+': false,
     'A4+MAX': false,
     'Letter+': false,
     'Letter+MAX': false,
     Oficio: false,
     Oficio_MAX: false,
     A_Oficio: false,
     A_Oficio_MAX: false,
     B_Oficio: false,
     B_Oficio_MAX: false,
     E_Oficio: false,
     E_Oficio_MAX: false,
     M_Oficio: false,
     M_Oficio_MAX: false,
     A_Letter: false,
     A_Letter_MAX: false,
     G_Letter: false,
     G_Letter_MAX: false,
     G_Legal: false,
     G_Legal_MAX: false,
     F4A: false,
     F4A_MAX: false,
     K8: false,
     K8_MAX: false,
     K16: false,
     K16_MAX: false,
     Foolscap: false,
     Foolscap_MAX: false,
     A_Foolscap: false,
     A_Foolscap_MAX: false,
     Custom: false },
  PageRegion: 
   { Letter: false,
     Letter_MAX: false,
     '11x17': false,
     '11x17_MAX': false,
     Ledger: false,
     Ledger_MAX: false,
     Legal: false,
     Legal_MAX: false,
     Statement: false,
     Statement_MAX: false,
     Executive: false,
     Executive_MAX: false,
     A5: false,
     A5_MAX: false,
     B5: false,
     B5_MAX: false,
     A4: false,
     A4_MAX: false,
     B4: false,
     B4_MAX: false,
     A3: false,
     A3_MAX: false,
     Postcard: false,
     Postcard_MAX: false,
     dbl_postcard: false,
     dbl_postcard_MAX: false,
     '4x_postcard': false,
     '4x_postcard_MAX': false,
     jenv_you3: false,
     jenv_you3_MAX: false,
     jenv_kaku2: false,
     jenv_kaku2_MAX: false,
     jenv_chou3: false,
     jenv_chou3_MAX: false,
     Monarch: false,
     Monarch_MAX: false,
     Com10: false,
     Com10_MAX: false,
     dl_envelope: false,
     dl_envelope_MAX: false,
     Envelope_C5: false,
     Envelope_C5_MAX: false,
     SRA3: false,
     SRA3_MAX: false,
     '12x18': false,
     '12x18_MAX': false,
     'A4+': false,
     'A4+MAX': false,
     'Letter+': false,
     'Letter+MAX': false,
     Oficio: false,
     Oficio_MAX: false,
     A_Oficio: false,
     A_Oficio_MAX: false,
     B_Oficio: false,
     B_Oficio_MAX: false,
     E_Oficio: false,
     E_Oficio_MAX: false,
     M_Oficio: false,
     M_Oficio_MAX: false,
     A_Letter: false,
     A_Letter_MAX: false,
     G_Letter: false,
     G_Letter_MAX: false,
     G_Legal: false,
     G_Legal_MAX: false,
     F4A: false,
     F4A_MAX: false,
     K8: false,
     K8_MAX: false,
     K16: false,
     K16_MAX: false,
     Foolscap: false,
     Foolscap_MAX: false,
     A_Foolscap: false,
     A_Foolscap_MAX: false,
     Custom: false },
  Collate: { True: true, False: false },
  CNDuplex: { None: false, DuplexFront: true, Booklet: false },
  Booklet: { Left: true, Right: false },
  CNVfolding: { False: true, True: false },
  CNSaddleStitch: { False: true, True: false },
  BindEdge: { Left: true, Right: false, Top: false, Bottom: false },
  CNStaple: { False: true, True: false },
  StapleLocation: 
   { TopLeft: true,
     BottomLeft: false,
     Left: false,
     TopRight: false,
     BottomRight: false,
     Right: false,
     Top: false,
     Bottom: false },
  OutputBin: { Auto: true, TrayA: false, TrayB: false, TrayC: false },
  CNMultiPunch: 
   { Off: true,
     PUNU2: false,
     PUNU23: false,
     PUNF2: false,
     PUNF4: false,
     PUNS4: false },
  CNOutputPartition: { None: false, offset: true, rotation: false },
  CNRotatePrint: { False: true, True: false },
  CNTrustPrint: { False: true, True: false },
  CNCopySetNumbering: { False: true, True: false },
  CNGradationSmoothing: { Off: true, Smooth1: false, Smooth2: false },
  CNSpecialFineLineProcess: { True: false, False: true },
  CNShiftStartPrintPosition: { False: true, True: false },
  CNCreep: { False: true, True: false },
  CNDisplacementCorrection: { Device: true, Auto: false, Manual: false },
  CNSelectBy: { PaperSource: true, PaperType: false },
  InputSlot: 
   { Auto: true,
     Manual: false,
     Cas1: false,
     Cas2: false,
     Cas3: false,
     Cas4: false,
     SideDeck: false },
  MediaType: 
   { PlainPaper1: true,
     PlainPaper2: false,
     RECYCLED: false,
     COLOR: false,
     PREPANCHED: false,
     LHEAD: false,
     BOND: false,
     HEAVY1: false,
     HEAVY2: false,
     HEAVY3: false,
     OHP: false,
     LABELS: false,
     TRACING: false,
     THIN: false,
     POSTCARD: false,
     ENVELOPE: false,
     TAB: false,
     '1SIDEDCOATED1': false,
     '1SIDEDCOATED2': false,
     '2SIDEDCOATED1': false,
     '2SIDEDCOATED2': false,
     JAPANESE: false },
  CNOHPPrint: { False: true, True: false },
  CNInterleafSheet: { False: true, True: false },
  CNInterleafInputSlot: 
   { Auto: true,
     Manual: false,
     Cas1: false,
     Cas2: false,
     Cas3: false,
     Cas4: false,
     SideDeck: false },
  CNInterleafMediaType: 
   { PlainPaper1: true,
     PlainPaper2: false,
     RECYCLED: false,
     COLOR: false,
     PREPANCHED: false,
     LHEAD: false,
     BOND: false,
     HEAVY1: false,
     HEAVY2: false,
     THIN: false,
     '1SIDEDCOATED2': false,
     '2SIDEDCOATED2': false },
  CNInterleafPrint: { False: true, True: false },
  CNInsertSheet: { False: true, True: false },
  CNTabPrintMode: { Shift: true, NoShift: false },
  CNSheetForInsertion: { Insert: true, Chapter: false, TAB1: false },
  CNInsertPrintSide: 
   { None: true,
     OnlyFrontSide: false,
     OnlyBackSide: false,
     BothSides: false },
  CNInsertInputSlot: 
   { Manual: false,
     Cas1: true,
     Cas2: false,
     Cas3: false,
     Cas4: false,
     SideDeck: false },
  CNSetFrontSheet: { False: true, True: false },
  CNFrontPrintOn: 
   { Off: true,
     OnlyFrontSide: false,
     OnlyBackSide: false,
     BothSides: false },
  CNFrontPaperSrc: 
   { Manual: false,
     Cas1: true,
     Cas2: false,
     Cas3: false,
     Cas4: false,
     SideDeck: false },
  CNSetBackSheet: { False: true, True: false },
  CNBackPrintOn: 
   { Off: true,
     OnlyFrontSide: false,
     OnlyBackSide: false,
     BothSides: false },
  CNBackPaperSrc: 
   { Manual: false,
     Cas1: true,
     Cas2: false,
     Cas3: false,
     Cas4: false,
     SideDeck: false },
  Resolution: { '600': true, '1200': false },
  CNColorSyncICC: { DefaultFile: true },
  CNColorMode: { mono: false, color: true },
  CNGraphicsMode: { VectorMode: true, ImageMode: false },
  CNHalftone: 
   { resolution: false,
     gradation: false,
     errdiffusion: false,
     pattern1: false,
     pattern2: false,
     pattern3: false,
     pattern4: false,
     pattern5: false,
     pattern6: true,
     pattern7: false,
     Off: false },
  CNColorHalftone: 
   { resolution: false,
     gradation: false,
     errdiffusion: false,
     pattern1: false,
     pattern2: false,
     pattern3: false,
     pattern4: false,
     pattern5: false,
     pattern6: true,
     pattern7: false,
     Off: false },
  CNTonerSaving: { Auto: false, True: false, False: true },
  CNAdvancedSmoothing: { None: true, Smooth1: false, Smooth2: false, Off: false },
  CNLineControl: { None: true, Resolution: false, Gradation: false },
  CNUseSharpness: { False: true, True: false },
  CNSharpness: 
   { '1': false,
     '2': false,
     '3': false,
     '4': true,
     '5': false,
     '6': false,
     '7': false },
  CNTonerDensityAdjustment: { None: true, True: false },
  CNImageCompression: { None: true, Image: false, Normal: false, Speed: false },
  CNDensityFineAdjustment: { False: true, True: false },
  CNDensityFineAdjustmentNum: { '1': false, '2': false, '3': true, '4': false, '5': false },
  CNTonerDensity: 
   { '1': false,
     '2': false,
     '3': false,
     '4': false,
     '5': false,
     '6': false,
     '7': false,
     '8': false,
     '9': true,
     '10': false,
     '11': false,
     '12': false,
     '13': false,
     '14': false,
     '15': false,
     '16': false,
     '17': false },
  CNCTonerDensity: 
   { '1': false,
     '2': false,
     '3': false,
     '4': false,
     '5': false,
     '6': false,
     '7': false,
     '8': false,
     '9': true,
     '10': false,
     '11': false,
     '12': false,
     '13': false,
     '14': false,
     '15': false,
     '16': false,
     '17': false },
  CNMTonerDensity: 
   { '1': false,
     '2': false,
     '3': false,
     '4': false,
     '5': false,
     '6': false,
     '7': false,
     '8': false,
     '9': true,
     '10': false,
     '11': false,
     '12': false,
     '13': false,
     '14': false,
     '15': false,
     '16': false,
     '17': false },
  CNYTonerDensity: 
   { '1': false,
     '2': false,
     '3': false,
     '4': false,
     '5': false,
     '6': false,
     '7': false,
     '8': false,
     '9': true,
     '10': false,
     '11': false,
     '12': false,
     '13': false,
     '14': false,
     '15': false,
     '16': false,
     '17': false },
  CNTypeWing: { True: true },
  CNKeepGray: { None: false, Standard: true, Never: false },
  CNTrapping: { None: true, False: false, True: false },
  CNTrapWidth: { '1': true, '2': false, '3': false },
  CNTrapDensity: { '25': false, '50': false, '75': false, '100': true },
  CNNumberOfColors: { FullColor: true, TwoColors: false },
  CNColorToUseWithBlack: 
   { Red: true,
     Green: false,
     Blue: false,
     Yellow: false,
     Magenta: false,
     Cyan: false },
  CNXColorAdjustment: 
   { '1': false,
     '2': false,
     '3': false,
     '4': false,
     '5': false,
     '6': true,
     '7': false,
     '8': false,
     '9': false,
     '10': false,
     '11': false },
  CNYColorAdjustment: 
   { '1': false,
     '2': false,
     '3': false,
     '4': false,
     '5': false,
     '6': true,
     '7': false,
     '8': false,
     '9': false,
     '10': false,
     '11': false },
  CNBrightness: 
   { '1': false,
     '2': false,
     '3': false,
     '4': false,
     '5': false,
     '6': true,
     '7': false,
     '8': false,
     '9': false,
     '10': false,
     '11': false },
  CNContrast: 
   { '1': false,
     '2': false,
     '3': false,
     '4': false,
     '5': false,
     '6': true,
     '7': false,
     '8': false,
     '9': false,
     '10': false,
     '11': false },
  CNMatchingMode: { None: false, Driver: false, Embedded: true, Gamma: false },
  CNMatchingMethod: 
   { Monitor: false,
     Photographic: true,
     Colorimetric: false,
     Saturation: false,
     Vividphoto: false },
  CNMonitorProfile: 
   { 'HDTVgamma1.5': false,
     'HDTVgamma1.8': false,
     'HDTVgamma2.1': false,
     'HDTVgamma2.4': false,
     'sRGBv1.20(Canon)': false,
     'sRGBv3.0(Canon)': true },
  CNGamma: { '1.0': false, '1.4': true, '1.8': false, '2.2': false },
  CNJobExecMode: { print: true, secured: false, store: false, promote: false },
  CNPdeUseJobAccount: { True: true, False: false },
  CNAuthenticate: { True: true, False: false },
  CNOverlay: { NoUseOverlay: true, UseOverlay: false, CreatFormFile: false },
  CNOverlayFormComposition: { AllPage: true, FrontSide: false, BackSide: false } }
        selected page size:Letter
porst17 commented 7 years ago

I think it should be options: { InputSlot: "SideDeck" }, at least I could get duplex to work on my printer via options: { Duplex: "DuplexTumble" }.

I couldn't find any documentation about this. The only thing I found was https://github.com/tojocky/node-printer/blob/master/examples/cancelJob.js where options is specified. media and fit-to-page are basically lp options. They either have a value

lp -o media=a4 ... -> options: { media: "A4" }

or are just enabled or disabled

lp -o fit-to-page ... -> option: { fit-to-page: true }

I am still guessing, basically. It would be good to have this clarified and properly documented by @tojocky.

rootedsoftware commented 7 years ago

I ended up using a different tray with special paper. This Canon would always ask me to confirm the setting on the printer every time I tried to print to the SideDeck, but wouldn't if I used a different tray.

Also, it didn't seem to care if I selected CNSelectBy and used the option PaperSource when I used the SideDeck, but it did work for the other trays...

This is what I ended up using. Now when I put the pre-printed paper into a tray I go into the printer panel and tell it that this is "Recycled" paper. Seems kinda hackey, but it works just fine.

      options: {
        CNSelectBy: "PaperType",
        MediaType: "RECYCLED"
      }