microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
791 stars 622 forks source link

Rendering of the report layout for custom layouts in combination with custom printers is not correct with the unit TenthsOfAMillimeter #22636

Open acadonAG-dev opened 1 year ago

acadonAG-dev commented 1 year ago

We have developed an extension in our company to print e.g. via PrintNode in BC and have the following bug there. If a report has a custom layout format (e.g. for label printing) smaller than A4 in combination with the landscape setting and the printer is added via the setting Enum:: "Printer Unit"::TenthsOfAMillimeter, the preview / PDF is rendered incorrectly. This results in a very very long report that does not correspond to the specified dimensions.

Wrong Rendered Report.pdf image

The printer is simply added to in the following way: (In this example as A6 format, but the bug also appears with other smaller formats)

PaperTray.Add('papersourcekind', 'Custom');
PaperTray.Add('paperkind', 'Custom');
PaperTray.Add('width', 1050);
PaperTray.Add('height', 1480);
PaperTray.Add('units', Enum::"Printer Unit"::TenthsOfAMillimeter.AsInteger());
PaperTray.Add('landscape', true or false doesn´t matter);
PaperTrays.Add(PaperTray);
Payload.Add('version', 1);
Payload.Add('description', 'MM A6 Printer (Tenths)');
Payload.Add('papertrays', PaperTrays);
Printers.Add('MM A6 Printer (Tenths)', Payload);

If you use any other units type like HundredthsOfAMillimeter or ThousandthsOfAnInch its working, only in the unit TenthsOfAMillimeter the report renderer does something wrong.

Steps to reproduce:

  1. Add in the SetupPrinters (Codeunit "Reporting Triggers") event the printer in the way like above.
  2. Create a report with any content and setup it as A6 format and in landscape
  3. Run the report with the added printer as preview or download rendered pdf

Or: DemoApp.zip Simply install the attached Demo App and search after "PrinterTest - TestReport" and execute it with the printer "MM A6 Printer (Tenths)". I also added some other printers in the demo app to show, thats only not working for the TenthsOfAMillimeter and only if its smaller than A4. For the A4 printer setting with the same TenthsOfAMillimeter unit setting, its working.

I tested this behavior on the latest OnPrem/Docker BC Installation for 21.5

OWKramer commented 1 year ago

Is there any information when the problem will be fixed?

Thank you in advance.