Coder Social home page Coder Social logo

Changing printer about jzebra HOT 8 CLOSED

igwtech avatar igwtech commented on September 15, 2024
Changing printer

from jzebra.

Comments (8)

GoogleCodeExporter avatar GoogleCodeExporter commented on September 15, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 15, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 15, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 15, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 15, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 15, 2024

Original comment by [email protected] on 30 May 2012 at 1:09

  • Changed state: Started

from jzebra.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 15, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 15, 2024
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)

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.