在PHP中打印到默认打印机的最佳方法是什么?

I have a PHP application with a standard interface that involves a grid of data.

When you click on a row in that grid, it takes you to a details page.

I'd like to have a "Print" button on that page, which prints a specific set of information to the default printer attached to the client machine.

Is this possible from PHP? I have found things online about printing to a printer attached to the server, but that's not really what I want. Do I need to do this from JavaScript, instead?

This is not possible using php. But you can do this in Javascript.

Just add window.print() on click on a specific element and this will open a print dialog.