Endorsement Epson TM-h6000IV Java Printing

1.2k views Asked by At

I need to print to an Epson Endorsement TM-h6000iv printer (usb version) with Java. However, I read the manual without hope to find sth can help. I change in printer preferences without hope also! I try with this code of java which TextPrinter class in java for printing work.

Main "Print" function:

    // ----- start printing ------
public int print(Graphics g, PageFormat pf, int pageIndex) {
    double ww, hh, x, y;
    String s;

    pf = PF; // The PF indicates for defaultPage PF= Pj.defaultPage(); 
    GG = (Graphics2D) g;
    s = "Serif";
    GG.setFont(new Font(s, Font.BOLD, Fy));
    GG.setColor(Color.black);
    GFont = GG.getFont();
    FM = GG.getFontMetrics();

    // Insure printing of ONE page
    if (pageIndex != 0)
        return Printable.NO_SUCH_PAGE;

    ww = pf.getImageableWidth();
    hh = pf.getImageableHeight();
    x = pf.getImageableX();
    y = pf.getImageableY();

    GG.translate(x, y);

    int xpos = 0;
    draw(getLine(10), xpos, 5);//getLine to return line of String from 0-9 this line will return "0123456789"
    draw(getLine(20), xpos, 6);//"01234567890123456789"
    draw(getLine(30), xpos, 7); // etc. 
    draw(getLine(40), xpos, 8);

    int x0 = 0, x1 = (int) ww - 10;
    // GG.drawRect(x0, x0, x1, x1);

    // draw Rectangular 
    GG.drawLine(x0, x0, x1, x0);
    GG.drawLine(x0, x0, x0, x1);
    GG.drawLine(x0, x1, x1, x1);
    GG.drawLine(x1, x1, x1, x0);

    return Printable.PAGE_EXISTS;
}

However, the Expected Output Is as in this Image:

enter image description here

BUT, the actual output Is as in this Image:

enter image description here

Which as you can see without Border also some characters not appear! Where is the wrong in my Code I do not know?!

Here you can see The main properties of this printer which "Endorsement" one: enter image description here

Sorry for this Long explanation BUT any help will be appreciated,

1

There are 1 answers

1
Maheera Jazi On BEST ANSWER

Finally, my problem solved after a lot of daily headache!! Just I changed on Epson Printer Slip Setting to [92,68] [Height,Length] ,, Then everything works perfect. Thanks to my God!..