B4J Question [Server] Print Options on Linux, Mac, Windows

AHilton

Active Member
Licensed User
Longtime User
I'm looking into B4J as a replacement for a server I've had running for many years now. I've deployed some B4J servers since it was introduced but none that needed to print. What are my options?

1. It needs to be a server (ie No UI).
2. It will be run on Linux, Mac and Windows machines.
3. It'll need to print from the server. Not send back to a client to print.

The options I've seen (please correct me if I'm wrong here) ...

A. PrintHTML. Problem: #2 above. Windows Only. Anything similar for Linux and Mac?
B. JavaFX8. Problem: #1 above. No UI. I have to have UI Nodes to print, right?
C. A companion B4J UI application that just acts as a print server... polling the B4J Server application for print jobs to print for it. I really hate this solution but it's the only thing I can think of right now.
 

AHilton

Active Member
Licensed User
Longtime User
Thank, Enrique. I'll look into if that'll work for my requirements above. Unfortunately, it won't work with another requirement, which is printing to the majority of label printers this will be used with.
 
Upvote 0

EnriqueGonzalez

Expert
Licensed User
Longtime User
Hello nadhiras!

Java is so ... painful, i do understand you.

Attached is an example project on how to print a PDF, i took the code from here (because the other one required an special library):
http://www.coderanch.com/t/410208/java/java/java-printing-printing-pdf

There is a special warning with this approach, the printer must understand PDF "language" if not it will print only rubbish. I tested with mine and it was fine (an HP)

Another good solution is that if you have a Acrobat Reader, you can use it with command line to print the PDF.
http://stackoverflow.com/questions/619158/adobe-reader-command-line-reference

I hope this helps you!
 

Attachments

  • printPDF.zip
    1.3 KB · Views: 294
Upvote 0

jjmairena

Member
Licensed User
Longtime User
Our company was forced to create these two files one is for direct printing dot matrix and the other opens dialog dialog printing these work in linux mac and windows

Example of what the object is called

1. params2.AddAll( Array As String( "-jar", File.DirApp & "/LinePrinter.jar", Chr(34) & ta.Text & Chr(34)))
2.params2.AddAll( Array As String( "-cp", "./LinePrinter.jar", "LinePrinter" , ta.Text ))
 

Attachments

  • LinePrinter.jar
    4.4 KB · Views: 275
  • PrintText.jar
    3.6 KB · Views: 285
Upvote 0
Top