print at center of page?

Discussion in 'Java' started by terry, Aug 23, 2003.

  1. terry

    terry Guest

    Could I add codes below so as to print "jPanelPrint" at center of page?

    Thanks!


    DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
    PrintService printService =PrintServiceLookup.lookupDefaultPrintService();
    DocPrintJob job = printService.createPrintJob();
    PrintJobListener pjlistener = new PrintJobAdapter()
    {
    public void printDataTransferCompleted(PrintJobEvent e)
    {
    }
    };
    job.addPrintJobListener(pjlistener);
    PrintRequestAttributeSet pras=new HashPrintRequestAttributeSet();

    DocAttributeSet das = new HashDocAttributeSet();
    Doc doc=new SimpleDoc(jPanelPrint,flavor,das);

    try
    {
    job.print(doc,pras);
    }
    catch(PrintException pe)
    {
    pe.printStackTrace();
    }

    :
    :
    terry, Aug 23, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bernard Segonnes

    Print and print overview and current page

    Bernard Segonnes, Nov 4, 2004, in forum: Java
    Replies:
    0
    Views:
    447
    Bernard Segonnes
    Nov 4, 2004
  2. Sam
    Replies:
    1
    Views:
    653
    seigo
    Nov 10, 2006
  3. Ben
    Replies:
    5
    Views:
    5,278
  4. keto
    Replies:
    0
    Views:
    924
  5. David Cournapeau

    print a vs print '%s' % a vs print '%f' a

    David Cournapeau, Dec 30, 2008, in forum: Python
    Replies:
    0
    Views:
    345
    David Cournapeau
    Dec 30, 2008
Loading...

Share This Page