node-printer icon indicating copy to clipboard operation
node-printer copied to clipboard

Error when printing postscript with 'RAW' type on Windows

Open kinooyume opened this issue 7 years ago • 2 comments

Hi, I made a virtual printer that receive a postscript file as input, I can convert it with ghostscript without any issue so I assume that is not corrupt or invalid format. Then I tried to print this same postscript with printDirect as in the following code:

return new Promise((resolv, result) => {
      const printerData = {
        data: ps, // Node Buffer from fs.readFileSync("path/to/file.ps")
        printer: printername,
        type: "RAW",
        success: id => {
          console.log('success !! ' + id)
          resolv(id);
        },
        error: err => {
          console.log('failed ! ' + err)
          reject(err);
        }
      };
      printer.printDirect(printerData);
  });

I tried to send it to "Microsoft Print to PDF", "Microsoft XPS Document Writer", "Master PDF Editor 4". All of them confuse my file with an xps file and can't open it, except "Microsoft Print to PDF" create a pdf file but it's corrupt. You can find my postscript file here

Any advices/solutions ? Should I convert my postscript to xps format ? Thanks for your great work by the way !

Edit: Also, this is a list of my printers:

{ name: 'Microsoft XPS Document Writer',
  portName: 'PORTPROMPT:',
  driverName: 'Microsoft XPS Document Writer v4',
  printProcessor: 'winprint',
  datatype: 'RAW',
  status: [],
  statusNumber: 0,
  attributes: [ 'DO-COMPLETE-FIRST', 'LOCAL' ],
  priority: 1,
  defaultPriority: 0,
  averagePPM: 0 }
{ name: 'Microsoft Print to PDF',
  portName: 'PORTPROMPT:',
  driverName: 'Microsoft Print To PDF',
  printProcessor: 'winprint',
  datatype: 'RAW',
  status: [],
  statusNumber: 0,
  attributes: [ 'DO-COMPLETE-FIRST', 'LOCAL' ],
  priority: 1,
  defaultPriority: 0,
  averagePPM: 0 }
{ name: 'Master PDF Editor 4',
  shareName: 'Master PDF Editor 4',
  portName: 'MPELocalPort:',
  driverName: 'Master PDF Editor 4.0.0.0',
  comment: 'Master PDF Editor 4',
  printProcessor: 'winprint',
  datatype: 'RAW',
  status: [],
  statusNumber: 0,
  attributes: [ 'LOCAL' ],
  priority: 1,
  defaultPriority: 1,
  averagePPM: 0,
  startTime: 60,
  untilTime: 60 }
{ name: 'Fax',
  portName: 'SHRFAX:',
  driverName: 'Microsoft Shared Fax Driver',
  printProcessor: 'winprint',
  datatype: 'RAW',
  status: [],
  statusNumber: 0,
  attributes: [ 'FAX', 'LOCAL' ],
  priority: 1,
  defaultPriority: 0,
  averagePPM: 0 }

kinooyume avatar Nov 09 '17 16:11 kinooyume

@kiuKisas Were you able to resolve this ?

with-shrey avatar Apr 18 '21 16:04 with-shrey

Sorry, I can't remember, It was a freelance project and it was a long time ago. I can't help :/

kinooyume avatar Apr 21 '21 10:04 kinooyume