Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Printing - Receipt page height

807591Sep 3 2003 — edited Mar 5 2008
I am currently working on a Point Of Sale system and am having a hard time w/ the receipt layout. I can not get the paper height to work. It always cuts off at 11 inches or so. I also am making changes to the paper width and margins which work fine. here is the code that I define the paper and pageformat. I'd appreciate any help on this.
   public void Printer()
        {
            PrinterJob pj = PrinterJob.getPrinterJob();
            Paper paper = new Paper(); 
            PageFormat fmt = new PageFormat();  
           
            paper.setSize(200,2400); 
            paper.setImageableArea(10,10,180,2380);
            
            fmt.setPaper(paper); 
                
            pj.setPrintable(this, fmt);
 
            PrintService[] services = PrinterJob.lookupPrintServices();
 
            PrintService ps = null; 
            
            for (int i=0; i<services.length; i++) 
            {
             //        System.out.println("Selected Printer: " + services.getName()); 

String sPrinterName = services[i].getName();

if (sPrinterName.startsWith(recpt.sHostRecptPrinterName))
{
ps = services[i];
System.out.println("Found receipt Printer: " + services[i].getName());
}
}

try
{
pj.setCopies(1);
pj.setPrintService(ps);

pj.print();
}
catch (PrinterException pe)
{
System.out.println(pe);
}
}

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 2 2008
Added on Sep 3 2003
7 comments
252 views