Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Print Dialog

 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Am using the below code to print the txt files. But its not showing print dialog, By default its printing in default printer

Someone please assist me, how to invoke the print dialog using below code.

 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked at the java.awt.print API, specifically the PrintJob? There is also a Printing lesson in the Tutorials.
 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve thanks for replying. I seen all these tutorials nothing helps me. awt is not working in my case, the only code support for my case is as I submitted above
Need the Print Dialog for that code. Please help


Any way to merge below code in the above method to display print dialog, Please assist

PrinterJob pj = PrinterJob.getPrinterJob();
pj.printDialog();
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic