T
terry
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();
}
:
:
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();
}
:
: