Page 1 of 1

When clicking the print button there is no printing action

Posted: Sat Aug 02, 2025 12:26 am
by JardelRogerioLemos
Using the demo project, I found that the print option is not running.

Re: When clicking the print button there is no printing action

Posted: Mon Aug 04, 2025 9:55 am
by Max Shamanov
Hello,

Please read the following article about printing in Avalonia:
https://www.stimulsoft.com/en/blog/arti ... s-avalonia

Thank you.

Re: When clicking the print button there is no printing action

Posted: Wed Aug 06, 2025 12:07 pm
by JardelRogerioLemos
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.

I need to print directly (Windows) to a local or network printer where I have the printer name, and this must be done silently. Could you help me?

Re: When clicking the print button there is no printing action

Posted: Wed Aug 06, 2025 3:43 pm
by Max Shamanov
Hello,

Unfortunately, as we mentioned earlier in the article, Avalonia does not have a direct print of the report.
As an option, you can export the report to PDF and then print the exported file from the command line.

Thank you.

Re: When clicking the print button there is no printing action

Posted: Wed Aug 06, 2025 5:08 pm
by JardelRogerioLemos
Could you help me with printing via the command line where I don't use the application?

Re: When clicking the print button there is no printing action

Posted: Fri Aug 08, 2025 7:50 am
by Max Shamanov
Hello,

You can try to use one of these methods:

1. Using Command Line with SumatraPDF (free, portable)
One of the simplest and most reliable methods.
Download SumatraPDF (a portable version is available).
Print command:

cmd

Code: Select all

SumatraPDF.exe -print-to "PrinterName" "path\to\file.pdf"
Example:
cmd

Code: Select all

SumatraPDF.exe -print-to "HP LaserJet P1005" "C:\docs\example.pdf"
You can also use -print-to-default to send it to the default printer.

2. Using PowerShell
If Adobe Reader (or a similar program) is installed, you can invoke it via PowerShell:

powershell

Code: Select all

Start-Process -FilePath "C:\docs\example.pdf" -Verb PrintTo -ArgumentList '"PrinterName"'
Note: This only works if the PDF reader supports the PrintTo verb. Adobe Reader usually does.

3. Using the Print utility with a virtual PDF printer
If you want to send a PDF to a virtual printer (like Microsoft Print to PDF), you can try:

cmd

Code: Select all

print /D:"\\PrinterName" "C:\docs\example.pdf"
However, print only works with plain text files — not PDF. So this method is generally not recommended for PDFs.

Thank you.

Re: When clicking the print button there is no printing action

Posted: Fri Aug 08, 2025 1:25 pm
by JardelRogerioLemos
Thanks!

Re: When clicking the print button there is no printing action

Posted: Mon Aug 11, 2025 8:56 am
by Max Shamanov
Hello.

We are always glad to help you.
Let us know if you need our help.

Thank you.