• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problems in Printing

 
Ambreeen Haleeem
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey I've written this code
try {
DocFlavor txtFlavor = DocFlavor.STRING.TEXT_PLAIN;
String essayPrint;
essayPrint = topic.getText()+" ************ "+essayContent.getText();
Doc essayDoc = new SimpleDoc(essayPrint,txtFlavor,null);
PrintRequestAttributeSet attrib = new HashPrintRequestAttributeSet();
attrib.add(new Copies(1));
attrib.add(MediaSizeName.ISO_A4);
attrib.add(Sides.ONE_SIDED);
PrintService services = PrintServiceLookup.lookupDefaultPrintService();

DocPrintJob job = services.createPrintJob();
job.print(essayDoc, attrib);
}
catch(Exception pe) {
System.out.println(pe);
}

And this code does not work. It gives an error of invalid data flavor. Also the example provided in jdk1.4 givens no output and no error.
I tried both the codes on HP 3325
 
Ambreeen Haleeem
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!