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

Cannot print on another tray #42

Closed
Batajus opened this issue May 17, 2017 · 5 comments
Closed

Cannot print on another tray #42

Batajus opened this issue May 17, 2017 · 5 comments

Comments

@Batajus
Copy link

Batajus commented May 17, 2017

Hey guys,
i'm trying to print a document on the second paper tray.

My printer supports following media sources:
'media-source-supported': [ 'tray-1', 'tray-2', 'tray-3', 'tray-1-man' ],

I'm using the code from your printPDF.js sample:
var file = { "operation-attributes-tag": { "requesting-user-name": "User", "job-name": "Print Job", "document-format": "application/pdf" }, "job-attributes-tag": { "media-col": { "media-source": "tray-2" } }, data: data };

But my printer always shows the error message you need to add paper to the first tray.
Do you have any ideas?

@WillCHansen
Copy link

Hi Batajus,

I think your issue is related to the issue I just opened. (#43)

As a work around you can see my example of writing out the message to the printer manually.

@williamkapke
Copy link
Owner

williamkapke commented Oct 17, 2017

I believe I have #43 fixed now.
For more information on how to select a media source, see: #46 (comment)

@Batajus
Copy link
Author

Batajus commented Feb 13, 2018

I found another solution for my issue:

var ipp = require('./../ipp');
var PDFDocument = require('pdfkit');
var concat = require("concat-stream");

var doc = new PDFDocument({margin:0});
doc.text(".", 0, 0);


doc.pipe(concat(function (data) {
	var printer = ipp.Printer("http://cp02.local.:631/ipp/printer");
	var msg = {
		"operation-attributes-tag": {
			"requesting-user-name": "Bumblebee",
			"job-name": "whatever.pdf",
			"document-format": "application/pdf"
		},
		"job-attributes-tag":{
			"media": [ "tray-2" ] // <- This worked for me
		}
		, data: data
	};
	printer.execute("Print-Job", msg, function(err, res){
		console.log(err);
		console.log(res);
	});
}));
doc.end();

I used this (4.2.11) for my solution.

But i will try your fix as soon as possible and inform you about the results ;-)

@wifiprintguy
Copy link

@Batajus, just a recommendation: if you are going to quote an IPP specification for an IPP attribute definition, for instance "job-priority", you might want to quote the latest non-obsolete revision for IPP, which is RFC 8011 section 5.2.1.

@Batajus
Copy link
Author

Batajus commented Feb 14, 2018

@wifiprintguy thanks for the tipp ;-)
I referenced the old one, because I have used it and not the latest one. But here's the link to the respective paragraph in the new one.

@williamkapke, I tried the latest version and now everything works fine, so thanks for the fix =)

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

4 participants