aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes problem in printing to file (JSE 6) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "problem in printing to file (JSE 6)" Watch "problem in printing to file (JSE 6)" New topic
Author

problem in printing to file (JSE 6)

Luca Adamo
Greenhorn

Joined: Oct 10, 2009
Posts: 8
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
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10523
    
    9

Strange.
I tried out the example code, and I got an out.prn file successfully created on my desktop.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Luca Adamo
Greenhorn

Joined: Oct 10, 2009
Posts: 8
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
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10523
    
    9

Possibly.
I am on WinXP
 
Consider Paul's rocket mass heater.
 
subject: problem in printing to file (JSE 6)