Image

Imageerikwilson wrote in Imagejava_dev

Simple Print job

I'm looking for a simple way to create a print job from a string and send it to the default printer. The closest i've gotten is this...

try
{
SimpleDoc printDoc = new SimpleDoc("Happyness is me", new DocFlavor("text/plain","java.lang.String"), null);
PrintServiceLookup.lookupDefaultPrintService().createPrintJob().print(printDoc,null);
}
catch(Exception noPrint)
{System.out.println(noPrint);}

It is yelling at me saying the DocFlavor is not vailid.

There should be a simple way of doing this, but all the online tutorials talk about page formatting or adding graphics...

Thanks.