neodynamic / js-escpos-builder

JSESCPOSBuilder - ESC/POS Commands Builder for Javascript
MIT License
39 stars 14 forks source link

setPrintWidth not working as expected #6

Open dnyanesh2700 opened 2 years ago

dnyanesh2700 commented 2 years ago

var escpos = Neodynamic.JSESCPOSBuilder; var doc = new escpos.Document(); var new_doc = new escpos.Document(); var header = doc

                                                            .align(escpos.TextAlignment.Center)
                                                             . setPrintWidth(48)          
                                                            .image(logo, escpos.BitmapDensity.D24)
                                                            .font(escpos.FontFamily.A)
                                                            .style([escpos.FontStyle.Bold])
                                                            .size(0, 1)

                                                            .font(escpos.FontFamily.A)
                                                            .style([escpos.FontStyle.Bold])
                                                            .size(0, 0.5)
                                                            .newLine()
                                                            .cut(partial_feed,partial_cut)
                                                            .generateUInt8Array();
                                                            cpj.binaryPrinterCommands = header;
                                                            cpj.sendToClient();

When I am trying to set width from Script it is getting print as:

image_1

when I am chang width in lib file of JSESCPOSBuilder.js at line 244 it work correctly, but from script not working correctly.

1TCP5 commented 1 year ago

same issue

nicolaslopezj commented 1 year ago

You can set the width doing this:

let instructions = new Document()
instructions.width = 42

It works correctly