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
Printing to 11x17 Paper
Re: Printing to 11x17 Paper
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?
http://bdn.borland.com/article/15603
Here is the code I used in D2006 Win32:
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;
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
Well my only issue now is trying to get the charts to be the right size on the paper. 8.5x11 worked fine, but the charts are sooo huge on the larger paper. Is there a shrink to fit or fit to page option with the above code. Of course as usual I cant find any docs on it whatsoever.
Heres how I add my charts to the preview panel:
Thanks.
Tom
Heres how I add my charts to the preview panel:
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;
Thanks.
Tom
Tom
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Tom,
I've just sent you a document which can be found at news://www.steema.net/steema.public.attachments newsgroup. It is from my colleague Pep and its title is Printing Better.
I hope this helps.
I've just sent you a document which can be found at news://www.steema.net/steema.public.attachments newsgroup. It is from my colleague Pep and its title is Printing Better.
I hope this helps.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |