Java 2d Print API

S

Steven Green

I am trying to figure out the Java 2d Print api.
Most of it is simple enough, but I am totally confused about file output.

I want to use the print api to generate a file output but cannot figure
out how to do this in a PrintJob.

Any idea how to write out to a file?

Thanks in advance.

Steve
 
S

Simon Righarts

Steven Green said:
I am trying to figure out the Java 2d Print api.
Most of it is simple enough, but I am totally confused about file output.

I want to use the print api to generate a file output but cannot figure
out how to do this in a PrintJob.

Any idea how to write out to a file?

Thanks in advance.

Why did this go to the GUI group? It's off-topic there.

Anyway, one way I can see to do it would be to implement PrintService - it's
ugly, but would work - then get that PrintService and use that to print to a
file.

Also:

A: PrintJob is part of the AWT - *not* part of the javax.print API - be
clear about what you're talking about.
B: Why not just use regular I/O? Faster, easier, and (hopefully) precisely
the same output.
C: If you absolutely must use Doc/SimpleDoc, why not define your own method
to take a Doc, then just dump the underlying Object to a stream?
 
S

Steven Green

I started off my project assuming that I would write my own Postscript
printing routines and have implemented a crude incomplete class to handle
this. Nothing on the complexity of the Graphics2D style printing which I
wanted to check out.

I wasn't clear on the javax.print/java.print routines because I simply
don't understand the APIs well enough. I have been trying to figure them
out.

I thought that the PrintJob class was required to render out a print file.
B: Why not just use regular I/O? Faster, easier, and (hopefully)
precisely the same output.

Because I don't understand these well enough I guess, I have been trying
to find documentation on these API but have not had much success. Can you
give me some more detail on what you mean here? I don't understand this
suggestion.

My implementation isn't so far along that I couldn't change
directions.

Thanks again,

Steve
 
S

Steven Green

Never mind, I figured out how it works.
I needed to set the Destination attribute in the attribute set to get the
printout to go where I wanted.

Thanks again for all your help.

Steve
 

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

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,277
Latest member
VytoKetoReview

Latest Threads

Top