• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Silent Printing / Print File Directly

 
Ranch Hand
Posts: 64
Netbeans IDE Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?


 
Your buns are mine! But you can have this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic