Comments (8)
It seems monitorAppending(); needs to be called in print(). See print function
below.
function print() {
var applet = document.jZebra;
findPrinter('zebra');
if (applet != null) {
applet.append("^XA");;
applet.append("^FO32,10^AdN,0,0^FWN^FH^FDRECIPIENT COMPANY NAMERECIPIENT COMPANY NAMERECIPIENT COMPANY NAMERECIPIENT COMPANY NAME^FS");
applet.append("^XZ");
}
monitorAppending();
}
Original comment by [email protected]
on 14 Mar 2012 at 6:51
from jzebra.
You have a couple of things going on here. Since Java (or any browser plugin)
can easily deadlock the browser, jZebra was specifically written with all of
its events on a background thread. This is why we check things like
"isDoneFinding()", "isDoneAppending()", and then "isDonePrinting()" as well as
check "getException()".
I've provided basic examples of this with "monitorAppending()", but it's very
basic code, and doesn't leverage some of the newer asynchronous abilities of
jQuery, etc.
- The advantage of this approach is that the browser is responsive and the developer has direct control over the front end.
- The disadvantage is everything must be done asynchronously from the front-end, meaning you need to write code that waits for stuff to happen before you can proceed.
So, if you want to print to two different printers immediately following one
another, you need to write your own "monitorAppending()" that actually waits
until printing is done on the first printer before executing the print command
on the second printer.
A better long term approach would be for me to add a feature that queues events
and execute them in the order they were supplied. This would probably be a
good enhancement write up, but would be an entire re-write of the JavaScript
listener thread, and likely require quite a bit of regression bug testing.
-Tres
Original comment by [email protected]
on 14 Mar 2012 at 8:29
from jzebra.
I'm also facing a similar issue.
I have a dropdown of all the printer a user has and when user selects the
printer it fires the print command to the selected printer. But if user changes
the printer after that, the java console says the new printer was selected, but
it still tries to print on the previous selected printer.
Is there any way can I change to the new selected printer?
Original comment by [email protected]
on 17 Mar 2012 at 9:25
from jzebra.
Ok,
I found out the reason for this issue.
I was printing HTML, so when looking at the src I found this function
[code] private PrintHTML getPrintHTML() {
if (this.printHTML == null) {
this.printHTML = new PrintHTML();
this.printHTML.setPrintParameters(this);
}
return printHTML;
}
[/code]
here this.printHTML.setPrintParameters(this); only set when printHTML in null
so I changed it to
[code]
private PrintHTML getPrintHTML() {
if (this.printHTML == null) {
this.printHTML = new PrintHTML();
}
this.printHTML.setPrintParameters(this);
return printHTML;
}
[/code]
and it resolved the issue for the html print issue.
Original comment by [email protected]
on 17 Mar 2012 at 12:05
from jzebra.
I'm also experiencing a similar issue.
Am using printPDF() to print 2 pdf files to 2 different printers.
Ive createt a javascript queue but even this dosnt work,
Both prints gets sent to the wrong printer even thoug the java console sais
that the correct printer is selectet
Here is a copy from the console:
25.mar.2012 20:13:50 jzebra.LogIt log
INFO: ===== JAVASCRIPT LISTENER THREAD STOPPED =====
25.mar.2012 20:13:50 jzebra.LogIt log
INFO: jZebra 1.3.5
25.mar.2012 20:13:50 jzebra.LogIt log
INFO: ===== JAVASCRIPT LISTENER THREAD STARTED =====
25.mar.2012 20:13:50 jzebra.LogIt log
INFO: Current printer charset encoding: windows-1252
25.mar.2012 20:13:50 jzebra.LogIt log
INFO: ===== SEARCHING FOR PRINTER =====
25.mar.2012 20:13:50 jzebra.LogIt log
INFO: Found 7 attached printers.
25.mar.2012 20:13:50 jzebra.LogIt log
INFO: Printer specified: \Qzebra\E
25.mar.2012 20:13:50 jzebra.LogIt log
WARNING: Printer not found: \Qzebra\E
25.mar.2012 20:13:55 jzebra.LogIt log
INFO: ===== SEARCHING FOR PRINTER =====
25.mar.2012 20:13:55 jzebra.LogIt log
INFO: Found 7 attached printers.
25.mar.2012 20:13:55 jzebra.LogIt log
INFO: Printer specified: \QBrother QL-560\E
25.mar.2012 20:13:55 jzebra.LogIt log
INFO: Printer name match: Brother QL-560
25.mar.2012 20:13:55 jzebra.LogIt log
INFO: Using best match: Brother QL-560
25.mar.2012 20:13:57 jzebra.LogIt log
INFO: Printer set to index: 2, Name: Brother QL-560
25.mar.2012 20:13:57 jzebra.LogIt log
INFO: ===== SENDING DATA TO THE PRINTER =====
25.mar.2012 20:13:57 jzebra.LogIt log
INFO:
<<http://samplepdf.com/sample.pdf>>
25.mar.2012 20:13:57 jzebra.LogIt log
INFO: Using PDF renderer: com.sun.pdfview.PDFFile
25.mar.2012 20:14:05 jzebra.LogIt log
INFO: ===== SEARCHING FOR PRINTER =====
25.mar.2012 20:14:05 jzebra.LogIt log
INFO: Found 7 attached printers.
25.mar.2012 20:14:05 jzebra.LogIt log
INFO: Printer specified: \QXPS\E
25.mar.2012 20:14:05 jzebra.LogIt log
INFO: Printer name match: Microsoft XPS Document Writer
25.mar.2012 20:14:05 jzebra.LogIt log
INFO: Using best match: Microsoft XPS Document Writer
25.mar.2012 20:14:07 jzebra.LogIt log
INFO: Printer set to index: 5, Name: Microsoft XPS Document Writer
25.mar.2012 20:14:07 jzebra.LogIt log
INFO: ===== SENDING DATA TO THE PRINTER =====
25.mar.2012 20:14:07 jzebra.LogIt log
INFO:
<<http://samplepdf.com/sample.pdf>>
Original comment by [email protected]
on 25 Mar 2012 at 6:22
from jzebra.
Original comment by [email protected]
on 30 May 2012 at 1:09
- Changed state: Started
from jzebra.
This should be fixed with version 1.4.0. Confirmation needed.
Original comment by [email protected]
on 7 Jun 2012 at 1:42
from jzebra.
Reported as fixed by Orjan with 1.4.1. Closing, marking as fixed. Feel free
to reopen if this was done in error.
Original comment by [email protected]
on 12 Jun 2012 at 2:31
- Changed state: Fixed
from jzebra.
Related Issues (20)
- ESCP for image append incorrectly using CPCL HOT 2
- Printing a receipt in arabic HOT 4
- Printing on multiple printers HOT 4
- JRE Version 7 Update 25 breaks jZebra 1.4.9 HOT 8
- jzebra applet won't register in asp.net secure webapp HOT 1
- Exception in thread "Thread-28" java.lang.SecurityException: HOT 4
- PDF Size HOT 1
- Print Thai Language to the printer, is show '??????' HOT 4
- Can't print to multiple printers simulatanously HOT 3
- Euro sign does not print in CP869 HOT 10
- Not all jobs are recieved by printer HOT 2
- "applet.findPrinter() is not a function" on Mac OS HOT 2
- Multiple labels printing randomly stop HOT 3
- Unable to print mixed chinese & english character
- Printing problem for mixed english & chines character for intermec 4440 printer HOT 1
- Document not printed oh hp laserjet p1102 HOT 3
- Upgrading jzebra to 1.4.7 or 1.5.6 crashes the webpage HOT 7
- Printer stop randomly HOT 3
- PostScript Always Selects Default Printer, OSX Java 7
- Java security issue that selfsigned sertificates will not work in next JDK release HOT 95
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jzebra.