Printing to 11x17 Paper
Posted: Wed Nov 15, 2006 3:32 pm
Using the Chart.Print method from a preview panel how do I set it so it prints it to a 11x17 paper rather than 8.5x11?
Thanks,
Tom
Thanks,
Tom
Steema Software - Customer Support Forums
http://216.92.101.67/support/
Print preview panel gets it's page size from currently selected printer. To change (programatically) page size prior to showing print preview editor, you'll have to use the approach, described at Borland bdn. Link:9242408 wrote:Using the Chart.Print method from a preview panel how do I set it so it prints it to a 11x17 paper rather than 8.5x11?
Code: Select all
var
Device : array[0..255] of char;
Driver : array[0..255] of char;
Port : array[0..255] of char;
hDMode : THandle;
PDMode : PDEVMODE;
begin
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.GetPrinter(Device, Driver, Port, hDMode);
if hDMode <> 0 then begin
pDMode := GlobalLock(hDMode);
if pDMode <> nil then begin
{Set to 11x17}
pDMode^.dmFields := pDMode^.dmFields or dm_PaperSize;
pDMode^.dmPaperSize := DMPAPER_11X17;
GlobalUnlock(hDMode);
end;
end;
ChartPreviewer1.Execute;
end;
Code: Select all
procedure TForm1.AdvToolBarButton14Click(Sender: TObject);
Var
topc,botc: Integer;
Device : array[0..255] of char;
Driver : array[0..255] of char;
Port : array[0..255] of char;
hDMode : THandle;
PDMode : PDEVMODE;
begin
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.GetPrinter(Device, Driver, Port, hDMode);
if hDMode <> 0 then begin
pDMode := GlobalLock(hDMode);
if pDMode <> nil then begin
{Set to 11x17}
pDMode^.dmFields := pDMode^.dmFields or dm_PaperSize;
pDMode^.dmPaperSize := DMPAPER_11X17;
GlobalUnlock(hDMode);
end;
end;
topc := 10;
botc := 70;
for i := 0 to charts - 1 do
begin
TeePreviewPanel1.Panels.Add(mychart[i]);
mychart[i].PrintProportional := False;
mychart[i].PrintMargins:=Rect(1,topc,1,botc);
topc := topc + 20;
botc := botc - 20;
end;
TeePreviewPanel1.Orientation := ppoPortrait;
TeePreviewPanel1.Print;
//ChartPreviewer1.Execute;
end;