Results 1 to 1 of 1
Thread: Printing (no dialog)
-
Printing (no dialog)
Sometimes, you wish to print some stuff from your Java application and don't want the print dialog to be displayed. The code below does exactly that.
Java Code:JobAttributes theJobAttribs = new JobAttributes(); PageAttributes thePageAttribs = new PageAttributes(); theJobAttribs.setDialog(JobAttributes.DialogType.NONE); theJobAttribs.setPrinter("HP DeskJet 610C"); // the printer to be used PrintJob myJob = getToolkit().getPrintJob(this, "PrintJob", theJobAttribs, thePageAttribs); if (myJob != null) { Graphics g = myJob.getGraphics(); if (g != null) { String s = myArea.getText(); // what you like to print printText(myJob, g, s); g.dispose(); } myJob.end(); }
Similar Threads
-
Problem after Printing GUI.
By coldblood22 in forum AWT / SwingReplies: 1Last Post: 04-05-2008, 02:43 PM -
Printing using java
By ramachandran in forum Advanced JavaReplies: 1Last Post: 01-05-2008, 10:16 AM -
printing problem
By ntpl in forum AWT / SwingReplies: 0Last Post: 11-27-2007, 11:20 AM -
Printing contents of a web page
By Java Tip in forum Java TipReplies: 0Last Post: 11-26-2007, 12:37 PM -
[Java Printing]
By remnahush in forum Advanced JavaReplies: 1Last Post: 11-08-2007, 03:28 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks