Search
Printing and Print Previewing

Settings for printing

The PrintOptions structure exposes the available setting for printing and print preview. The visualization properties in that structure are used both for printing and for preview. That allows achieving uniform output on the printed pages and on the display. Members of the structure expose as string properties all the text displayed in the preview window and in page headers; that enables easy internationalization of the end-user application.

Printing

Invoke the PrintDiagram method to start a print job. Many settings for the print output can be altered via the PrintOptions structure. You might switch on or off the printing of shadows, images, headers, shape interior fill and more. You can also set the PreferredDevice member of the structure to a printer name; that makes the print jobs always start on the specified printer, without displaying a printer selection dialog.

Print preview

The PreviewDiagram method displays a print preview window. An extended version of this method, OpenPreviewWindow, gives you more control over the preview window position and attributes. The PrintOptions structure is used to specify various visualization settings, both for printing and print preview. It also exposes the captions of the print preview window and toolbar buttons as properties. That allows you to localize / internationalize your end-user application.

Print scaling

When printing a diagram, the output can be scaled as specified via PrintOptions.ScaleFactor property. The ScaleToPage method of PrintOptions queries the default printer about its page size and sets the ScaleFactor to a value that makes the whole diagram fit in a single page. There is also a 'Fit Page' button on the Print Preview toolbar, that allows users scale the diagram to fit single page. The title of the 'Fit Page' button can be set via the PreviewStrFitPage property.

Page markers

Page markers can be drawn on the screen to indicate where page boundaries would be if a diagram is printed with the default printer. That can be enabled via the ShowPageMarkers property of PrintOptions. Visual settings of page markers can be specified via PageMarkersColor, PageMarkersWidth and PageMarkersStyle.

Obsolete methods

Diagrams can be printed via the PrintChart or PrintOnDev methods. PrintChart shows standard Windows print dialog to let users choose the printer to be used and configure the print settings. PrintOnDev takes the printer name as parameter and proceeds directly to printing, without displaying that dialog.