Higher DPI than 72

R

RCS

Anyone knows how to set the printer resolution to higher than the
default 72 DPI?

In the Java docs it's suggested to use java.awt.PageAttributes (the
method setPrinterResolution), but how?

The docs only gives me: "A set of attributes which control the output of
a printed page."

I got no clue with which class this class will be 'linked' with, there's
no "setPageAttributes" method or similar in PrinterJob, no hint of nothing!

Any help greatly apprecieated!

RCS
 
P

Paul Lutus

RCS said:
Anyone knows how to set the printer resolution to higher than the
default 72 DPI?

In the Java docs it's suggested to use java.awt.PageAttributes (the
method setPrinterResolution), but how?

The docs only gives me: "A set of attributes which control the output of
a printed page."

I got no clue with which class this class will be 'linked' with, there's
no "setPageAttributes" method or similar in PrinterJob, no hint of
nothing!

But you just told us above which class setPrinterResolution() belongs to:
java.awt.PageAttributes.

http://java.sun.com/j2se/1.3/docs/api/java/awt/PageAttributes.html

http://java.sun.com/j2se/1.3/docs/api/java/awt/PageAttributes.html#setPrinterResolution(int)

A tutorial on this general topic:

http://www.javaworld.com/javaworld/jw-10-2000/jw-1020-print.html
 
I

Ixtlan

But you just told us above which class setPrinterResolution() belongs to:
java.awt.PageAttributes.

Yes, I knew that, and looked up the class, but there's no hint of how to
actually use the class. I can set the
PageAttributes.setPrinterResolution(300) for example, but then what's next?

The other printing classes won't automatically pick up the presence of this
class, will they?

As I said, I'm at loss!


Thank you very much for this link, though, I might find something there.

Regards,

RCS
 
F

Folke Bengtsson

java.awt.PrintJob ---> max 72dpi
java.awt.print.PrinterJob ---> more than 72dpi
 
R

RCS

Folke Bengtsson said:
java.awt.PrintJob ---> max 72dpi
java.awt.print.PrinterJob ---> more than 72dpi

So PrinterJob automatically detects the required DPI?

How do I choose a specific DPI for each printout?

Thanks in advance!

RCS
 
C

Chris Smith

RCS said:
So PrinterJob automatically detects the required DPI?

How do I choose a specific DPI for each printout?

I don't really know anything about this, but a quick look at the API
documentation reveals:

1. You create a PrinterJob with PrinterJob.getPrinterJob()

2. When calling print, you can pass a PrintRequestAttributeSet (or
rather a concrete implementation like HashPrintRequestAttributeSet).

3. You can add Attribute instances to the attribute set.

4. There is an Attribute instance called
javax.print.attribute.standard.PrinterResolution.

So create an instance of PrinterResolution with the desired resolution,
then set it in a PrintRequestAttributeSet, then pass that to the print
method in PrinterJob.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
R

RCS

Chris said:
I don't really know anything about this, but a quick look at the API
documentation reveals:

1. You create a PrinterJob with PrinterJob.getPrinterJob()

2. When calling print, you can pass a PrintRequestAttributeSet (or
rather a concrete implementation like HashPrintRequestAttributeSet).

3. You can add Attribute instances to the attribute set.

4. There is an Attribute instance called
javax.print.attribute.standard.PrinterResolution.

So create an instance of PrinterResolution with the desired resolution,
then set it in a PrintRequestAttributeSet, then pass that to the print
method in PrinterJob.

Ahhhh, finally something I can work with! I really did not know about
PrintRequestAttributeSet.

Thank you!

RCS
 

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,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top