Problem description
First, let us remind you that the reporting tool Stimulsoft Reports.AVALONIA was introduced recently in the 2023.4 version of our products. The initial versions of the product didn’t include printing functionality, which can be explained by the features of Avalonia UI. Avalonia is a cross-platform framework, meaning it operates on all major operating systems, which significantly complicates the implementation of document printing functionality. Based on the recommendations of the platform developers, the only viable solution is to write separate API code for each operating system.Solution
We addressed this issue with a workaround: when the Print button is pressed, a "silent" export of the document to PDF is performed (a "silent" export means exporting the document using default settings without displaying the settings window) and the document is saved as a temporary file in a special folder. After that, depending on the operating system, the process continues as follows.Windows systems
A key point to note is that any PDF viewer must be installed in the system, and file association for PDF files must be set. We invoke the print command for the exported PDF file via the command line using the associated application.Currently, printing will be carried out on the default printer. If the user has multiple printers and needs to print on a non-default printer, we can add a special class where the desired printer name is specified (for this please contact our support). Important!
Keep in mind a particular characteristic of Windows OS: after printing, the document itself is closed in the application, but the application may remain open. This behavior can’t be influenced from our side.
Unix systems (macOS, Linux)
In Unix-based systems, the printing process is simpler: it’s enough to export the document to PDF and save the file. Printing is then performed using the system command lp. This command is included by default in Unix-based systems, and no additional installation is required.The implementation of printing in Reports.AVALONIA will be available in the upcoming minor version of Stimulsoft products.