Results 1 to 6 of 6
Thread: Printing problem
- 08-02-2010, 03:53 AM #1
Member
- Join Date
- Jun 2010
- Posts
- 18
- Rep Power
- 0
- 08-02-2010, 04:55 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Can you show what you've done?
- 08-02-2010, 08:33 AM #3
Member
- Join Date
- Jun 2010
- Posts
- 18
- Rep Power
- 0
try
{
JFrame frame = new JFrame("Print");
PrintJob printer = getToolkit().getPrintJob(frame, "Payment Receipt", null);
PageFormat pageFormat = new PageFormat();
pageFormat.setOrientation(PageFormat.LANDSCAPE);
if (printer != null)
{
Graphics grPrintPage = printer.getGraphics();
grPrintPage.drawString("Computer ID",60, 60 );
grPrintPage.dispose();
printer.end();
}
- 08-03-2010, 08:17 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Try to alter the default page.
Java Code:PrinterJob objJob = PrinterJob.getPrinterJob(); PageFormat pf = objJob.defaultPage(); pf.setOrientation(PageFormat.LANDSCAPE);
- 08-03-2010, 08:42 AM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,466
- Rep Power
- 16
Yep.
All you're doing is creating a PageFormat object that you don't actually use with the PrintJob.
- 08-03-2010, 02:41 PM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Yeah, I guess that OP will test it. If read more on the API could easily find.
@OP, and also please use code tags when you posting again. Unformatted codes are really hard to read. If you don't know how to do it, check on my forum signature.
Similar Threads
-
Problem printing an array
By denial in forum New To JavaReplies: 3Last Post: 11-01-2009, 10:09 PM -
Printing only one page problem
By AndreiDMS in forum Java 2DReplies: 0Last Post: 10-09-2009, 03:03 AM -
Problem in printing JTable values
By shanssat in forum AWT / SwingReplies: 3Last Post: 02-04-2009, 08:15 AM -
Problem after Printing GUI.
By coldblood22 in forum AWT / SwingReplies: 1Last Post: 04-05-2008, 02:43 PM -
printing problem
By ntpl in forum AWT / SwingReplies: 0Last Post: 11-27-2007, 11:20 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks