Text Printing Upside Down

K

KenH

I have an applet that creates a chart on a webpage and lets the user
print the chart directly from the applet (printing from the browser
gives you alot of things you don't want).

My problem is when I print using LANDSCAPE all the text appears upside
down (rotated 180 degrees...pivoted perfectly around the lower left
corner of the text). The text on the screen appears as it should, as
does all the graphics.

When I print using PORTRAIT *most* of the text appears ok. What I mean
by that is the text that hasn't been rotated on screen using the
AffineTransform appears perfectly when printed. Text that was rotated
(units label for the y-axis, x-axis labels, etc.) is rotated 180
degrees from what it should be.

I'm using build 1.6.0-b105, but I compile the classes using javac
[classfile] -source 1.5 -target 1.5

The funny thing is it use to work perfectly. Is it something with the
build?

Ken
 
O

Oliver Wong

KenH said:
I have an applet that creates a chart on a webpage and lets the user
print the chart directly from the applet (printing from the browser
gives you alot of things you don't want).

My problem is when I print using LANDSCAPE all the text appears upside
down (rotated 180 degrees...pivoted perfectly around the lower left
corner of the text). The text on the screen appears as it should, as
does all the graphics.

When I print using PORTRAIT *most* of the text appears ok. What I mean
by that is the text that hasn't been rotated on screen using the
AffineTransform appears perfectly when printed. Text that was rotated
(units label for the y-axis, x-axis labels, etc.) is rotated 180
degrees from what it should be.

I'm using build 1.6.0-b105, but I compile the classes using javac
[classfile] -source 1.5 -target 1.5

The funny thing is it use to work perfectly. Is it something with the
build?

Can you post an SSCCE demonstrating the problem?
(http://homepage1.nifty.com/algafield/sscce.html)

If you can reproduce it in an application instead of an applet, make
it an application instead. Perhaps have the application just print out 1
rotate text, "Hello World!", letting us see it render itself upside down
when printed out. Make sure there's an assymetric background (perhaps an
isosceles triangle or something), so we know which side is "up" on the
sheet of paper.

- Oliver
 
K

KenH

I have an applet that creates a chart on a webpage and lets the user
print the chart directly from the applet (printing from the browser
gives you alot of things you don't want).
My problem is when I print using LANDSCAPE all the text appears upside
down (rotated 180 degrees...pivoted perfectly around the lower left
corner of the text). The text on the screen appears as it should, as
does all the graphics.
When I print using PORTRAIT *most* of the text appears ok. What I mean
by that is the text that hasn't been rotated on screen using the
AffineTransform appears perfectly when printed. Text that was rotated
(units label for the y-axis, x-axis labels, etc.) is rotated 180
degrees from what it should be.
I'm using build 1.6.0-b105, but I compile the classes using javac
[classfile] -source 1.5 -target 1.5
The funny thing is it use to work perfectly. Is it something with the
build?

Can you post an SSCCE demonstrating the problem?
(http://homepage1.nifty.com/algafield/sscce.html)

If you can reproduce it in an application instead of an applet, make
it an application instead. Perhaps have the application just print out 1
rotate text, "Hello World!", letting us see it render itself upside down
when printed out. Make sure there's an assymetric background (perhaps an
isosceles triangle or something), so we know which side is "up" on the
sheet of paper.

- Oliver- Hide quoted text -

- Show quoted text -

Well, triming this thing down to something that could be posted would
be a job in itself and I'm not sure what that would show. Besides, I
am resonably sure the problem is not in my code. As I said, the print
feature was working correctly once and the screen still displays
perfectly. All the print class does is paint the componentToBePrinted
to the printer.

I'm thinking it's a bug in the Java build I'm using (I read somewhere
this bug resurfaced in build 1.4.1 after being fixed in 1.2), and that
*maybe* somebody knows of a workaround.

But you do give me an idea of testing Java applet examples that come
in the SDK. Let me see if I can find one.

Ken
 
O

Oliver Wong

KenH said:
KenH said:
My problem is when I print using LANDSCAPE all the text appears
upside
down
[...]
Can you post an SSCCE demonstrating the problem?
(http://homepage1.nifty.com/algafield/sscce.html)
[...]

Well, triming this thing down to something that could be posted would
be a job in itself and I'm not sure what that would show.

It would allow me to try all sorts of things with the code as opposed
to asking a question, waiting for you to respond, asking a second question
based on this new information, waiting for you to respond, etc.

Compare the difficulty of programming by direclty typing code into a
computer and programming by telling someone over the telephone what to
type in.
Besides, I
am resonably sure the problem is not in my code. [...]

I'm thinking it's a bug in the Java build I'm using (I read somewhere
this bug resurfaced in build 1.4.1 after being fixed in 1.2), and that
*maybe* somebody knows of a workaround.

All the more reason to produce an SSCCE; including the SSCCE in the
bug report to Sun will increase the speed with which they can fix the bug.

- Oliver
 
A

a24900

Well, triming this thing down to something that could be posted would
be a job in itself and I'm not sure what that would show.

Oh, it would maybe show a bug in your code.
Besides, I
am resonably sure the problem is not in my code.

Famous last words.
 
L

Luc The Perverse

KenH said:
I'm thinking it's a bug in the Java build I'm using (I read somewhere
this bug resurfaced in build 1.4.1 after being fixed in 1.2), and that
*maybe* somebody knows of a workaround.

It is more likely a bug in your code ;)

You can try recompiling with a higher version or lower version and see if
the problem disappears. When it doesn't, you'll be convinced.

I take my old CS teacher's advice. She taught everything from beginning
classes to advanced algorithms, graphics. She would have students all the
time come to her and say they had found compiler/runtime bugs - probably 300
times. In all that time, only one of those turned out to be accurate - and
come to find out they were using a component in a way it was not intended
anyway - so it may not have even been a bug at all!

It's not that bugs don't appear - it's that if people's text were being
consistantly turned upside down and no one was bothering to fix it - then it
would be a huge issue - everyone would have heard about it. This has not
happened.
 
A

Andrew Thompson

KenH said:
I have an applet that creates a chart on a webpage and lets the user
print the chart directly from the applet (printing from the browser
gives you alot of things you don't want).

Unles you define a print stylesheet that hides
everything but the applet. (Which would probably
be both easier, and the more standard way to do
this).

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200704/1
 
K

KenH

It is more likely a bug in your code ;)

You can try recompiling with a higher version or lower version and see if
the problem disappears. When it doesn't, you'll be convinced.

I take my old CS teacher's advice. She taught everything from beginning
classes to advanced algorithms, graphics. She would have students all the
time come to her and say they had found compiler/runtime bugs - probably 300
times. In all that time, only one of those turned out to be accurate - and
come to find out they were using a component in a way it was not intended
anyway - so it may not have even been a bug at all!

It's not that bugs don't appear - it's that if people's text were being
consistantly turned upside down and no one was bothering to fix it - then it
would be a huge issue - everyone would have heard about it. This has not
happened.

Yes, yes, yes. I hear what you guys are saying. If I had a dime for
every time *I* said, "...but it shouldn't do that!" only to find out
that I put a bug in there that told it to do that, I'd be richer than
Bill Gates.

But here is why I stubbornly cling to the "not MY code!" reasoning:

1. The chart displays on the screen perfectly
2. Only LANDSCAPE is completely screwed up textwise
3. The same print routine that draws LANDSCAPE draws PORTRAIT and
PORTRAIT draws *almost* perfectly
4. All I do to switch between LANDSCAPE & PORTRAIT is check one
parameter passed to the class and do a
pf.setOrientation(PageFormat.PORTRAIT) or
pf.setOrientation(PageFormat.LANDSCAPE) accordingly
5. Each text string is rotated 180 deg (pivoting around the lower left
corner) and I don't transform anything 180 deg
6. It once worked correctly (I last printed something a couple months
ago), and I haven't touched the print class in over a year
7. I'm using build 1.6.0-b105 so it might be a new bug that no one has
seen yet because no one uses this build (don't know why the hell I
decided to...)


I'm not trying to NOT provide you with my code, but this applet is not
trivial...it's got a lot of moving parts. And debugging Java code over
the last few years has taught me to look at the most likely cause
first and work my way out. Not put a magnifying glass on code I
haven't touched in months or years.

I've actually got a trival piece of code that graphs text & lines and
prints, but, of course, it doesn't flip anything...sigh...

I'm trying to build that up to where it breaks but no deal yet. I'll
put something up if and when it does cause this is buging the hell out
of me.

Ken
 
L

Lew

KenH said:
Yes, yes, yes. I hear what you guys are saying. If I had a dime for
every time *I* said, "...but it shouldn't do that!" only to find out
that I put a bug in there that told it to do that, I'd be richer than
Bill Gates.

Before the program is written, to the programmer nothing is impossible. After
it's written, to many things the program actually does the programmer
declares, "That's impossible!"

I'm betting that the problem is in your code, not in the platform.

Simplifying it to make an SSCCE will reveal the problem to you before you can
post again. Until then, don't bother asking.
 
A

Andrew Thompson

KenH wrote:
...
I'm not trying to NOT provide you with my code, but this applet is not
trivial...

As far as I can see, nobody has asked for *your* code,
or the code of *the* applet, but simply any (short, self
contained and compilable) code that is an example of
this 'bug'.

Did you actually read the SSCCE document?

I still recommend a print stylesheet over this
nonsense. In addition to that, I will thrown in
that if you (alternately) launch the applet using
JWS - it is possible to constrain the choice of
JVM - to any JVM that seems to work.

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200704/1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top