The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



CopyToOpenPrinter


Unit:SDL_rot3d
Class:TRot3D
Declaration:procedure CopyToOpenPrinter (var x,y: integer; ScaleF: double; BlkWhite, IncludeFrame: boolean);

The method CopyToOpenPrinter is a more flexible alternative to the method PrintIt. It provides a way to create a graphical output on the currently selected printer. You may change the selected printer by assigning a proper value to the PrinterIndex property of the Printer object before calling CopyToOpenPrinter. In contrast to PrintIt, the user has to take care by himself that the printer object is already open for receiving data. This can be accomplished either by the method Printer.BeginDoc (see Delphi manual for details), or by assigning the printer output to a text file (Delphi procedure AssignPrn).

The variable parameters x and y contain the coordinates of the upper left corner of the chart in printer coordinates on entry of the routine, and return the printer coordinates of the lower right corner of the chart after the method is finished. This feature can be used to combine several hardcopies on one page, since the x- and the y-values after a first hardcopy can be partly used as inputs of the next hardcopy.

The parameter ScaleF determines the magnification factor of the printout. A factor of 1.0 creates an output which has roughly the size of the screen image. If the parameter BlkWhite is set to TRUE, the colors of the chart are suppressed and the chart is printed in black and white. This is normally the best way to proceed with B&W printers. The parameter IncludeFrame controls whether the frame of the component is printed.

Hint 1: There are a few restrictions concerning the printout created by CopyToOpenPrinter . These restrictions are due to some bugs (or "features") in the Windows graphics library and in some printer drivers: (1) dashed lines (as in grid lines) are printed as solid lines; (2) light colors are not printed at all on some black and white printers; (3) on some printers text items may not be clipped properly at the chart borders.

Example: The following code snippet shows a short example how to mix several graphics and some text on one printer page.
 
if PrinterDialog1.Execute then
  begin
  Printer.Title := 'Test';
  Printer.BeginDoc;
  Printer.Canvas.TextOut (300,180,'This is some text');
  Printer.Canvas.TextOut (300,380,'Another text line');
  x := 100;
  y := 580;
  Rot3D1.CopyToOpenPrinter (x,y, 0.8, true);   { the first chart }
  Printer.Canvas.TextOut (300,y+50,'Yet another line of text');
  x := 300;
  y := y+280;
  Rot3D1.CopyToOpenPrinter (x,y, 0.4, true);  { the second chart }
  Printer.EndDoc;
  end;

Hint 2: When printing to Adobe Distiller, release 7.0 or later, you have to specify the property Title of the printer (Printer.Title = 'Any Title'), otherwise the Adobe printer driver will crash.



Last Update: 2023-Dec-14