2013-04-24 2 views
1

로컬 프린터에서 pdf 파일을 인쇄하려고합니다. 이 코드는 인쇄하려고했습니다.노드 용 인터넷 인쇄 프로토콜 (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) 무엇을 '1.1', 에 statusCode : '서버 오류 작동-지원하지' ID : 442076, '동작 특성을 태그 ': {'특성 - charset ':'utf-8 ', '특성 - 자연 언어 ':'en-us '}} 오류가 null입니다.

답변

0

docs을 확인할 수 있습니다. 첫 번째 매개 변수 (문자열)는 IPP에 의해 정의 된 연산입니다. 설명에 대한 Print-Job 작업은 당신이 다른 IPP는 작업 here을 지원 볼 수 있습니다

3.2.1 Print-Job Operation 

    This REQUIRED operation allows a client to submit a print job with 
    only one document and supply the document data (rather than just a 
    reference to the data). See Section 15 for the suggested steps for 
    processing create operations and their Operation and Job Template 
    attributes. 

here 주어집니다. 631은 TCP를 사용하는 IPP에 사용되는 수용된 포트입니다.

당신은 표시 오류 here에 대한 자세한 내용을 확인할 수는 :

13.1.5.2 server-error-operation-not-supported (0x0501) 

    The IPP object does not support the functionality required to fulfill 
    the request. This is the appropriate response when the IPP object 
    does not recognize an operation or is not capable of supporting it. 
    See sections 3.1.6.1 and 3.1.7. 

이 코드에서 오류가 없다는 것을 의미한다. 대부분 프린터가 구성되지 않았거나 IPP를 지원하지 않습니다. 마지막으로 IPP.Printer에 프린터 IP를 부여해야합니다. 그래서 당신이주고있는 IP가 유효한지 확인하십시오 (당신의 코드는 호스트 네임을 보여줍니다). 이 주어진다 page 프로젝트에서 : 내 경우

To find out if your printer supports IPP: 

- Google your printer's specs 
- Try: telnet YOUR_PRINTER 631. If it connects, that's a good sign. 
- Use the '/examples/findPrinters.js' script. 
0

난 그냥 프린터 :

그래서 URL 거 (서로 공유 등)이 될(findPrinters.js에서 찾을 수 있습니다.)

http://My-Computer-Name.local.:631/printers/my_printer_name

프린터가 컴퓨터와 연결되어 있지 않은 경우 (예 : USB) 컴퓨터에 도움이됩니다. 하지만 LAN을 통해 연결하십시오.

0
  • IPP-2.0을 보내는 동안 IPP 버전 1.1 응답을받는 것처럼 보입니다.
  • 버전 옵션
을 사용하여 1.1로 다운 그레이드 해보십시오.