1
How to make the Bematech MP-4200 TH (non-fiscal) printer cut paper at the end of printing in a Java application?
1
How to make the Bematech MP-4200 TH (non-fiscal) printer cut paper at the end of printing in a Java application?
5
Documenting the solution I found.
Caveats: 1.: Avoid mixing printing via DLL with via Spooler, can cause communication failures and generate spurious characters in printing. 2.: the DLL (or my installation) has a bug, the Formatatx command does not accept font 3 (Elite), ignore and print with letter 2 (normal) or 1 (condensed).
Bematech.jar
, but it’s for tax printers, so it doesn’t work on MP-4200 TH. There are reports of the printer working in Java accepting ESC/POS commands if installed with Generic Driver, but with me it didn’t work, so I gave up this approach.System.out.println(System.getProperty("user.dir"))
). It should also work if you copy to C: Windows System32, but I didn’t take the test.If you are using the 64-bit version, change the part of the code that says "mp2032" to "mp2064". Or to make the code support both versions add the following to the interface BematechNFiscal.java
:
public static final boolean IS_64_BIT_JVM =
"64".equals(System.getProperty("sun.arch.data.model"));
public static final BematechNFiscal INSTANCE =
(BematechNFiscal) Native.loadLibrary(IS_64_BIT_JVM ?
"mp2064" : "mp2032", BematechNFiscal.class);
Add to interface BematechNFiscal.java
the following line:
public int AcionaGuilhotina(int tipoDeCorte);
You can now edit the class Principal.java
and call the AcionaGuilhotina(1)
for total cutting or AcionaGuilhotina(0)
for partial cutting.
This is the orientation to use a printer previously installed on the machine. To install the printer you need to install the driver that comes along with the mp2032 or mp2064 package and also with installation instructions (a PDF file). Follow these instructions to install the driver (current version 3.4.0.0). Note that between uninstallations and installations you have to restart the machine.
For the printer to be added to the printer list of the operating system, you need to install the Spooler Driver. It comes bundled with printer drivers under the name Bematech MP4200 TH - Driver Win Bemasetup MP4K x64 V4.2.0.exe.
This last driver I will leave to your charge to find and download, it comes in a package of other 4 or 5 drivers including for Linux. I hope some good soul will come here and complete the information by providing the link.
Browser other questions tagged java printer
You are not signed in. Login or sign up in order to post.