Find Jobs
Hire Freelancers

Convert a script from C# to javascript/nodejs to print image to POS Printer (ESCP)

$10-30 USD

Ολοκληρώθηκε
Αναρτήθηκε πάνω από 9 χρόνια πριν

$10-30 USD

Πληρωμή κατά την παράδοση
You may use whatever nodejs module (npm) you want in order to accomplish the goal. The goal is to create a command string that will be created with the script and it will be placed in the buffer. Below you may see the script that I want to be converted to nodejs/javascript. public string GetLogo() { string logo = ""; if (![login to view URL](@"C:\[login to view URL]")) return null; BitmapData data = GetBitmapData(@"C:\[login to view URL]"); BitArray dots = [login to view URL]; byte[] width = [login to view URL]([login to view URL]); int offset = 0; MemoryStream stream = new MemoryStream(); BinaryWriter bw = new BinaryWriter(stream); [login to view URL]((char)0x1B); [login to view URL]('@'); [login to view URL]((char)0x1B); [login to view URL]('3'); [login to view URL]((byte)24); while (offset < [login to view URL]) { [login to view URL]((char)0x1B); [login to view URL]('*'); // bit-image mode [login to view URL]((byte)33); // 24-dot double-density [login to view URL](width[0]); // width low byte [login to view URL](width[1]); // width high byte for (int x = 0; x < [login to view URL]; ++x) { for (int k = 0; k < 3; ++k) { byte slice = 0; for (int b = 0; b < 8; ++b) { int y = (((offset / 8) + k) * 8) + b; // Calculate the location of the pixel we want in the bit array. // It'll be at (y * width) + x. int i = (y * [login to view URL]) + x; // If the image is shorter than 24 dots, pad with zero. bool v = false; if (i < [login to view URL]) { v = dots[i]; } slice |= (byte)((v ? 1 : 0) << (7 - b)); } [login to view URL](slice); } } offset += 24; [login to view URL]((char)0x0A); } // Restore the line spacing to the default of 30 dots. [login to view URL]((char)0x1B); [login to view URL]('3'); [login to view URL]((byte)30); [login to view URL](); byte[] bytes = [login to view URL](); return logo + [login to view URL](bytes); } public BitmapData GetBitmapData(string bmpFileName) { using (var bitmap = (Bitmap)[login to view URL](bmpFileName)) { var threshold = 127; var index = 0; double multiplier = 570; // this depends on your printer model. for Beiyang you should use 1000 double scale = (double)(multiplier/(double)[login to view URL]); int xheight = (int)([login to view URL] * scale); int xwidth = (int)([login to view URL] * scale); var dimensions = xwidth * xheight; var dots = new BitArray(dimensions); for (var y = 0; y < xheight; y++) { for (var x = 0; x < xwidth; x++) { var _x = (int)(x / scale); var _y = (int)(y / scale); var color = [login to view URL](_x, _y); var luminance = (int)(color.R * 0.3 + color.G * 0.59 + color.B * 0.11); dots[index] = (luminance < threshold); index++; } } return new BitmapData() { Dots = dots, Height = (int)([login to view URL]*scale), Width = (int)([login to view URL]*scale) }; } } public class BitmapData { public BitArray Dots { get; set; } public int Height { get; set; } public int Width { get; set; } }
Ταυτότητα εργασίας: 6778333

Σχετικά με την εργασία

3 προτάσεις
Απομακρυσμένη Εργασία
Ενεργός/ή 9 χρόνια πριν

Ψάχνεις τρόπο για να κερδίσεις μερικά χρήματα;

Πλεονεκτήματα πλειοδοσίας στο Freelancer

Καθόρισε τον προϋπολογισμό σου και το χρονοδιάγραμμα
Πληρώσου για τη δουλειά σου
Περίγραψε την πρόταση σου
Η εγγραφή και η πλειοδοσία σε εργασίες είναι δωρεάν
Βραβεύτηκε στον/στην:
Avatar Χρήστη
Thank you for posting this project .I have more than 5 years experience on C# / javascript. I am ready to start the work right now. I'm looking forward to waiting for your reply. I can work in Wordpress, Joomla, Magento, CMS, C#,asp.net,Java ... Thank you for your attention. If you're free, please chat with me
$50 USD σε 3 ημέρες
0,0 (0 αξιολογήσεις)
0,0
0,0
3 freelancers δίνουν μια μέση προσφορά $144 USD για αυτή τη δουλειά
Avatar Χρήστη
We are a professional developer team of 3 developers and a project manager located in Berlin. It supposed to be needed to cover the whole process with tests too.
$217 USD σε 2 ημέρες
5,0 (1 αξιολόγηση)
4,4
4,4
Avatar Χρήστη
Hello, I am proficient using HTML, CSS, PHP, Flash, ActionScript, Java and C/C++. I understand your job. I am little busy with my other big job. If you give me 2 days then I can fix this issue. Regards, Biplob
$111 USD σε 1 ημέρα
0,0 (0 αξιολογήσεις)
0,0
0,0
Avatar Χρήστη
Hi , We have significant experience in node.js project. We can provide references on request. Regards Ennovations
$105 USD σε 2 ημέρες
0,0 (0 αξιολογήσεις)
0,0
0,0

Σχετικά με τον πελάτη

Σημαία της BULGARIA
SOFIA, Bulgaria
4,9
28
Επαληθευμένη μέθοδος πληρωμής
Μέλος από Φεβ 13, 2010

Επαλήθευση Πελάτη

Ευχαριστούμε! Σου έχουμε στείλει ένα email με ένα σύνδεσμο για να διεκδικήσεις τη δωρεάν πίστωση σου.
Κάτι πήγε στραβά κατά την προσπάθεια αποστολής του email σου. Παρακαλούμε δοκίμασε ξανά.
Εγγεγραμμένοι Χρήστες Συνολικές Αναρτημένες Δουλειές
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Φόρτωση προεπισκόπησης
Δόθηκε πρόσβαση για Geolocation.
Η σύνδεση σου έχει λήξει και τώρα έχεις αποσυνδεθεί. Παρακαλούμε συνδέσου ξανά.