PrintDialog save to file , as jpeg?
I am using a printdialog to print a jpanels contents , the printing is fine but i'm a little confused about how to go about changing the save to file section of the print dialog. The dialog saves as a .prn file , since a .prn file isnt particularly useful to the end user i'm trying to save it as a .jpeg or .gif.
setting the PrintRequestAttributeSet aset to aset.add(new Destination(new File("test.jpg").toURI())));
only changes the .prn file to .jpeg in name only.
Would encoding the contents of the jpanel to a jpeg then setting the DocFlavor to jpeg fix the save to file part of the printdialog ?
# 1
Well passing a jpeg stream to printerdialog or serviceui doesnt effect the output format as expected :( . Anyone have any example code for overloading the save to file function of ServiceUI ? Seems strange this kind of functionality isnt built it, perhaps i'm missing something.
# 3
Thanks for the reply , but i've already written a component ->buffered image->jpeg converter, the part that i'm having trouble with is overwriting the built in printdialog save to file function , i dont know the names of the functions to overload them nor can i find a place where they are listed. I guess i could make my own printdialog gui but thats just way too much work to just alter the save to file code. Guess i'll just use a seperate jmenu item to launch a save to jpeg method with a filechooser. Though I would like to know if its possible to overload the save to file section of the printdialog.