• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

problem in printing to file (JSE 6)  RSS feed

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I tried using printing support in JTextComponent, as provided in Java SE 6.

The code I used is really simple:


I actually took this from a tutorial (http://java.sun.com/docs/books/tutorial/uiswing/misc/printtext.html)

This works fine if I print to an actual printer (on paper :P ): a dialog is shown I can choose options etc. But if i choose the provided option of printing to file it doesn't work: i can choose the directory and the name for the file, it looks like everything is working fine but no file is created. No exception is thrown and the print method return true.
Anyone tried using this method to print?
Thanks
 
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Strange.
I tried out the example code, and I got an out.prn file successfully created on my desktop.
 
Luca Adamo
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for you answer!
I think I'm supposed to get a ps file, since the default name is out.ps. Maybe that's beacause I'm working on a mac... What are you using?
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Possibly.
I am on WinXP
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!