Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8960623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:42:02+00:00 2026-06-15T15:42:02+00:00

What i have so far is the following code: FileInputStream fin =new FileInputStream(filename); DocFlavor

  • 0

What i have so far is the following code:

 FileInputStream fin =new FileInputStream(filename);
 DocFlavor df = DocFlavor.INPUT_STREAM.AUTOSENSE;                    
 Doc d = new SimpleDoc(fin, df, null);   
 PrintService P = PrintServiceLookup.lookupDefaultPrintService();

  if (P != null) {              
     DocPrintJob job = P.createPrintJob();  
     job.print(d, null);  
            }
    fin.close;

the code is working fine but the printer does’t interpret the commands if the file containing commands, it keep printing the exact string content of the file.
so how to send command to Epson receipt printer ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:42:03+00:00Added an answer on June 15, 2026 at 3:42 pm

    As have been figured out that commands may have to be send directly not in ESC/POS format but you need to interpret the code to hexadecimal in you java code and send to printer as the way i post, whether from a file or string.
    as example instead of initializing the Epson receipt printer by:

      PRINT #1, CHR$(&H1B);"@";
    

    and to cut the paper in receipt printer the code may be:

      PRINT #1, CHR$(&H1D);"V";CHR$(1);
    

    so this is how it works for me.

        char[] initEP = new char[]{0x1b, '@'};
        char[] cutP = new char[]{0x1d,'V',1};
        String Ptxt=  new String(initEP)+ " text data \n \n \n"+ new String(cutP);
    

    instead of

        Doc d = new SimpleDoc(new FileInputStream(filename), df, null);  
    

    use

        InputStream pis = new ByteArrayInputStream(Ptxt.getBytes());
        Doc d = new SimpleDoc(pis, df, null);
    

    however it maybe a way to send code as its command format but desperately could’t do that so far. and not sure if it can done from java.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to following code and as far as I know it is correct,
So far i have the following code, but it doesn't seem to be working,
I have a Spring validator that contains the following code. errors.rejectValue(myFieldName, errors.required, new Object[]
I've consulted a similar thread to the following code that I have so far.
So far I have the following code: colors = ('k','r','b') ax = [] for
I have the following code in C#: Console.WriteLine(Connecting to server...); TcpClient client = new
Hello this is may first question and I have found so far the following
Basically, I have the following so far: class Foo { public override bool Equals(object
I have the following query so far, which works perfectly to rank the books
This is what I have as far as code, it is in the first

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.