If your printer doesn't support custom paper sizes, then
setting one will just cause the closest supported paper
size to be used.

However there is also a bug specific to the case when the
end user then changes the printer in the print dialog
to one that is not the system default one where we
validate against the original printer, not the selected one.

That's 6359283 PrinterJob.pageDialog() ret. incorrect PageFormat when 
non-default
printer used. Its only fixed in JDK 7 builds.
http://bugs.sun.com/view_bug.do?bug_id=6359283

If neither of the above describe your situation, then
try running the latest JRE : 1.6.0_03 (you didn't mention
this so far as I could see).

If none of that helps you would need to provide a complete small
self-contained test program (not just code snippets), and also
the exact JRE version (output from java -version) and
also the O/S and printer model and driver so we could
look further.

-phil.

[EMAIL PROTECTED] wrote:
Hi Piet thanks for your help, I am trying to resolve my problem using your code 
but it did not worked. I am still getting the size A5 no matter what I try to 
define. I don't know if I am missing something. Please look at the following 
code and see if you can find what I cant find.

PageFormat pageFormat = createFormat();
try {
                        job.setPrintable(this,pageFormat);
                        if (job.printDialog()) {
                                job.print();
                        }
                } catch (PrinterException e) {
                        e.printStackTrace();
                }


private PageFormat createFormat() {
                PageFormat format = new PageFormat();
                format.setPaper(new Custom());
                return format;
        }

    private class Custom extends Paper {

                public Custom() {
                        super();
                        setSize(491, 594);
                        setImageableArea(36.0, 36.0, 522.99212598425197, 
450.8897637795276);
                }
        }
[Message sent by forum member 'lucho01' (lucho01)]

http://forums.java.net/jive/thread.jspa?messageID=241236

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to