How to send data to the printer

Is there any function to fetch some content from the Cakephp controller side and send it to a file, which then opens a Print dialog to send it to the printer in Cakephp or JQuery?

+2


source to share


1 answer


First, you might want to use a print style sheet. This will allow you to hide certain things from your layout when users print your pages, such as navigation, search box, footer, etc.

Second, you can use jQuery to subtly insert a "Print this page" javascript link that will be activated by the browser's "Print" dialog on the user's screen upon activation.



Since this is a client-side thing, there is no real CakePHP solution for this problem. The only thing you can do is disable or change the layout used in the controller like this:

  • $this->layout = false;

  • $this->layout = 'print';

+4


source







All Articles