• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

printout from applet varies depending on server

 
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have always run our web app on Tomcat on Windows, but we're trying to move it to Linux. One small but important component of our site is a simple signed applet that allows users to print out 4x6 packing labels on a thermal printer. If the Zebra (or whatever brand) printer driver is installed properly, the label image lines up perfectly.

Everything continues as normal when the web app is running on a Linux box in our internal/private network, but when the server is our new production Linux server (which is sitting outside our internal network), the image that gets pulled down by the applet is half an inch too far to the right. The code is the same, the Tomcat startup parameters telling it to start headless are the same, the version of Enterprise Red Hat is the same...what could be causing this difference?

I know I'm reaching here, but does it have anything to do with SSL or the applet being signed or something like that? Obviously right now, we don't access that new production machine by DNS name yet--we just hit it by its public IP address (which goes through a BigIP load balancer). I just need to know what in the world to look for!

Thanks...
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I really doubt that network settings are affecting your print parameters. What happens if you print a test label on both systems? If you see the same problem, the issue is your setup, not your applet. If a test print job goes fine, I'd first check that the java API versions are identical. Lots of minor bugs, like those regarding layout, get fixed between API versions. Next, I'd check that both servers are patched to the same level (I know RedHat makes updating easy, so if one box has been around longer they may be out of sync). If that fails, try duplicating the behavior in a small test program (i.e. print and image and some text) and submit it to the Swing forum.
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For an applet, I would have thought that the only version of Java that mattered was the one on the client browser's machine, not the server. The PrintApplet.jar file was last compiled on Feb 7, 2003 (as far as I know, it was probably compiled on a Windows box). The has been used to print 200,000+ labels in the past year or so (on a few thousand client machines).

Currently, when the server is either the current production Windows one, our dev Windows one, or our dev Linux one, the client browser that loads the applet and prints to a thermal printer has no trouble. But when the webserver is the new Linux one that's outside of our internal network (that we access by public IP), only the left 3 inches of the label is printed, and it's centered on the 4-inch wide label (whereas the typical/correct behavior is for the printer to left-justify it and the image ends up filling the entire width of the label). This happens even though we're sitting at the same client machine/browser/printer when we test all the 4 different servers that send the applet down to our browser. Very strange.

I'm going to try to see if I can figure out how to recompile the applet source on the Linux server in the way it's supposed to be packaged, but if that's the difference, then I guess write-once-run-anywhere won't apply in this case.
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In case anyone is reading this, I haven't actually figured out the total solution, but the problem with the above was that we were trying to print from Firefox 0.9.2 (with a 1.4.2 JRE). When we switched to a different machine and printed with IE 6 (and a similar JRE), it printed normally.

This still doesn't make sense because this same Firefox browser can print labels downloaded by the applet from the current Windows server or our dev Linux server, but it messes up when it's our soon-to-be-production Linux server, and I frankly don't see how Firefox would react differently to a print job requested by an applet downloaded from a different server when IE 6 wouldn't.

The applet is *really* simple, and the relevant code that has ANYTHING to do with sizing of the image (there's nothing at all that mentions starting position or anything related to placement) is down below:

 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Disregard what I was saying. I assumed you were printing on the server side. You are correct when you say that the server VM should not matter, as it is the client side VM which is running the applet.
As for a possible difference between IE and Firefox, Firefox uses the Sun java runtime by default. IE uses Microsoft's VM by default.
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
True true...very true...our support folks spend countless hours explaining to people how to install Sun's JRE from java.com even though the instructions are posted on our website! Our applet, although relatively simple, still does not work unless you have Sun's JVM.

The point is, my IE 6 should thus have to use a Sun Java plug-in to run the applet (just like Firefox). This is weird.
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any chance that there's more than one Sun VM on your test computer? Check the Java Control Panel of the latest VM and make sure it's set to be the default for both browsers.
 
reply
    Bookmark Topic Watch Topic
  • New Topic