1
votes

I have used QZ Tray (qz.io) to help me print from the web browser directly to the EPSON LX 310 dot matrix printer and using continuous form to print. For regular printing, it works fine.

However, I would like to have the following:

  1. Changing the font size and the font type. I need to be able to change this because the continuous form used already has templates printed on it. Hence, I needed to adjust the location and the font sizes to fit the template.

  2. How can I print the page so that when it is finished, the paper will come out perfectly on the tear line (i.e. we just need to tear it without pressing the Load / Eject button).

  3. How can I print many pages at once, but each page will fit perfectly (it won't cross the tear line)?

I am open for other recommendations other than qz tray to resolve this.

1

1 Answers

0
votes

I am open for other recommendations other than qz tray to resolve this.

The issues you describe are related to the Epson LX300-series printer, not so much the app you use to print. This printer is specifically designed to print "raw" using one of two language emulations:

  • Epson ESC/P command emulation
  • IBM 2380 Plus/IBM PPDS command emulation

In order to support this printer using raw command sequences, you'll first need to choose a "raw" language, and then you will need to search it's respective command in the manual.

For purposes of answer this question, I'll assume you want to use ESC/P command emulation. I'll also assume you're ok using the "hex" versions of these commands (ESC/P will reference ASCII, Hex and Decimal, but hex is what most QZ Tray "raw" tutorials are written against).

  • Changing the font size

    • The most common is to use double-width and double-height.

      var data = [
         '\0x1B' + '\0x57' + '\0x01' + // Enable double WIDTH printing
         '\0x1B' + '\0x57' + '\0x01' + // Enable double HEIGHT printing
      
         'Your double size text' +
      
         '\0x1B' + '\0x57' + '\0x00' // Disable double WIDTH printing
         '\0x1B' + '\0x57' + '\0x00' // Disable double HEIGHT printing
      ];
      
      // or shorthand
      // '\0x1B\0x57\0x01\0x1B\0x57\0x01' + 'Your double size text' + '\0x1B\0x57\0x00\0x1B\0x57\0x00'
      
    • For printers that support ESC/P2, you may use scalable fonts using ESC X. Due to the complexity of these commands, it is not included in this example.

  • Feed paper to tear line

    Form Feed: Advances the vertical print position on continuous paper to the top-margin position of the next page.

    var data = [
        "\x0C"
    ];
    
  • Prevent pages from crossing the tear line:

    • I believe it's the ESC N documentation which allows you to set a page margin. I've never tried this command, but the syntax is:
    var data = [
        '\x1B' + '\x4E' + 3 // Bottom of page has 3-line margin
    ];
    

In summary, ESC/P is a very efficient and powerful raw printing language, but controlling a document's behavior requires studying the respective command and converting them "raw" commands.

To test some of these commands without a physical printer, Kilgus makes an ESC/P2 emulator called QPCPrint.