Programming with JViews Maps > Creating a Map Application Using the API > Printing

ILOG JViews Maps provides specialized printing classes derived from the framework printing classes. These classes are use to print of a map with or without a legend. The printing of the legend can be configured in the map configuration tab of the setup dialog.

To print a map, do the following:

// construct a new IlvMapPrintingController for the given view.
IlvMapPrintingController controller = new IlvMapPrintingController(view);
// configure the document
IlvPrintableDocument document = controller.getDocument();
document.setName(<Name of the Document>);
document.setAuthor(controller.getPrinterJob().getUserName());
document.setPageFormat(controller.getPrinterJob().defaultPage());

At this point, you can do one of the following:

// print preview
controller.printPreview(frame);
// print setup
controller.setupDialog(frame, true, true);
// print
controller.print(true);

For more information, see The Generic Printing Framework.