Results 1 to 2 of 2
  1. #1
    wakeup is offline Member
    Join Date
    Aug 2016
    Posts
    1
    Rep Power
    0

    Default Java thermal printer: Bottom margin before auto cut

    I have a java program, which send jobs to a thermal printer. It prints ok, but it auto cut the paper just after the last image o text without a margin.

    How can I set a bottom margin? I have tried printing empty strings or space characters but it it doesn't print it cuts before.

    I'm using java.awt.print.

    Thanks

    Java Code:
      PrinterJob job = PrinterJob.getPrinterJob();
        job.setPrintable(this);
    
    
        PageFormat pf = job.defaultPage();
        Paper paper = pf.getPaper();
        double width = 3 * 72;
        double height = 200000;// * 72;
        double margin = 0;// * 72;
        paper.setSize(width, height);
        paper.setImageableArea(margin, margin, width - (margin * 2), height - (margin * 2));
    
        pf.setPaper(paper);
    
    
        job.setPrintable(this,  pf);
    
        try {
            job.print();
        } catch (PrinterException ex) {
            return 0;
        }

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,059
    Rep Power
    26

    Default Re: Java thermal printer: Bottom margin before auto cut

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 1
    Last Post: 08-02-2012, 04:44 PM
  2. PDF Printing - Margin Problem
    By faoilean in forum Advanced Java
    Replies: 0
    Last Post: 01-24-2011, 10:15 AM
  3. Replies: 2
    Last Post: 02-20-2009, 07:25 AM
  4. Specifying a Network Printer in Printer Servlet
    By shapez in forum New To Java
    Replies: 0
    Last Post: 03-06-2008, 03:21 PM
  5. Replies: 0
    Last Post: 08-09-2007, 06:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •