neodynamic / jsprintmanager Goto Github PK
View Code? Open in Web Editor NEWAdvanced Client-side Printing & Scanning Solution for Javascript
Home Page: https://www.neodynamic.com/products/printing/js-print-manager/
Advanced Client-side Printing & Scanning Solution for Javascript
Home Page: https://www.neodynamic.com/products/printing/js-print-manager/
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?
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
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 {
...
}
This dialog comes right after confirming the evaluation dialog. (see below)
Is there a way to get the number of pages from the myFile
object?
Thank you!
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
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 ?
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
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.
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.
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
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.
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
JSPrintManager/scripts/JSPrintManager.js
Line 1240 in 880d111
JSPM.JSPrintManager.showAbout()
.
Is there any reliable way to get mismatch between Lib JS version and desktop version?
hello ..
i'm using the source code in this article https://www.neodynamic.com/articles/Print-HTML-from-Javascript-to-client-printer-without-print-dialog-silently/
but the print outcome is not good. it is very very small can you help me ??
We obtained a license for JSPMv4 (we already have v2 license) in order to allow our users to print from out app in MacOS.
The problem is that in Safari the web socket connection (wss://
on port 24443) is rejected with a message saying that certificates are invalid for localhost.
We got the same error on demo page https://jsprintmanager.azurewebsites.net/
Hi,
I'd like to know how to open the client desktop app from the browser ? Is it possible ?
Thanks.
Hello, how can I configure the character selection code table in the esc/pos printer?
I am trying this
cmds += esc + '\x74 \x32'
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.
When I scaning on first time it worked but i click scan again it's not working.i found same issue on https://jsprintmanager.azurewebsites.net/
Issue is Scanner still working after scanned on first name
When Reload site, the application JSprinterManager Stuck.
I have the 4.0.22.408 version.
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:
Thanks in advance
This is open source?, i mean i see in the neodynamic web page this, so i have to buy JSPrintManager to a production web page or not?
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.
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 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?
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?
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
Try to print the pdf file 1.67 MB file instead of printing I have saved as PDF then I can see the file has been increased to 52MB PDF file .
In case of Printing also it will take time, Want to know how to resolve this performance issue?
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
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?
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.
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
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
I got this pop msg when I was testing via https://jsprintmanager.azurewebsites.net/
We would like users to be able to print without being prompted.
Is there a setting which can be set using group policy on Win10 machines to prevent this pop up?
While importing jsprintmanager
as shown in #48, I receive a critical dependency warning:
EDIT: Issue persists on v5.0.2
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 :)
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
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
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());
});
};
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
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
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();
`
When i scanner first time it worked but i click scan again it's not working.
i found same issue on https://jsprintmanager.azurewebsites.net/
i think printer still running after scanned
I dont know it's relate about printer model?
My printer is Brother MFC-T810W
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.
Any idea how we can fix this issue? Thanks
The following Commit broke the JSPrintManager.d.ts completely: e8a93b9
There are export and imports withing the file. No Namespace is beeing declared.
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.
I see your application is in some JS framework,
I want to do it in pure javascript.
Any help will be appreciated.
Thanks
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.