Catatan Seorang Prajurit Kecil


biarlah semua itu berjalan sesuai "skenario" NYA – jika kau telusuri, semua logika itu akan kau temukan

Java Direct Printing with Countinues Paper

Hi guys,

This article show you how to create direct print with continues paper in Java SE. Direct Print is a term refer that print with line mode, you can find this case in mini market, billing system etc, direct print enable you to print line per line without reload the paper, so you can use continues paper.

In Java, you can use FileWriter object to write text to printer device, in the end of this article I attach the file which show to you how it work. I try that code with EPSON LX-300+ II and it’s running correctly.

Below the step how to write text to printer device:


Define your printer device location. Commonly you can use \\\PRINTERNAME as printer device location. Just remember, you have to share your printer device. Until today I call it’s bug, so if you have fix it, please comment this article and give me reference to fix it. Once again, just remember in java you have to use \\\\\\PRINTERNAME (read java character for more information)


Create FileWriter Object with refer to printer location. For example look at this code: 
FileWriter writer = new FileWriter(“\\\\\\LX300”);
Where LX300 is my printer device name

Write something which you want to write to your printer device. For example:
writer.write(“This will be write to your paper…”);

Basically, with 3 step above, you have successfully write, but sometime, we need more complex character, such as: Carriage Return, Tabulation etc.. In Java you can use character ‘\n’ for carriage return (read Java API Character for more information).

Just an information, my friend have try to use direct print with other program language, it’s Delphi. He said that “in Delphi you cant use ‘\n’ to write the carriage return”

So..please share, if you have any experiment about it..Download source code here.

If you download source code, you will find more complex character and feature to direct print with other resource, such as: from local file, from url file and etc… so try it, share if you have an experiment or question 🙂

Filed under: Algorithm and Programming, ,

12 Responses

  1. djtechno berkata:

    trus cara pakenya pake js / php gimana ya?

  2. ferry berkata:

    mas, saya lagi belajar java.
    fungsi direct print nya sukses, tapi ko lama ya, gak langsung cetak. dari kirim perintah ke printer lumayan lama nunggu nya. gimana caranya ya supaya langsung print g perlu nunggu lama..


  3. eLVIO berkata:

    Hello, who are you? I am very interested in being able to print from java on my lx-300 + II, but I’m getting … I want to help me

  4. Janell berkata:

    Ur posting, “Java Direct Printing with Countinues Paper Catatan Seorang Prajurit Kecil” was worthy of writing a comment on!
    Just needed to state you actually did a great work.
    Thanks ,Geraldine

  5. Shella berkata:

    “Java Direct Printing with Countinues Paper Catatan
    Seorang Prajurit Kecil” in reality got me
    personally addicted with ur website! Iwill certainly wind up being returning considerably more normally.
    Thank you ,Janet

  6. bathing suit berkata:

    I am now not certain where you are getting your information,
    but great topic. I must spend some time studying much more or understanding more.
    Thank you for great information I was in search of this info for
    my mission.

  7. Flossie berkata:

    You have made some good points there. I checked on the web to learn more about
    the issue and found most people will go along with your views on
    this site.

  8. mucasali berkata:

    mas Zulfani, og eror ya mas zulfani,, ni erorrnya
    Exception in thread “main” \dev\usb\lp0 (The system cannot find the path specified)
    at Method)
    at printxt.escp.main(

    saya pake usb printer Epson Lx-310

  9. building muscle berkata:

    It’s actually a great and useful piece of information. I’m
    glad that you shared this useful information with us.
    Please stay us up to date like this. Thank you for sharing.

  10. visit website berkata:

    I all the time emailed this blog post page to all my friends, because
    if like to read it after that my friends will too.

  11. site berkata:

    I don’t know whether it’s just me or if everyone else
    experiencing issues with your site. It appears like some of the text on your content are running off the screen.
    Can someone else please provide feedback and let me know if this is happening to them as well?
    This could be a issue with my internet browser because I’ve had this happen before. Many thanks

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:


You are commenting using your account. Logout /  Ubah )

Foto Google+

You are commenting using your Google+ account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s

%d blogger menyukai ini: