🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #17096

Re: Anyone out there willing to help?

#17096
From: Ross Dukeshier
Date: Mon, 21 Dec 1998 00:00
131 lines
6272 bytes
>It isn't an off by X problem.  It seems to me that the clipping and/or
>coordinate system is inconsistent with the values returned for the
>imageable properties.  The left and right on my printer have a 0.25"
>non-printable margin.  I have not been able to get output closer than
>0.5" from the left.  I can get output 0.25" from the right side of the
>page.
>


It was just a guess - There may be a mapping problem then.  Did you try the
validatePage method?  If you're pulling defaultPage it doesn't adjust for
your printer.  I think validatePage gets the right information from your
printer...

>Where is the origin in the coordinate system?  At imageableX and y?


I think so.  That's the implication.

>
>There is no firm requirement for a Windows application that prints to
>display a dialog.  When you Press the printer toolbar button in Word,
>it prints the entire current document without a dialog.
>
>I've worked with Windows for years, although not with the print
>dialog.  AFAIK from reading the Win32 documentation, the Windows
>printer dialog does allow you do examine the data that was entered
>upon return.
>
>I don't think Windows failed to do anything, I think Java failed to
>use Windows correctly.  Java must ultimately call the native OS
>functions to print.  Java is responsible for using them correctly.


I thought so too at first until I noticed the dialog that comes up is
identical to Word's.  You're right, if you hit the print button on the
toolbar, I don't think it brings up the dialog.  But, if you use the Print
menu option, it does (at least mine does).  Try it and see what it looks
like...It should look familiar...

>
>
>You send the properties in, so you can check them when getPrintJob
>returns (the function could add properties or modify them).  I don't
>know if it is possible to do what you describe.  In theory, you could
>save the properties and pass them to the getPrintJob function each
>time.  This is probably the bug you mentioned, the function doesn't
>save its state in the properties.  If the mechanism worked, there
>could be a "display dialog" property to bypass the dialog if desired.
>


I don't know what you're referencing when you say you don't know if it's
possible to do what I describe.  Reuse the properties again?  Java docs said
you should be able to.  The PrintJob wasn't necessarily a single PrintJob.
It was basically a connection/format for the printer.  It was supposed to be
able to be reused throughout the run and, if the print dialog saved its
state to the properties, to be set as defaults for the next session...
My guess is the reason the printDialog (and the PrinterJob class in general)
doesn't have a means to return its properties is because they still haven't
gotten around the Windows bug.

>
>Book implements Pageable.  Can't you call setPageable and pass a book
>that you have filled with printables (using Book.append)?  I haven't
>tried this, but it looks like you call either setPageable or
>setPrintable, but not both.  So to print a Book, call setPageable.
>
>I don't think you need to use Pageable at all do you?  Isn't
>Printable.print called until it returns NO_SUCH_PAGE?  I just use
>Printable.
>


Yes.  But it wasn't printing out the second page for me.  Grasping for
reasons since I don't have (detailed) documentation that explains how these
guys are supposed to interrelate.

>
>I needed to import java.awt.* before I could compile.


As Homer would say.....DOH!!!

The cut/paste skipped the first three lines of the source code - the package
statement, and two imports java.awt.* and java.io.* (probably no longer
required as I've changed it so many times).

>
>Your example did print two pages on my machine.


Did the second page have any text on it?  Like a 51 down to 60????  If so, I
wonder what's different between our two machines???

>
>Doesn't this code assume that the imageable area of the page is
>centered on the paper?  On my machine it is not (top != bottom).  You
>might want to use getImageableX and getImageableY.
>      int x = (int) ((pf.getWidth() - pf.getImageableWidth())/2);
>      int y = (int) ((pf.getHeight()-pf.getImageableHeight())/2);
>


Guess I should use my own advice, eh?  You are correct.  I should be using
the getImageableX method and yes, this approach does assume it's centered.
To be honest, I just wanted something to approximate it to get it running at
this point and I think, at the time, wasn't familiar enough with the methods
to remember that one (although I was by the time I responded to yours).

>BTW does your print function get called twice for each page?  That
>also happened in my example.


Yes, it does.  In fact, I've modified it since the version you saw to make
it simply return whether or not the page exists on the first pass and to set
the graphics on the second pass.  It made it so I got the first page and a
blank page like all the other things I've tried.

Please, I beg you, if it printed out two pages on your printer - the first
with 50 lines, the second with 10 lines printed.  Please, respond back to
this message and tell me I'm not insane... It prints only one on mine with a
blank for the second.  I've made it bring up the print Dialog twice now in
the program and run the print() method twice.  When I print page x of x (x
is the same number) it prints that page fine.  When I print that same page
or a different page from then on, blank...

>
>Chris Hill
>hillca@cs.purdue.edu
Technical Details
Message-ID: <75le46$7ov4@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <75i7jh$5gi4@forums.borland.com> <75j357$5ga10@forums.borland.com> <75jciv$6fp4@forums.borland.com> <367d5347.92639278@forums.borland.com> <75kbl4$7921@forums.borland.com> <367df9a6.135230401@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,5cf86e902afbf4b
X-Google-Attributes: gidf74b3,public
From: "Ross Dukeshier" <dukeman@flash.net>
Subject: Re: Anyone out there willing to help?
Date: 1998/12/21
Message-ID: <75le46$7ov4@forums.borland.com>
X-Deja-AN: 424468877
References: <75i7jh$5gi4@forums.borland.com> <75j357$5ga10@forums.borland.com> <75jciv$6fp4@forums.borland.com> <367d5347.92639278@forums.borland.com> <75kbl4$7921@forums.borland.com> <367df9a6.135230401@forums.borland.com>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.language