Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Silent Printing / Print File Directly

 
Jacob Anawalt
Ranch Hand
Posts: 64
Linux Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am interested in having a Print Current Page button in a Print Preview dialog that prints the currently visible page without showing the Printer dialog, similar to the Print File Directly button on some word processors and spread sheet programs.

The Using Print Setup Dialogs page of the Printing Java Tutorial hints that this is possible, but it doesn't say how:

but in sometimes it's possible to print without showing any dialog at all. This type of printing is called silent printing. It may be useful in specific cases


This question sounded similar but I didn't know if I needed to use books and stuff. The simplest method without using a Pageable or Book class would be ideal as I've got a Printable that is aware of the current page and only prints that page as if it were the first and only one.

I've searched around and come up empty handed.

Thanks for your time,
 
Jacob Anawalt
Ranch Hand
Posts: 64
Linux Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've stopped searching for silent printing and started searching for suppressing or hiding the Print Dialog and found answers like this that simply said not to call printDialog on the PrinterJob instance. That works but I don't know if I'm missing out on some important state set up as a side effect of calling that dialog. Is it really this simple?


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!