Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4084038

Win32 printing: Frequent crashes, page scaled down

XMLWordPrintable

    • b01
    • generic, x86, sparc
    • generic, solaris_2.5.1, windows_95, windows_nt
    • Not verified

        Attempting to print in Windows/NT results in a printed image that is about
        2/3 the size it should be, and results in frequent crashes. For example,
        printing a trivial text document with HotJava 1.1:

            <html>
            <head></head>
            <body>This is a minimal HTML file</body>
            </html>

        The printed image is too small (the page footer is only 2/3 of the way
        down the page). Printing works fine under Solaris.

        Under Windows '95, it's much worse. It looks like everything is set in
        0.5-point type: What might be the entire page (if viewed under a microscope)
        fits in an area 10mm x 5mm, on those rare occasions when the VM doesn't
        crash entirely. I have seen some VM crashes on printing under NT, but they
        are fairly rare. I just saw a crash printing
        http://javaweb.eng/~billf/bugs/table.html (after running HotJava for five or
        so minutes, and printing a few other things before). The error was the infamous
        "The instruction at address 0xfaslfkjas attempted to access memory location
        0xadjfaksjf. That address could not be 'read'" (yes, those are made-up
        "numbers" :-). Printing the same page from a fresh launch worked OK,
        unfortunately.

        Under Windows '95, I've seen some erratic behavior: Once, the header and
        footer were about 25% of their correct size, and the page contents
        were about 2% of their correct size. In HotJava, about the only difference
        between the two is that there's a clipping region in effect for the page
        contents, and the header and footer are printed after the contents.
        From the outside, it "feels" like a pointer to a struct in a Win32
        call is pointing to random memory.

        ===========================================================================
        Another report of this problem, sheri.good@Eng 1998-02-12:

        I'm using the HotJava HTML Component Version
        1.1.2 and it will not print properly on my
        system. I've got NT4.0 SP3 and I'm printing to
        a HP4 Si MX PS with the corresponding print
        drivers. JDK 1.1.5 is installed. I run the
        included code and when I print from any page, all
        I get on paper is the TITLE tag of the web page
        halfway down the page and to the right followed
        by the beginning of the url for that page.
        (e.g. "HotJava Browser Components file:/" for
        the index.html page that comes with the HotJava
        HTML bean). Then about a centimeter lower in the
        horzontal center of the page is the page number.
        Multiple pages are printed, all with the same
        content and sequential page numbers. In the
        case of the index.html document four pages are
        printed, even though only 2 or 3 would be needed
        when printing from NS or IE.

        Also,
        When I print the index.html page that comes with
        the Java Bean I get an unhandled access error
        exception in WINAWT.DLL. However, the entire
        document has printed (with the problems described
        above).

        Both of these problems existed in version 1.1.1
        of the bean. I remember experimenting with a 1.0
        version, and it printed, but formatted differently
        on the printed page than the on screen page.


        -- CODE ----------------------------------------
        import java.awt.*;
        import java.awt.event.*;

        import sunw.hotjava.bean.*;

        public class TestPrinting
        {
        private HotJavaBrowserBean bean_;
        private HotJavaDocumentStack docStack_;

        private Button backButton_, printButton_, closeButton_;

        public static void main(String[] argv)
        {
        if(argv.length == 0)
        {
        System.out.println("");
        System.out.println("\tUsage: java TestPrinting url");
        System.out.println("");
        System.exit(-1);
        }
        new TestPrinting(argv[0]);
        }

        public TestPrinting(String url)
        {
        Frame f = new Frame("Test1");
        f.setLayout(new BorderLayout());

        bean_ = new HotJavaBrowserBean();
        docStack_ = new HotJavaDocumentStack();

        docStack_.addBrowserHistoryListener(bean_);

        Panel p = new Panel();
        p.setLayout(new GridLayout(1, 0, 10, 5));
        backButton_ = new Button("Back");
        p.add(backButton_);
        printButton_ = new Button("Print");
        p.add(printButton_);
        closeButton_ = new Button("Close");
        p.add(closeButton_);

        backButton_.addActionListener(new BackHandler());
        printButton_.addActionListener(new PrintHandler());
        closeButton_.addActionListener(new CloseHandler());

        Panel p2 = new Panel();
        p2.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 5));
        p2.add(p);

        f.add("North", p2);
        f.add("Center", bean_);

        f.setSize(550, 700);
        f.setVisible(true);

        bean_.setDocumentString(url);

        }

        class PrintHandler implements ActionListener
        {
        public void actionPerformed(ActionEvent evt)
        {
        bean_.print();
        }
        }


        class BackHandler implements ActionListener
        {
        public void actionPerformed(ActionEvent evt)
        {
        System.out.println("Back pressed");
        docStack_.previousDocument();
        }
        }

        class CloseHandler implements ActionListener
        {
        public void actionPerformed(ActionEvent evt)
        {
        System.exit(0);
        }
        }
        }
        ===========================================================================
        Another report of this problem, sheri.good@Eng 1998-03-12:

        I have been unable to print on Windows from the hotjava html component.
        It prints junk to the printer.
        I did a little more testing. Here is something else interesting:
        If I switch my printer to landscape mode and print the same page as I
        described in my last email then then I get a different behavior:
        It prints at a better X - direction Scale (Probably still a little scaled
        down) , BUT it prints only a tiny bit on the page.
        The web site I was printing for the test is:
        http://www.imaginon.com (other sites seem to behave the same way).
        If you look at that site, there is a logo gif at the top, then a gif of a
        line.
        It took 5 pages, in landscape mode, to get to and print only through the line.
        It seemed to slice the webpage into small horizontal slices.

              dmendenhsunw David Mendenhall (Inactive)
              bfootesunw Bill Foote (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: