Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Printing issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Printing issue



Hi all!

I'm trying to print my custom component that implements interface Printable width JDK 1.4.2.

And it gives next exception:

apple.awt.EventQueueExceptionHandler Caught Throwable : java.lang.NullPointerException
java.lang.NullPointerException
at sun.print.CPrintJob.printableJob(CPrintJob.java:310)
at sun.print.CPrintJob.print(CPrintJob.java:173)


My code:

PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;


DocPrintJob job = PrintServiceLookup.lookupDefaultPrintService().createPrintJob();


if (job == null) System.out.println ("job = null");

DocAttributeSet das = new HashDocAttributeSet();


final Component printIt = new MailingLabelPane ();


Doc doc = new SimpleDoc(printIt, flavor, das);
if (doc == null) System.out.println ("doc = null");
try {
job.print(doc, pras);
} catch (PrintException pe) {
System.out.println (" PrintException occured :( ");
pe.printStackTrace();
}


Please help me to find a mistake.

Thank you!

==
Best Regards
Andrew Kachalo
http://www.geocities.com/andrew_kachalo/
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.