Text Printing Upside Down

Discussion in 'Java' started by KenH, Apr 10, 2007.

  1. KenH

    KenH Guest

    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
     
    KenH, Apr 10, 2007
    #1
    1. Advertising

  2. KenH

    Oliver Wong Guest

    "KenH" <> wrote in message
    news:...
    >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
     
    Oliver Wong, Apr 10, 2007
    #2
    1. Advertising

  3. KenH

    KenH Guest

    On Apr 10, 10:26 am, "Oliver Wong" <> wrote:
    > "KenH" <> wrote in message
    >
    > news:...
    >
    >
    >
    >
    >
    > >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
     
    KenH, Apr 10, 2007
    #3
  4. KenH

    Oliver Wong Guest

    "KenH" <> wrote in message
    news:...
    > On Apr 10, 10:26 am, "Oliver Wong" <> wrote:
    >> "KenH" <> wrote in message
    >> > 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
     
    Oliver Wong, Apr 10, 2007
    #4
  5. KenH

    Guest

    On Apr 10, 8:29 pm, "KenH" <> wrote:
    > 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.
     
    , Apr 10, 2007
    #5
  6. "KenH" <> wrote in message
    news:...
    > 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.

    --
    LTP

    :)
     
    Luc The Perverse, Apr 10, 2007
    #6
  7. KenH wrote:
    >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
     
    Andrew Thompson, Apr 11, 2007
    #7
  8. KenH

    KenH Guest

    On Apr 10, 1:18 pm, "Luc The Perverse"
    <> wrote:
    > "KenH" <> wrote in message
    >
    > news:...
    >
    > > 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.
    >
    > --
    > LTP
    >
    > :)


    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
     
    KenH, Apr 11, 2007
    #8
  9. KenH

    Lew Guest

    KenH wrote:
    > 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.

    --
    Lew
     
    Lew, Apr 11, 2007
    #9
  10. 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
     
    Andrew Thompson, Apr 11, 2007
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon B
    Replies:
    7
    Views:
    7,613
    =?Utf-8?B?SmFzb25DaG9p?=
    Jan 30, 2006
  2. RC
    Replies:
    2
    Views:
    590
    Rogan Dawes
    Feb 22, 2007
  3. Stefan Ram
    Replies:
    1
    Views:
    404
    Arne Vajhøj
    Feb 14, 2009
  4. jc_usernet

    Upside down font with graphics

    jc_usernet, Dec 5, 2009, in forum: Java
    Replies:
    3
    Views:
    1,674
    Roedy Green
    Dec 8, 2009
  5. Chris Metcalfe

    Ruby .read image upside down?

    Chris Metcalfe, May 29, 2008, in forum: Ruby
    Replies:
    3
    Views:
    136
    Chris Metcalfe
    Jun 11, 2008
Loading...

Share This Page