GithubHelp home page GithubHelp logo

neodynamic / jsprintmanager Goto Github PK

View Code? Open in Web Editor NEW
244.0 244.0 136.0 1.38 MB

Advanced Client-side Printing & Scanning Solution for Javascript

Home Page: https://www.neodynamic.com/products/printing/js-print-manager/

JavaScript 95.79% HTML 3.79% ASP.NET 0.43%
barcode doc duplex epl escpos inkjet labels laser network pdf pos postscript print scan serial thermal trays usb xls zpl

jsprintmanager's People

Contributors

neodynamic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsprintmanager's Issues

Encoding for raw printing

Hello, guys!

Is there any API to set custom encoding for raw data printing?
Because I get strange symbols as result if I send symbols from CP-1251 encoding (for example).

This issue can be solved by printing a TXT file, but it's printed only within 50% of the paper size...

Could you, please, give some advises or solutions to solve this issue?

Where should I register my license key?

I bought jspm3.0, but I don't know where to register the license key. They told me to look at the product manual, but I don't know where the product manual is. help

PrintRange can exceed actual number of pages

Hi guys,

I'm trying to print a PDF file using JSPrintManager().
I've got a file, which is 2 pages long. Now if I specify myFile.printRange with an value greater than 2 it loads the evaluation dialog and after confirming, I get an error "Job cancelled: WPDF Invalid Page Range". (see Screenshot below)

My source code:

...
// set content to print
var myFile = new JSPM.PrintFilePDF('../files/Demo.pdf', JSPM.FileSourceType.URL, 'MyFile.pdf', 1);
if (myFile.isValidRange(range.value)) {
  myFile.printRange = range.value;

  // add file to print job
  cpj.files.push(myFile);

  // send print job to printer
  cpj.sendToClient();
} else {
  ...
}

exceedprintrange

This dialog comes right after confirming the evaluation dialog. (see below)

eval_dialog

Is there a way to get the number of pages from the myFile object?

Thank you!

RAW Printing

How to cut the paper automatically after printing the data on paper in thermal printers.
I am testing in BIXOLON SRP-332II.
Is their any command to do it? Please help me. Thanks in advance

Uncaught (in promise): Malformed message

Hi,

I am having some error message in console when printing with jsprintmanager. The lib is still working though but I dont know why its showing up this error message. I am using the latest version of jsprintmanager (v4.0.21.817)
image
image
image

Thank you for your support,
Bogdan

Auto start with Operating System

JSPrintManager should auto start with OS power on. But it is not happening. Successfully printed barcode, but every time (when OS start) , have to start JSPrintManager. Is there any way to do that ?

How to install jspm4-4.0.21.1102-win64.msi via SCCM?

Hi
Trying to install jspm4-4.0.21.1102-win64.msi via SCCM with: msiexec.exe" /i "jspm4-4.0.21.1102-win64.msi" PROPERTY=RUNATSTARTUP /qn
but the app does not startup after reboot which will cause the website not see the app running.
Is there a way around this as I need to test deployment in prep for user mass deployment?
Thanks

Event to track success of printjob

Hi,
do we any event to know the status of print job ?

On success of printjob, we need to do extra task but current we do not have a way to track.

we have onError or onFinished but not for success.

if error we should stop next action and if success do some Database operation so any better way to do this.

Error Uncaught in Promise when JSPrintManager is not installed (V4)

When JSPrintManager Client App V4 is not installed on the computer, there is the following error in the console log:
WebSocket connection to 'wss://localhost:24443/' failed:

This exception is expected and was also there in V3.

But in V4 there is another Exception that shows up.

Error: Uncaught (in promise): Event: {"isTrusted":true} at resolvePromise (zone-evergreen.js:798:1) at zone-evergreen.js:705:1 at i (JSPrintManager.js:2:31492) at ZoneDelegate.invoke (zone-evergreen.js:364:1) at Object.onInvoke (core.js:27504:1) at ZoneDelegate.invoke (zone-evergreen.js:363:1) at Zone.run (zone-evergreen.js:123:1) at zone-evergreen.js:857:1 at ZoneDelegate.invokeTask (zone-evergreen.js:399:1) at Object.onInvokeTask (core.js:27492:1) at ZoneDelegate.invokeTask (zone-evergreen.js:398:1) at Zone.runTask (zone-evergreen.js:167:1) at drainMicroTaskQueue (zone-evergreen.js:569:1) at ZoneTask.invokeTask [as invoke] (zone-evergreen.js:484:1) at invokeTask (zone-evergreen.js:1621:1) at WebSocket.globalZoneAwareCallback (zone-evergreen.js:1647:1)

I think the behaviour with V3 (no exception) was better. Or is there a way to prevent this error. I see on your demo page it's just a warning.

JSPrintManager modifies file extensions in printer queue

Hi guys!

This is not much of an issue, as printing with JSPrintManager just works fine.
But after confirming the final print dialog (evaluation mode) I noticed that, e.g. MyFile.pdf is added as 0,1,MyFile.wpdf inside of printers queue.

This is only visible with a printer, which is not connected, as otherwise its not possible to inspect the printer queue properly.

Same happens when using the PDFCreator as DefaultPrinter. The created file is saved according to the above pattern.

Any guesses why this is happening?
Thank you very much

JSPM3 on Arch or Manjaro

I managed to install jspm3 on manjaro (by converting .deb into arch package) but it seem jspm3 not working as expected, after the popup it said need to install libre office. So after installing libre office, the popup said printing but nothing being printed on my printer.

Inform user to update JSPM to v3

We want to migrate from JSPM v2 to JSPM v3 and we need to inform the users to install the new desktop version.
If the installed desktop JSPM version is 2, but JavaScript version on our web application uses version 3, the web socket connection has status "CLOSED" (Error in connection establishment: net::ERR_CONNECTION_REFUSED)
And since there's no WS connection, this part of the code is never reached

if (verArray[0] + '.' + verArray[1] != JSPM.VERSION) {

which prevents us to get information about the installed client version using JSPM.JSPrintManager.showAbout().

Is there any reliable way to get mismatch between Lib JS version and desktop version?

Printing orientation

I am trying to change the orientation with ESC T n, but "n" is two numbers separated from a ",", for example "1,49" and I am defining it like this:


var esc = '\ x1B T 1,49';
var cmds = esc + "@";

this is the way to change the orientation, since the printer keeps printing the same or is there another way to define it to do it, since I need to do it Bottom to top.

I would appreciate you can help me.

Printing Common Files not working for PDF - on some MacOS Mojave 10.14.1 (and 10.14.6)

Hi,

I've used the samples from here: https://www.neodynamic.com/Products/Help/JSPrintManager2.0/articles/jsprintmanager.html

And the printing of PNG is working properly with JSPM.PrintFile() call but PDF and TXT are not working with all of these methods:

  • JSPM.PrintFilePDF()
  • JSPM.PrintFileTXT()
  • JSPM.PrintFile()

Even more: .PrintFileTXT() expects only 3 params, not 4 which causes some exception. And printing with 3 params emits printing an only passed string, not file loaded by URL (actually that string).

You can test it with your docs example:

<script type="text/javascript">

    JSPM.JSPrintManager.auto_reconnect = true;
    JSPM.JSPrintManager.start();
    JSPM.JSPrintManager.WS.onStatusChanged = function () {
        if (JSPM.JSPrintManager.websocket_status == JSPM.WSStatus.Open) {
            var cpj = new JSPM.ClientPrintJob();
            cpj.clientPrinter = new JSPM.DefaultPrinter();
            var my_file1 = new JSPM.PrintFilePDF('/files/LoremIpsum.pdf', JSPM.FileSourceType.URL, 'MyFile.pdf', 1);
            var my_file2 = new JSPM.PrintFileTXT('/files/LoremIpsum.txt', JSPM.FileSourceType.URL, 'MyFile.txt', 1);
            cpj.files.push(my_file1);
            cpj.files.push(my_file2);
            cpj.sendToClient();
        }
    };

</script>

The same result with cloned repo https://jsprintmanager.azurewebsites.net/ and trying this page, working ONLY for IMAGES:
image

Thanks in advance

Uncaught (in promise) zip.js, zip-ext.js, and deflate.js files from https://github.com/gildas-lormeau/zip.js project are missing.

I'm trying to add JSPrintManager to our project. I've added jsprintmanager to our package.json:

  "dependencies": {
    "@zip.js/zip.js": "^2.2.16",
    "jsprintmanager": "^3.0.6",
  },

I've also added zip.js, but JSPrintManager keeps on complaining that I need to add zip.js, zip-ext.js, and deflate.js files.

Any suggestions as to how to fix this? I'm trying to use webpack with npm/yarn as much as possible, adding these files to our html like suggested is not really an option.

Demo Print Images & Docs fails to print PDF

Hi,

The Demo for Print Images & Docs fails to print the provided sample pdf, or any local pdf.

For the sample pdf (https://neodynamic.com/temp/LoremIpsum.pdf) I receive this error: "Job cancelled: An operating system call failed." - this is shown in the Job Trace window: > {}

For any local pdf I receive this error: "Job cancelled: System error, (OS Code 2):
No such file or directory.
" The error is produced for any pdf in any directory on my local system. I have tried lots of different options, home directory, downloads directory, root directory, even used files with 777 permissions. All produce the same error. Nothing is shown in the job trace window.

In any of the above cases, when not clicking Ok on the produced error alert but anywhere else, the alert disappears and the jspm5 client needs to be restarted for anything further to work.

The same problem occurs on the Advanced PDF Printing demo.

The Raw Data Printing demo works correctly.

I'm using jspm5 (latest version) on Linux Mint.

Please let me know what I'm doing wrong.

Thanks

Does this package allow me to remotly print?

Does this package allow me to remotely print?

Basicly my end goal is that someone can press a button on a tablet and that it gives a print command towards the printer.
I tried the Vue example but it did not work on my tablet (on pc it worked fine, with the client installed).

Does someone know a good way to fix this?

license_url error

When I added JSPM.JSPrintManager.license_url in JavaScript

"JSPrintManager30.js:1329 Uncaught TypeError: Cannot read property'send' of undefined
at Function.set [as license_url] (JSPrintManager30.js:1329)". How do I handle this?

Handshake Mode does not cover all cases.

I have try to print raw command with sp40 plus. The buffer control in this passbook printer is DTR+SRTS, and using finanacial ibm = honorCTS. It does not print out anything, look like the jsprintmanager has a limit of handshake mode

None
RequestToSend
RequestToSendXOnXOff
XOnXOff

When i change the printer handshake to xonxoff, then it can able to print out.

How i can add a custom handshake into jsprintmanager ?

Thanks

Raw printing

How to cut the paper automatically after printing the data on paper in thermal printers.
Is their any command to do it? Please help me.Thanks in advance

.d.ts type definnation is not working with typescript import

import { Injectable } from '@angular/core';
import * as JSPM from 'jsprintmanager';


@Injectable({providedIn: 'root'})
export class PrinterManagerService {
  constructor() {  }

  silentPrint() {
    console.log('JSPM', JSPM);
    console.log('jsprintmanager', JSPM.JSPM);
    JSPM.JSPrintManager.auto_reconnect = true;
    JSPM.JSPrintManager.start();
    JSPM.JSPrintManager.WS.onStatusChanged = async () => {
      if (JSPM.JSPrintManager.websocket_status === JSPM.WSStatus.Open) {
        const list = await JSPM.JSPrintManager.getPrinters();
        console.log('list', list);
      }
    };
  }

}

I just wonder why?

image

Job cancelled: Access violation

Hi there,
I get an error message after allowing eval print dialog from JSPM. I am trying to print an PDF-File, which was converted to blob before.
Here is my code:

if (JSPM.JSPrintManager.websocket_status == JSPM.WSStatus.Open) {
  var cpj = new JSPM.ClientPrintJob();
  cpj.clientPrinter = new JSPM.DefaultPrinter();
  var file = new JSPM.PrintFilePDF(response.body, JSPM.FileSourceType.BLOB, newFileName, 1);
  cpj.files.push(file);
  cpj.sendToClient();
}

I've already checked response.body. It's got a valid size and type application/pdf.
Any guesses why this is happening?

Thanks in advance.

Scan Docs & Images with React

Hi All ,
I get error when I use Scan Docs & Images in react App with
can you please assist me how can I solve this issue
and can you please assist me how can I use Scan Docs & Images with React hooks

the error :

JSPrintManager.js:2 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'send')
    at JSPrintManager.js:2:1
    at new Promise (<anonymous>)
    at n.getScanners (JSPrintManager.js:2:1)
    at ScanningSample.componentDidMount (scanner.js:100:1)
    at commitLayoutEffectOnFiber (react-dom.development.js:23204:1)
    at commitLayoutMountEffects_complete (react-dom.development.js:24578:1)
    at commitLayoutEffects_begin (react-dom.development.js:24564:1)
    at commitLayoutEffects_begin (react-dom.development.js:24546:1)
    at commitLayoutEffects_begin (react-dom.development.js:24546:1)
    at commitLayoutEffects_begin (react-dom.development.js:24546:1)
    at commitLayoutEffects (react-dom.development.js:24502:1)
    at commitRootImpl (react-dom.development.js:26779:1)
    at commitRoot (react-dom.development.js:26638:1)
    at performSyncWorkOnRoot (react-dom.development.js:26073:1)
    at flushSyncCallbacks (react-dom.development.js:12009:1)
    at flushSync (react-dom.development.js:26157:1)
    at Object.scheduleRefresh (react-dom.development.js:27749:1)
    at react-refresh-runtime.development.js:304:1
    at Set.forEach (<anonymous>)
    at Object.performReactRefresh (react-refresh-runtime.development.js:293:1)
    at RefreshUtils.js:62:1

Uncaught (in promise) Malformed message

Hi,

I am having this error message in console when load up jsprintmanager:
JSPrintManager.js:980 Uncaught (in promise) Malformed message. Error: { "id" : "a1920acd", "type" : "message", "last" : true }
The lib is still working though but I dont know why its showing up this error message

Please help,
Hungnd

jspm3.exe in RDS environment

Hi,

We have a problem with jspm3.exe, for the services daemon all is good, but for the jspm3.exe, only one user can open it, the other user have a grey icon with "waiting for port 23443 to be ready"

I understand that port cannot be ready more than 1 time in a single machine? Any solution to have JSPrintManager working in RDS Environnement? Thank you.

PS : We have to use V3, because the supplier using that on his webpage use V3.

Thank you for your help :)

Update Readme: Add 'How to use' section

Hi Neodynamic!

It takes a lot of time to track the demo code to be able to use the package. What if I don't have knowledge in ReactJS ?

I think adding 'How to use' section to the readme file will be useful and will make it easier to the developers to understand how does this package work.

Thanks

can't use in react

I try use JSPrintManager in reactjs app. I just added model using npm then import it import JSPM from 'jsprintmanager' but when I call JSPM.JSPrintManager I get this error
Screen Shot 2022-05-24 at 10 00 41

thank you

Uncaught (in promise) Malformed message. Check if JS version and Desktop version are the same

I'm working in Electron with Vue.js and I get this error
Uncaught (in promise) Malformed message. Check if JS version and Desktop version are the same
when I run the below code:

        var scannerDevices = null;
        var _this = this;
 
        //JSPrintManager WebSocket settings
        JSPM.JSPrintManager.auto_reconnect = true;
        JSPM.JSPrintManager.start();
 
        JSPM.JSPrintManager.WS.onStatusChanged = function () {
            if (jspmWSStatus()) {
                //get scanners
                JSPM.JSPrintManager.getScanners().then( (scannersList) =>{
                    scannerDevices = scannersList;
                    var options = '';
                    for (var i = 0; i < scannerDevices.length; i++) {
                        console.log(scannerDevices[i])
                    }
                    
                });
            }
        };

I've installed the client app and the javascript library by using npm i jsprintmanager which added "jsprintmanager": "^3.0.5", to my package.json . The below image shows the version of the client app I have installed on windows

image

The line with the comment below in PrintManager.js is what throws the error

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } //here
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};

Temp Files Not Removed

Hi,

When i execute "new JSPM.PrintFile("NAME_FILE", JSPM.FileSourceType.URL, 'MyFile.bmp', 1)" a new folder and file are generated on client side (Temp Folder) but aren't never removed.
Is this an issue? Can delete these temps file after the .sendToClient action perform (by the script provided by you)?

Thanks in advice,
Nico

How to start JSPM3 on Linux/Ubuntu 20.04?

Hi folks!

I downloaded the JSPM Client App for Linux and try to use the demo app, restarted my browser and this message keep appearing no matter what browser I'm using

It seems that JSPM Client App is not installed or not running in this machine!

Is there an article, blog post, tutorial or guide to follow for enabling the client app on linux?

Thank you

I wan to print the logo to right

That is what i do but only the text go to right, not the image

`

     JsBarcode(canvas)
          .options({font: "OCR-B"}) // Will affect all barcodes
          .CODE128(this.product.reference, {
              fontSize: 18,
              height: 85,
              marginRight: 0,
          })
          .render();

       this.code128Url = canvas.toDataURL();
       let logo = await escpos.ESCPOSImage.load(this.code128Url);


        var escposCommands = doc
            .align(escpos.TextAlignment.RightJustification)
            .image(logo, escpos.BitmapDensity.D24)
            .feed(1)
            .cut()
            .generateUInt8Array();

        // Set the ESC/POS commands
        cpj.binaryPrinterCommands = escposCommands;

        cpj.sendToClient();

`

Unhandled rejection Malformed message.

after i scan i didn't get data and get some error

Unhandled rejection Malformed message. Error: TypeError: blob.slice(...).arrayBuffer is not a function Message: [object Blob]

Screen Shot 2564-05-11 at 22 58 47

Unstable ClientPrintJobGroup()

Hi,

I am testing JSPM on a POS system where we print bar and print kitchen in one click.
I am using the html2canvas example to render html/css DOM to base64 png and send it to printers with JSPM.ClientPrintJobGroup() at once. It's working but sometimes the outcome text got overlaps (check the attached image). I am sure the image rendered correctly but the print outcome is not good.
I changed the solution to send to each printer separately using JSPM.ClientPrintJob() and it seems working ok for now, not 100% sure though.
4f61263e9a0a66543f1b
Any idea how we can fix this issue? Thanks

Broken JSPrintManager.d.ts

The following Commit broke the JSPrintManager.d.ts completely: e8a93b9

There are export and imports withing the file. No Namespace is beeing declared.

Next.js - ReferenceError: document is not defined

Hello, I am using Next.js and can't manage to load this library to work. It throws two errors:

First (warning):

./node_modules/.pnpm/[email protected]/node_modules/jsprintmanager/JSPrintManager.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

Second (breaking error):

ReferenceError: document is not defined

~/node_modules/.pnpm/[email protected]/node_modules/jsprintmanager/JSPrintManager.js (2:41314)
~/node_modules/.pnpm/[email protected]/node_modules/jsprintmanager/JSPrintManager.js (2:513)
...

I am using [email protected], package is being imported like so: import * as JSPM from 'jsprintmanager'.

Crashes happen with a simple line of JSPM.JSPrintManager.auto_reconnect = true anywhere in the code, so I can't debug it, since it crashes instantly.

Unable to import this module.

Hello, guys!

You published this module on https://www.npmjs.com/
https://www.npmjs.com/package/jsprintmanager

But the downloaded file has no export of the JSPM instance. As I understand, the downloaded module has no access to its functionality.

You should create extra file for npm module, that will contain all the code from JSPrintManager.js and additional row at the end of the file:
module.exports = JSPM;

Or, at least, set your instance in window:
window.JSPM = JSPM;

Is it possible for you to implement this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.