(epson tm-t20ii) print multiple html files with qz-print

I tried to print multiple html files in folder with qz-print and EPSON – TM-T20II, but seem no work.

This is an example of script that i used:

    function printPages() {
if (notReady()) {
  return;
}

qz.appendHTMLFile(getPath() + "misc/out-may-21.html");
qz.appendHTMLFile(getPath() + "misc/out-may-22.html");


while (!qz.isDoneAppending()) {
  qz.printHTML();
}

but it will only print “out-may-22.html” file.
– And one more problem, when printing html file, it print html file, then print one more text file with tag “”.

So confused,
thanks.


Source: html

1 Comment

  1. Edwin

    The function qz.appendHTMLFile(“…”); is not synchronous and cannot currently be called in succession.

    Instead, you’ll have to wait until qzDoneAppending() is called, then call printHTML(), then call qz.appendHTMLFile(“…”); again, etc.

    script>

    // Called automatically when the software has loaded
    function qzReady() {
    qz.findPrinter("epson");
    }

    // Called automatically when the software has finished searching for the printer
    function qzDoneFinding() {
    // append first file
    qz.appendHTMLFile("first.html");
    }

    var secondHasAppended= false;

    // Called automatically when a file is done appending
    function qzDoneAppending() {
    qz.print();
    }

    // Called automatically when document has been sent to the printer
    function qzDonePrinting() {
    if (!secondHasAppended) {
    qz.appendHTMLFile("second.html");
    secondHasAppended = true;
    // qzDoneAppending and qzDonePrinting will take care of the rest
    } else {
    alert("Done!");
    }
    }

    If you require more than two documents, replace the boolean with a counter.

    Reply

Leave a Reply