J
Jason Cavett
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
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