Drucken von Elektron-Anwendung

Ich versuche, Knoten-Drucker von einem Elektron Anwendung, aber sobald ich hinzufügen, die Zeilen zu verwenden, den Drucker, die app stürzt nach unten.

Die Konsole gibt Folgendes:

[1] 9860 segmentation fault (core dumped) node_modules/electron-prebuilt/dist/electron.

Dies ist die app, die bei mir läuft. Ich habe nur die Zeilen drucken, die einfache app Beispiel auf Elektronen-Dokumentation:

var app = require('app');  //Module to control application life.
var BrowserWindow = require('browser-window');  //Module to create native browser window.
var printer = require('printer');

//Report crashes to our server.
require('crash-reporter').start();

//Keep a global reference of the window object, if you don't, the window will
//be closed automatically when the JavaScript object is GCed.
var mainWindow = null;

//Quit when all windows are closed.
app.on('window-all-closed', function() {
  //On OS X it is common for applications and their menu bar
  //to stay active until the user quits explicitly with Cmd + Q
  if (process.platform != 'darwin') {
    app.quit();
  }
});

//This method will be called when Electron has finished
//initialization and is ready to create browser windows.
app.on('ready', function() {
  //Create the browser window.
  mainWindow = new BrowserWindow({width: 800, height: 600});

  //and load the index.html of the app.
  mainWindow.loadUrl('file://' + __dirname + '/app/index.html');

  //Open the devtools.
  mainWindow.openDevTools();

  printer.printDirect({data:"print from Node.JS buffer" //or simple String: "some text"
      , printer:'HP-Deskjet-F4400-series' //printer name, if missing then will print to default printer
      , type: 'TEXT' //type: RAW, TEXT, PDF, JPEG, .. depends on platform
      , success:function(jobID){
          console.log("sent to printer with ID: "+jobID);
      }
      , error:function(err){console.log(err);}
  });


  //Emitted when the window is closed.
  mainWindow.on('closed', function() {
    //Dereference the window object, usually you would store windows
    //in an array if your app supports multi windows, this is the time
    //when you should delete the corresponding element.
    mainWindow = null;
  });
});

Bin ich etwas fehlt?
Ich versuchte den Knoten Drucker auf seine eigene und ich habe Sie erfolgreich gedruckt, einige Kauderwelsch-text.

InformationsquelleAutor leamasuero | 2015-08-28

Schreibe einen Kommentar