I'm somewhat further forward, having three operational buttons to [Print], [Page Setup] & [Select Printer] but there is still an action which is eluding me.
I'm using the code :
procedure TForm1.PrintImgClick(Sender: TObject);
procedure PrintDescription;
begin
PrintCentrePage(10,Desc,1,16,1);
end;
procedure PrintTooth;
begin
end;
begin
with Printer do
try
BeginDoc;
if P_Orient = 'P' then
Orientation := poPortrait
else
Orientation := poLandscape;
PrintDescription;
// PrintTooth;
finally
EndDoc;
end;
end;
to create the print - I haven't yet coded 'Print Tooth' as you can see, I'm just testing that the 'Description' prints at top centre which it does
IF the Page Setup is in the correct orientation. That is lines 15 to 19 have no effect.
Using that same code in the [Page Setup] proc - - - -
procedure TForm1.SetupClick(Sender: TObject);
begin
if P_Orient = 'P' then
Printer.Orientation := poPortrait
else
Printer.Orientation := poLandscape;
PageSetup.Execute;
end;
... correctly sets the orientation but only if I use that button each time. I would have expected that to be sufficient to make the approriate change in Code. It seems wrong to need to insert 'PageSetup.Execute;' at Line 20 which would open the Dialogue every time.
It's useful to have the option to change the page size etc. using the [Page Setup] but it surely shouldn't be necessary to enter that dialogue explicitly when there is the facility to set 'Orientation' via code.
I've tested [Select Printer] - ie. I can change the printer in use -- and that works - as long as the orientation has been set with similar code in the [Select Printer] Proc.
I must be missing a 'magiic bullet' of some kind but can't see what or where yet