我想在本地使用打印機打印PDF文件。這是一個代碼,試圖打印。nodejs的因特網打印協議(IPP)
fs.readFile('documents/AccountStatement.pdf', function(err, data) {
if (err)
throw err;
var printer = ipp.Printer("http://hostname:631/ipp/printer");
var msg = {
"operation-attributes-tag": {
"requesting-user-name": "KUMA1936",
"job-name": "My Test Job",
"document-format": "application/pdf"
},
data: data
};
printer.execute("Print-Job", msg, function(err, res){
console.log(res);
console.log(err);
});
});
在上面的代碼中,printer.execute()方法和「Print-Job」參數是什麼。又是什麼631 here.When我打印資源,其節目
{版本:「1.1」, 的StatusCode:「服務器錯誤操作不支持」, ID:442076, 「操作屬性-tag': { '屬性,字符集': 'UTF-8', '屬性 - 自然語言': 'EN-US'}} ERR爲空。