Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2007

Tip: Looking for answers? Try searching our database.

Printable and Books

Thread view: 
Jason Cavett - 10 Oct 2007 15:19 GMT
I am attempting to print from my Java application, and it actually
works very nicely - as long as I only send a single Printable object
to the printer.  However, when I try to add multiple Printable objects
to a Book (so I can send the Book to the printer as one print job),
only the first page of each Printable object is printed.

I found a quote online (and I'm pretty sure that the guy who wrote it
is wrong) that says, if you don't know the number of pages when you
append the Printable object to the Book, do this:

book.append(doc, format, Book.UNKNOWN_NUMBER_OF_PAGES);

...and the PrinterJob will use the implemented print function in your
Printable object to determine the number of pages at the time of the
printing.  This is exactly what I want.  However, every time I do
that, I get an OutOfBoundsException because the Book object can't have
a negative size Vector (UNKNOWN_NUMBER_OF_PAGES = -1).  Soooo...I'm
not sure what to do here.

Does anybody have any suggestions?  (I'm using Java 5.0.)

Thanks
Hunter Gratzner - 10 Oct 2007 20:20 GMT
> I found a quote online (and I'm pretty sure that the guy who wrote it
> is wrong) that says, if you don't know the number of pages when you
> append the Printable object to the Book, do this:
>
> book.append(doc, format, Book.UNKNOWN_NUMBER_OF_PAGES);

Why don't you read the Book API documentation to find out what
append() really does, and what other methods Book provides?
Jason Cavett - 10 Oct 2007 22:16 GMT
> > I found a quote online (and I'm pretty sure that the guy who wrote it
> > is wrong) that says, if you don't know the number of pages when you
[quoted text clipped - 4 lines]
> Why don't you read the Book API documentation to find out what
> append() really does, and what other methods Book provides?

Maybe my question was misstated...

How do I print a lot of pages (when I don't know the number of pages
ahead of time) but only send one job to the printer?


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.