Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get it working using a TL-WPS510U Printserver #15

Closed
SunboX opened this issue Apr 4, 2015 · 4 comments
Closed

Can't get it working using a TL-WPS510U Printserver #15

SunboX opened this issue Apr 4, 2015 · 4 comments

Comments

@SunboX
Copy link

SunboX commented Apr 4, 2015

Hi,

I'm owning a TL-WPS510U Printserver. The Specification says, it's supporting TCP/IP, IPX/SPX, NetBEUI, AppleTalk, LPR/LPD, IPP

But I can't access it using ipp.js 😢

First I did try to access it using telnet, that worked:

sunbox:~ sunbox$ telnet 192.168.1.245 631
Trying 192.168.1.245...
Connected to 192.168.1.245.
Escape character is '^]'.

Trying to access http://192.168.1.245:631/lp1 using a Browser shows this:
bildschirmfoto 2015-04-04 um 13 59 07

Than I wrote a small script:

var ipp = require('ipp');

var printer = ipp.Printer('http://192.168.1.245:631/lp1');
var msg = {
    "operation-attributes-tag": {
        "requesting-user-name": 'sunbox',
        "job-name": 'My Test Job',
        "document-format": 'text/plain'
    },
    data: new Buffer('Hello World!', 'utf-8')
};

printer.execute('Print-Job', msg, function (err, res) {
    console.log(res);
});

which returned with the message:

sunbox:~ sunbox$ node test.js 
{ version: '1.0',
  statusCode: 'server-error-version-not-supported',
  id: 0,
  'operation-attributes-tag': 
   { 'attributes-charset': 'utf-8',
     'attributes-natural-language': 'en-us' } }

I changed the URI trying to get it work to these values:

var printer = ipp.Printer('http://192.168.1.245:631/lp1');
var printer = ipp.Printer('http://192.168.1.245/lp1');
var printer = ipp.Printer('ipp://192.168.1.245:631/lp1');
var printer = ipp.Printer('ipp://192.168.1.245/lp1');

which failed with the the same message. 😐

Trying these:

var printer = ipp.Printer('lpd://192.168.1.245:631/lp1');
var printer = ipp.Printer('lpr://192.168.1.245:631/lp1');

failed with:

sunbox:~ sunbox$ node test.js 

http.js:1840
    throw new Error('Protocol:' + options.protocol + ' not supported.');

So now I'm clueless. 😕 How can I get ipp.js to talk to my TL-WPS510U printserver ❓

@SunboX
Copy link
Author

SunboX commented Apr 4, 2015

Btw, calling http://192.168.1.245:631/printers using a Brwoser returns:

404 Object Not Found.

@williamkapke
Copy link
Owner

Wow- that little guy looks cool!

You're getting an IPP response, you were successful- it just didn't like the format of the message sent. There isn't anything wrong with the URL that you were using- I haven't seen a printer that offers different IPP things at different URLs. It seems like it just doesn't support IPP version 2.0. Specify version 1.0 instead:

var ipp = require('ipp');
var printer = ipp.Printer('http://192.168.1.245:631/lp1', {version:'1.0'});

The version defaults to '2.0'

I suggest trying to get the printer attributes first- and then try other things.

Also: Using new Buffer('Hello World!', 'utf-8') will not work. The data needs to be in a print format like PDF (it might not support PDF though!). See the Print PDF example

@SunboX
Copy link
Author

SunboX commented Apr 6, 2015

Thank's a lot! It works getting the printer attributes using the script below. 😄

Regarding the printserver, it's really nice. A little bit difficult to initially connect to the wifi and the UI is a bit ugly, but it works really well and boots up very quick. 😄

Btw, do you know how I can print a simple image? Do I always need to put it inside a PDF?

For anyone coming across this issue, this is the script I used to get the printer attributes:

var ipp = require('ipp');

var printer = ipp.Printer('http://192.168.1.245:631/lp1', {
    version: '1.0'
});

printer.execute('Get-Printer-Attributes', null, function (err, res) {
    console.log(res);
});

and the response:

sunbox:~ sunbox$ node test.js 
{ version: '1.0',
  statusCode: 'successful-ok',
  id: 90554184,
  'operation-attributes-tag': 
   { 'attributes-charset': 'utf-8',
     'attributes-natural-language': 'en-us' },
  'printer-attributes-tag': 
   { 'printer-uri-supported': [ '/lp1', '/lp1_txt' ],
     'uri-security-supported': 'none',
     'printer-name': '1P_PrintServ75638A',
     'printer-location': '',
     'printer-more-info': 'http://192.168.1.245',
     'printer-make-and-model': '',
     'printer-state': 'idle',
     'operations-supported': 
      [ 'Print-Job',
        'Validate-Job',
        'Cancel-Job',
        'Get-Job-Attributes',
        'Get-Jobs',
        'Get-Printer-Attributes' ],
     'charset-configured': 'utf-8',
     'charset-supported': [ 'utf-8', 'us-ascii' ],
     'natural-language-configured': 'en-us',
     'generated-natural-language-supported': 'en-us',
     'document-format-default': 'application/octet-stream',
     'document-format-supported': [ 'application/octet-stream', 'text/plain' ],
     'printer-is-accepting-jobs': true,
     'pdl-override-supported': 'not-attempted',
     'printer-up-time': 89 } }

@SunboX SunboX closed this as completed Apr 6, 2015
@williamkapke
Copy link
Owner

For printing an image, I personally think dropping it in a PDF is the easiest. Many printers do not support it so you would need to figure out how to send it with another print language that is supported by the device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants