about printer
Posted: 03 Dec 2015, 06:45
Hello! Print how to select range
example autodesk dwg truview : what to plot "windows"
Thank you

example autodesk dwg truview : what to plot "windows"
Thank you

CADSoftTools - AutoCAD DWG DXF HPGL (PLT) SVG CGM STEP IGES STL SAT viewers, converters and developer tools. Delphi and C# source code.
https://cadsofttools.com/forum/
Code: Select all
FDNavigator.LoadFromFile(OpenPictureDialog1.FileName);
Code: Select all
FDNavigator.ClipRectangle := True
Code: Select all
uses
Windows, Graphics, Dialogs, ..., Printers;
procedure PrintImage(AGraphic: TGraphic);
const PO: array[Boolean] of TPrinterOrientation = (poPortrait, poLandscape);
var
W, H: Double;
PW, PH: Integer;
R: TRect;
begin
with Printer do
begin
Orientation := PO[AGraphic.Width > AGraphic.Height];
W := PageWidth / AGraphic.Width;
H := PageHeight / AGraphic.Height;
if W > H then W := H;
PW := Round(W * AGraphic.Width);
PH := Round(W * AGraphic.Height);
R := Bounds((PageWidth - PW) div 2, (PageHeight - PH) div 2, PW, PH);
Printer.BeginDoc;
try
Printer.Canvas.StretchDraw(R, AGraphic);
except
Printer.EndDoc;
ShowMessage('Problem while printing, please try again.');
end;
Printer.EndDoc;
end;
end;
...
PrintImage(FDNavigator.ActualGraphic);