This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
is it possible to use the encoding string in above line.
Joined: Mar 22, 2005
Actually, I misremembered. For printing, not the platform default encoding is used, but US-ASCII. If the file uses a different encoding then you need to specify the charset as part of the MIME type in the DocFlavor. See its javadocs for more detail: javax.print.DocFlavor.
Joined: Oct 08, 2008
While writing the file I used UTF8 encoding and stored the file.
The Print API has methods somewhere that allow you to detect/list all supported flavors. You'll have to use one of the supported ones, obviously. Which ones those are will vary from machine to machine, as it depends on the installed printer drivers and printers.