Multipage print construct fails paper size after 1 page in landscape mode
Original Reporter info from Mantis: lstenberg
-
Reporter name: Lars J. Stenberg
Original Reporter info from Mantis: lstenberg
- Reporter name: Lars J. Stenberg
Description:
I have the following multipage print construct in a Lazarus application targeting CUPS printers:
-----------------------------------------------------------------------------------------------
if not Topmenu.PrintDialog1.Execute then
begin
ShowMessage('Please reset configuration!');
exit;
end;
...
Printer.BeginDoc;
...
for i := 1 to 5 do
begin
try
rct := Rect((100-PScale)*(Printer.PageWidth div 100),
(100-PScale)*(Printer.PageHeight div 100),
PScale*(Printer.PageWidth div 100),
PScale*(Printer.PageHeight div 100));
Chart.Draw(TPrinterDrawer.Create(Printer), rct);
finally { Some kind of error handling here };
end;
if i < 5 then
Printer.NewPage;
end; { for loop }
Printer.EndDoc;
-----------------------------------------------------------------------------------------------
The above code works fine in portrait mode - i.e. generates 5 pages, equally sized portrait prints on my three printers (Canon MG6350 inkjet, Brother HL-L2375DW laser and generic CUPS-PDF). However, when I change orientation to landscape, 1. page comes out correct but the following 4 pages though oriented correct are printed on an odd size (scale) paper format. When the code is compiled for and executed under Win10, no problem - everything works right. Suspect a CUPS server bug since all my printers behave odd in landscape mode under linux, while the same printers works the same and perfect under Win10.
Steps to reproduce:
If needed & requested, I can provide full Linux/Win source and/or executables (8-12MB)
Mantis conversion info:
- Mantis ID: 35652
- OS: Mint 19.1 kernel 4.15.0-50-gener
- OS Build: 19.1
- Build: Lazarus
- Platform: Linux
- Version: 2.0