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 you add tha ability to print Canvas #11

Open
sebmahel opened this issue Mar 11, 2019 · 1 comment
Open

Can you add tha ability to print Canvas #11

sebmahel opened this issue Mar 11, 2019 · 1 comment
Labels
feature request New feature or request

Comments

@sebmahel
Copy link

Example

const JsBarcode = require('jsbarcode');
const Canvas = require("canvas");
const printer = require('node-native-printer');

let canvas = Canvas.createCanvas();
JsBarcode(canvas, "Hello");

let options = {
"collate": true,
"landscape": true,
"paperSize": "Letter"
}

printer.printCanvas(canvas, options, 'PrinterName')

@sebmahel
Copy link
Author

//Workarround

const fs = require('fs');
const os = require('os');
const JsBarcode = require('jsbarcode');
const Canvas = require("canvas");
const printer = require('node-native-printer');

let canvas = Canvas.createCanvas();
JsBarcode(canvas, "Hello");

var buf = canvas.toBuffer();
fs.writeFileSync( os.tmpdir() + "/tmp.png", buf);

let options = {
"collate": true,
"landscape": true,
"paperSize": "Letter"
}

printer.print(os.tmpdir() + "/tmp.png", options, 'PrinterName')

@MatteoMeil MatteoMeil added the feature request New feature or request label Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants