• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Ken Liang
Posts: 7
  • Mark post as helpful
  • send pies
  • 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
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;
application/x-java-jvm-local-objectref; application;
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 =
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,
But error message has been throwed out:
"sun.print.PrintJobFlavorException: invalid flavor"

Any help appreciate!!

Marilyn de Queiroz
Posts: 9082
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not a beginner question. Let's try our luck in the intermediate forum.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!