Send content directly to a printer

Good morning,

This is my first post although I have been accessing this forum for a long time to solve several issues I had in the past. I am almost new working with vaadin so I am very sorry if I ask for a very simple question. To be honest it seems easy from the functional point of view but I was not able to find a solution. As a summary, I am trying to find the way to print the content of a table, and only that information, with the complete layout (header of the columns and content). I found a solution using Javascript to print the view of the current page, but the result is the same as Ctrl+P in the web browser and it is not what I am looking for (the page cannot fit the content). I also found a thread in this forum with an explanation about to create a new window and send the table content as HTML, and then print it, but I was not able to create that scenario and I am not sure if the result will be the same as Ctrl+P.

The logic of my app is currently covering PDF and Excel conversion but I have been required to print directly the content of a component.

I am not asking for the final solution, the main purpose from my side is to avoid spending time trying to find a solution if it is not possible. Otherwise any guide or link that could help me to continue with my investigation will be very appreciated.

Thanks a lot for your time.

Kind regards.

David.

PD: My english is quite bad, sorry if I made mistakes in my explanation.

Since Vaadin components (and apps) aren’t really designed to be directly printed, the quick answer to your question is no. There is no way for you to isolate just one component inside a Vaadin app; as others said, you need to have it in a separate browser window for the browser to properly recognize it. The way most apps do it is to either produce the HTML as suggested, or PDFs. They usually make for nicer looking reports anyway.

Thank you so much for your answer Thomas. As we already have PDF conversion, I will try to create an HTML solution as close to the requirement as I could.

Kind regards,

David.

Actually, It has also happened to me as well as I got the error to print on the terminal process. They can also take free advice provided by [Canon Printer Error Code 5b02]
(https://errorcode0x.com/fix-canon-printer-error-code-5b02/) to overcome these issues easily