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

K

Ken

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
 
A

Andrew Thompson

| I'm working with the JDK 1.4.2_01-b02 on XP. I try to print...

Do not cross post to 4 groups. *
You are not that important, Ken.

[* invalid groups dropped ..
comp.lang.java.api,comp.lang.java.developer.. ]

....
| Any help appreciate!!

http://www.physci.org/codes/sscce.jsp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top