• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Emergency javax.print question ---- who can help me?? thank in advance.

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm working with the JDK 1.4.2_01-b02 on XP. I try to print out my log
file.
Here is my printer's return information:
image/gif; image; [B
image/gif; image; java.io.InputStream
image/gif; image; java.net.URL
image/jpeg; image; [B
image/jpeg; image; java.io.InputStream
image/jpeg; image; java.net.URL
image/png; image; [B
image/png; image; java.io.InputStream
image/png; image; java.net.URL
application/x-java-jvm-local-objectref; application;
java.awt.print.Pageable
application/x-java-jvm-local-objectref; application;
java.awt.print.Printable
application/octet-stream; application; [B
application/octet-stream; application; java.net.URL
application/octet-stream; application; java.io.InputStream
Here is my code:
try {
FileInputStream textStream = new FileInputStream("C:/my.log");
DocFlavor textInFormat = DocFlavor.INPUT_STREAM.AUTOSENSE;
Doc textDoc = new SimpleDoc(textStream, textInFormat, null);
PrintService printer =
PrintServiceLookup.lookupDefaultPrintService();
DocPrintJob job = printer.createPrintJob();
job.print(textDoc, null);
} catch (Exception e) {e.printStackTrace();}
Here is the content of my.log file:
"Testing javax.print"
Here is the situation:
1. I can print out JPEG file with this javax.print API.
2. I can see my.log appear in the printer's job queue and indicate it
was printed out successfully.
3. But in fact printer didn't act! (If I print JPEG, it works)
4. I even try this way:
"Doc strDoc = new SimpleDoc("OK!", DocFlavor.STRING.TEXT_PLAIN,
null);"
But error message has been throwed out:
"sun.print.PrintJobFlavorException: invalid flavor"

Any help appreciate!!

Ken
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please do not duplicate posts. Most people read more than one forum.
 
reply
    Bookmark Topic Watch Topic
  • New Topic