Initialization print control
KDPrinter ctrlPrinter = new KDPrinter ();
adding columns
// specified insertion position
table.addColumn (index);
// inserted in the last
table.addColumn ();
// add multiple rows disposable
addColumns (colCount);
Set Print data
to create a print job IPrintJob
IPrintJob PrintJob = new new BufferPrintJob ( "your name the job");
header and footer settings of the print job (may not be provided, in the page Setup dialog box can also set)
PaperHeader head = new new PaperHeader ();
LabelCell = new new LabelCell headLab ( "Your Content header");
headLab.setPainterBounds (0,. 1, 200 is, 10);
head.addPainter (headLab);
printJob.setHeader (head);
PaperFooter new new PaperFooter Foot = ();
foot.addPainter (headLab);
printJob.setFooter (Foot);
settings for printing the content provider
printJob.setPageProvider (new new IPageProvider () {
public Page GET (int index, PaperInfo info) {
// here to print each page of your data
}
});
info
add to create a good print job to the print control
ctrlPrinter.addPrintJob (printJob );
If you want to print directly: ctrlPrinter.printDirect ();
print preview
print preview dialog box:
ctrlPrint.printPreview (the Component parent);
Print settings
the Print settings dialog box; the role of the dialog box on all print jobs
ctrlPrint.printDialog ( Component parent);
page settings
for each print job has a different set of pages, so the page Setup dialog box to bring up the print job by
printJob.pageDialog (Component parent);
eas of date selection control
Guess you like
Origin www.cnblogs.com/luojiabao/p/10964280.html
Ranking