Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
Printing to text printer using html/javascript through browser

We have desktop java swing application which can print some content to a text printer lpt1

try {
      FileWriter out = new FileWriter("lpt1");
      out.write("Hello world");
      out.write(0x0D); // CR
      out.close();
}

Now we have a web version of the same program to run on google chrome which is written in javascript/html/react. Because of browser limitations (security) we can not implement same mechanism. HTML5 File api is not enough for a such task I think. (10 years before it would be probably possible using ActiveX controls)

How can we trigger printing a text document to text printer where the client machine has a printer and a chrome browser is running? I have some possibilites/alternatives, any suggestions are appreciated.

1- Build a native java jar file, which encapculates and wraps a webview (an html renderer), run the html based version in the webview and if native operations such as file needed, communicate with the wrapper jar file and implement file operations as before.

2- Run the web based app, and demand the clients that they run a native jar file at the same time and the jar file opens some sockets etc and listens for localhost. The web application communicates with post requests to the local jar file.

3- Write a chrome plugin or extension which can handle java native file operations? Is it possible? Where can I start?

Note: It is enough for us that the web page runs on chrome only, we can also force to latest chrome builds. Cross browser support or support to old browsers is NOT needed.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!